mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Implement IDNA (Internationalized Domain Names in Applications).
This commit is contained in:
parent
8d17a90b83
commit
2548c730c1
12 changed files with 1671 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue