]> granicus.if.org Git - python/commitdiff
Hopeful fix for SF bug 503031: urllib.py: open_http() host problem.
authorGuido van Rossum <guido@python.org>
Sun, 31 Mar 2002 23:38:48 +0000 (23:38 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 31 Mar 2002 23:38:48 +0000 (23:38 +0000)
I really can't test this, but from reading the discussion in that bug
report, it's likely that this works.  It may also close a whole bunch
of other bug reports related to urllib and proxies on Windows, but who
knows.

Lib/urllib.py

index 2ba55908778a6770a926998c2b8956e0cee54c8a..123642ac9f9fc9388c712df5c90e1412bd17c8d1 100644 (file)
@@ -1278,7 +1278,11 @@ elif os.name == 'nt':
                     # Per-protocol settings
                     for p in proxyServer.split(';'):
                         protocol, address = p.split('=', 1)
-                        proxies[protocol] = '%s://%s' % (protocol, address)
+                        # See if address has a type:// prefix
+                        type, address = splittype(address)
+                        if not type:
+                            address = '%s://%s' % (protocol, address)
+                        proxies[protocol] = address
                 else:
                     # Use one setting for all protocols
                     if proxyServer[:5] == 'http:':