BillCraven / proxy-vole

Automatically exported from code.google.com/p/proxy-vole
0 stars 0 forks source link

XML Parsing in OSX-Strategy tries to load DTD from the internet #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
XML Parsing in PListParser has DTD Validation enabled. This causes the parser 
to load DTDs if they are referenced in the XML. If the location points to some 
internet resources, the DTD is loaded from there causing delays and timeouts if 
an internet connection is not available.

How to reproduce:
* Run OS-related tests, e.g. OsxProxySearchTest, on a machine which requires 
proxy settings to connect to the internet (not necessarily OSX, test also fails 
on Windows), tests will fail with socket time out exceptions. The problem is 
actually in PListParser where XML Parsing is done, but only manifests itself on 
OSX as only OsxProxySearchStrategy uses it currently.

This is bad for two reasons:
* Access to internet resources during XML Parsing can be slow/create overhead
* At this point, no proxy server is set up yet, so access fails or in our case 
runs into timeout causing very long delays during application startup.

Possible solutions:
a) Disable DTD Validation for the XML Parser
b) Store the DTD and provide an EntityResolver which avoids access to the 
internet

        documentBuilder.setEntityResolver(new EntityResolver() {
            @Override
            public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                // return an InputSource for the local DTD if the publicId matches...
            }
        });
                ...

Original issue reported on code.google.com by Dominik....@gmail.com on 1 Aug 2012 at 2:38

GoogleCodeExporter commented 9 years ago
Hi,
This is a good point. I will disable the DTD validation. The parsing code 
should be good enough to handle situations where the xml is not valid.

Thanks for reporting this.

Have fun,
- Rossi

Original comment by rosstaus...@googlemail.com on 14 Aug 2012 at 2:29

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r96.

Original comment by rosstaus...@googlemail.com on 23 Sep 2012 at 8:51