[Python-Dev] urllib problems under 2.0

Skip Montanaro skip@mojam.com (Skip Montanaro)
Tue, 12 Sep 2000 16:26:49 -0500 (CDT)

    Guido> (This should also be documented for Unix if it isn't already;
    Guido> problems with configuring proxies are ever-recurring questions it
    Guido> seems.  I haven't used a proxy in years so I'm not good at fixing
    Guido> it... :-)

Under Unix, proxy server specifications are simply URLs (or URIs?) that
specify a protocol ("scheme" in urlparse parlance), a host and (usually) a
port, e.g.:

    http_proxy='http://manatee.mojam.com:3128' ; export http_proxy

I've been having an ongoing discussion with a Windows user who seems to be
stumbling upon the same problem that Fredrik encountered.  If I read the
urllib.getproxies_registry code correctly, it looks like it's expecting a
string that doesn't include a protocol, e.g. simply
"manatee.mojam.com:3128".  This seems a bit inflexible to me, since you
might want to offer multiprotocol proxies through a single URI (though that
may well be what Windows offers its users).  For instance, I believe Squid
will proxy both ftp and http requests via HTTP.  Requiring ftp proxies to do
so via ftp seems inflexible.  My thought (and I can't test this) is that the
code around urllib.py line 1124 should be

                else:        # Use one setting for all protocols
                    proxies['http'] = proxyServer
                    proxies['ftp'] = proxyServer

but that's just a guess based upon the values this other fellow has sent me
and assumes that the Windows registry is supposed to hold proxy informations
that contains the protocol.  I cc'd Mark Hammond on my last email to the
user.  Perhaps he'll have something interesting to say when he gets up.