missed the obvious test case and corresponding fix

This commit is contained in:
Skip Montanaro 2004-09-14 17:55:21 +00:00
parent 1fd00a1b71
commit cae14d2714
2 changed files with 3 additions and 2 deletions

View 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:

View 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: