mirror of
https://github.com/python/cpython.git
synced 2025-08-11 12:29:34 +00:00
Fixes #10860: Handle empty port after port delimiter in httplib
Thanks, Shawn Ligocki! 3.x version will come as a separate patch.
This commit is contained in:
parent
086f927f25
commit
7a15390f83
3 changed files with 31 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue