diff options
author | Łukasz Langa <lukasz@langa.pl> | 2011-10-18 19:17:39 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2011-10-18 19:17:39 (GMT) |
commit | a5a9a9c3696af0a4a0df74618e63a4d47a62e00f (patch) | |
tree | 60ac753332086566983891dc30d3caaa04668928 /Lib/http | |
parent | 551ba20e8ea9a4a97cf63f28b47175e084eb63cd (diff) | |
download | cpython-a5a9a9c3696af0a4a0df74618e63a4d47a62e00f.zip cpython-a5a9a9c3696af0a4a0df74618e63a4d47a62e00f.tar.gz cpython-a5a9a9c3696af0a4a0df74618e63a4d47a62e00f.tar.bz2 |
Fixes #10860: Handle empty port after port delimiter in httplib
Diffstat (limited to 'Lib/http')
-rw-r--r-- | Lib/http/client.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py index 8400914..745b999 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -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 |