Implement IDNA (Internationalized Domain Names in Applications).

This commit is contained in:
Martin v. Löwis 2003-04-18 10:39:54 +00:00
parent 8d17a90b83
commit 2548c730c1
12 changed files with 1671 additions and 9 deletions

View file

@ -655,11 +655,11 @@ class HTTPConnection:
nil, netloc, nil, nil, nil = urlsplit(url)
if netloc:
self.putheader('Host', netloc)
self.putheader('Host', netloc.encode("idna"))
elif self.port == HTTP_PORT:
self.putheader('Host', self.host)
self.putheader('Host', self.host.encode("idna"))
else:
self.putheader('Host', "%s:%s" % (self.host, self.port))
self.putheader('Host', "%s:%s" % (self.host.encode("idna"), self.port))
# note: we are assuming that clients will not attempt to set these
# headers since *this* library must deal with the