summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 2f117d8..b7276af 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -525,7 +525,8 @@ class HTTPConnection:
def _set_hostport(self, host, port):
if port is None:
i = host.rfind(':')
- if i >= 0:
+ j = host.rfind(']') # ipv6 addresses have [...]
+ if i > j:
try:
port = int(host[i+1:])
except ValueError: