]> granicus.if.org Git - python/commitdiff
missed the obvious test case and corresponding fix
authorSkip Montanaro <skip@pobox.com>
Tue, 14 Sep 2004 17:55:21 +0000 (17:55 +0000)
committerSkip Montanaro <skip@pobox.com>
Tue, 14 Sep 2004 17:55:21 +0000 (17:55 +0000)
Lib/httplib.py
Lib/test/test_httplib.py

index 2f117d8d5d54744a158307bb0e3f2021eccb9f30..b7276af357f96f9f69b849a78f53125ac980930c 100644 (file)
@@ -525,7 +525,8 @@ class HTTPConnection:
     def _set_hostport(self, host, port):
         if port is None:
             i = host.rfind(':')
-            if i >= 0:
+            j = host.rfind(']')         # ipv6 addresses have [...]
+            if i > j:
                 try:
                     port = int(host[i+1:])
                 except ValueError:
index b49f71d2e33c0857cb634b9a6952465ceb72d29d..046f4f871a4048881b992f1a54180d23ad65a735 100644 (file)
@@ -119,7 +119,7 @@ def _test():
             print "Expect InvalidURL"
 
     for hp in ("[fe80::207:e9ff:fe9b]:8000", "www.python.org:80",
-               "www.python.org"):
+               "www.python.org", "[fe80::207:e9ff:fe9b]"):
         try:
             h = httplib.HTTP(hp)
         except httplib.InvalidURL: