diff -r 849826a900d2 Lib/http/client.py --- a/Lib/http/client.py Tue Oct 25 21:49:19 2016 -0500 +++ b/Lib/http/client.py Wed Oct 26 12:11:55 2016 -0700 @@ -884,8 +884,8 @@ host = host[:i] else: port = self.default_port - if host and host[0] == '[' and host[-1] == ']': - host = host[1:-1] + if host and host[0] == '[' and host[-1] == ']': + host = host[1:-1] return (host, port)