Commit 10e6e0e6 authored by Skip Montanaro's avatar Skip Montanaro

Search from the end of the host/port combination to find the colon which

separates ip address from the port to accommodate ipv6 addresses.
parent 065a32f5
......@@ -524,7 +524,7 @@ class HTTPConnection:
def _set_hostport(self, host, port):
if port is None:
i = host.find(':')
i = host.rfind(':')
if i >= 0:
try:
port = int(host[i+1:])
......
......@@ -118,6 +118,13 @@ def _test():
else:
print "Expect InvalidURL"
for hp in ("[fe80::207:e9ff:fe9b]:8000", "www.python.org:80",
"www.python.org"):
try:
h = httplib.HTTP(hp)
except httplib.InvalidURL:
print "InvalidURL raised erroneously"
# test response with multiple message headers with the same field name.
text = ('HTTP/1.1 200 OK\r\n'
'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment