[Python-Dev] urllib problems under 2.0

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Tue, 12 Sep 2000 21:12:20 +0200


the proxy code in 2.0b1's new urllib is broken on my box.

here's the troublemaker:

                proxyServer = str(_winreg.QueryValueEx(internetSettings,
                                                       'ProxyServer')[0])
                if ';' in proxyServer:        # Per-protocol settings
                    for p in proxyServer.split(';'):
                        protocol, address = p.split('=')
                        proxies[protocol] = '%s://%s' % (protocol, address)
                else:        # Use one setting for all protocols
                    proxies['http'] = 'http://%s' % proxyServer
                    proxies['ftp'] = 'ftp://%s' % proxyServer

now, on my box, the proxyServer string is "https=127.0.0.1:1080"
(an encryption proxy used by my bank), so the above code happily
creates the following proxy dictionary:

proxy = {
    "http": "http://https=127.0.0.1:1080"
    "ftp": "http://https=127.0.0.1:1080"
}

which, of course, results in a "host not found" no matter what URL
I pass to urllib...

:::

a simple fix would be to change the initial test to:

                if "=" in proxyServer:

does anyone have a better idea, or should I check this one
in right away?

</F>