diff options
author | Łukasz Langa <lukasz@langa.pl> | 2011-10-18 17:16:00 +0200 |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2011-10-18 17:16:00 +0200 |
commit | 7a15390f83c57283b44163c33bb4a80fd453526b (patch) | |
tree | 886352b96b8aa3e797b97a16985c75696aeb2078 /Lib/httplib.py | |
parent | 086f927f25be79ea65679faca485bda06e21ac3b (diff) | |
download | cpython-git-7a15390f83c57283b44163c33bb4a80fd453526b.tar.gz |
Fixes #10860: Handle empty port after port delimiter in httplib
Thanks, Shawn Ligocki!
3.x version will come as a separate patch.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r-- | Lib/httplib.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index 9853285a2a..19bcd1b41b 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -715,7 +715,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 |