]> granicus.if.org Git - python/commitdiff
Patch #1426648: urllib proxy_bypass broken
authorGeorg Brandl <georg@python.org>
Sat, 18 Feb 2006 23:10:23 +0000 (23:10 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 18 Feb 2006 23:10:23 +0000 (23:10 +0000)
Lib/urllib.py

index e1fa743828c74d6afd0110d8c35451beabba67a9..aeca3f1007343e31b1418c75ef3d43c69d10ad19 100644 (file)
@@ -1403,13 +1403,20 @@ elif os.name == 'nt':
         if not proxyEnable or not proxyOverride:
             return 0
         # try to make a host list from name and IP address.
-        host = [host]
+        rawHost, port = splitport(host)
+        host = [rawHost]
         try:
-            addr = socket.gethostbyname(host[0])
-            if addr != host:
+            addr = socket.gethostbyname(rawHost)
+            if addr != rawHost:
                 host.append(addr)
         except socket.error:
             pass
+        try:
+            fqdn = socket.getfqdn(rawHost)
+            if fqdn != rawHost:
+                host.append(fqdn)
+        except socket.error:
+            pass
         # make a check value list from the registry entry: replace the
         # '<local>' string by the localhost entry and the corresponding
         # canonical entry.