summaryrefslogtreecommitdiffstats
path: root/Lib/http/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/http/client.py')
-rw-r--r--Lib/http/client.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py
index a490e2b..88da550 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