diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2010-11-14 03:31:52 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-11-14 03:31:52 (GMT) |
commit | 501bfd8f5c29cddc8f74c67e862f582929c16ed1 (patch) | |
tree | 441e5dab435fa45f58d599ffdcdede8175e5b2cf /Lib/httplib.py | |
parent | db4c334e0dfe62d4fbf189d53c95c1e90ef1a1ca (diff) | |
download | cpython-501bfd8f5c29cddc8f74c67e862f582929c16ed1.zip cpython-501bfd8f5c29cddc8f74c67e862f582929c16ed1.tar.gz cpython-501bfd8f5c29cddc8f74c67e862f582929c16ed1.tar.bz2 |
Merged revisions 86450 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86450 | senthil.kumaran | 2010-11-13 20:27:49 +0800 (Sat, 13 Nov 2010) | 3 lines
Fix Issue5111 - Wrap the Ipv6 host with [] in the Host header
........
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r-- | Lib/httplib.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index 526509c..e1ace4d 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -879,6 +879,9 @@ class HTTPConnection: host_enc = self.host.encode("ascii") except UnicodeEncodeError: host_enc = self.host.encode("idna") + # Wrap the IPv6 Host Header with [] (RFC 2732) + if host_enc.find(':') >= 0: + host_enc = "[" + host_enc + "]" if self.port == self.default_port: self.putheader('Host', host_enc) else: |