Index: Lib/httplib.py =================================================================== --- Lib/httplib.py (revision 73751) +++ Lib/httplib.py (working copy) @@ -865,6 +865,10 @@ host_enc = self.host.encode("ascii") except UnicodeEncodeError: host_enc = self.host.encode("idna") + # As per RFC 2732, IPv6 address should be wrapped + # with [] to use as Host header + if host_enc.find(':') >= 0: + host_enc = "[" + host_enc + "]" if self.port == self.default_port: self.putheader('Host', host_enc) else: