Merged fix for #10860 from 3.2

This commit is contained in:
Łukasz Langa 2011-10-19 02:04:46 +02:00
commit 6c4e1aed4b
2 changed files with 26 additions and 3 deletions

View file

@ -678,7 +678,10 @@ class HTTPConnection:
try:
port = int(host[i+1:])
except ValueError:
raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
if host[i+1:] == "": # http://foo.com:/ == http://foo.com/
port = self.default_port
else:
raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
host = host[:i]
else:
port = self.default_port