From: Skip Montanaro Date: Tue, 14 Sep 2004 17:55:21 +0000 (+0000) Subject: missed the obvious test case and corresponding fix X-Git-Tag: v2.4b1~261 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cae14d2714f363445d8ac0d631dc102b0ef292a9;p=thirdparty%2FPython%2Fcpython.git missed the obvious test case and corresponding fix --- diff --git a/Lib/httplib.py b/Lib/httplib.py index 2f117d8d5d54..b7276af357f9 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -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: diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index b49f71d2e33c..046f4f871a40 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -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: