diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-22 18:19:07 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-22 18:19:07 (GMT) |
commit | d532321f7ba2e23e4110f05331fee8beca736826 (patch) | |
tree | 9383fb529fee0b92edc2a06e0435b7e8560cb1ec /Lib/http | |
parent | 4ebfdf01bb128005842be322fc89457d527ff000 (diff) | |
download | cpython-d532321f7ba2e23e4110f05331fee8beca736826.zip cpython-d532321f7ba2e23e4110f05331fee8beca736826.tar.gz cpython-d532321f7ba2e23e4110f05331fee8beca736826.tar.bz2 |
Issue #5639: Add a *server_hostname* argument to `SSLContext.wrap_socket`
in order to support the TLS SNI extension. `HTTPSConnection` and
`urlopen()` also use this argument, so that HTTPS virtual hosts are now
supported.
Diffstat (limited to 'Lib/http')
-rw-r--r-- | Lib/http/client.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py index 1039fa5..6c38c4a 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -1081,7 +1081,9 @@ else: self.sock = sock self._tunnel() - self.sock = self._context.wrap_socket(sock) + server_hostname = self.host if ssl.HAS_SNI else None + self.sock = self._context.wrap_socket(sock, + server_hostname=server_hostname) try: if self._check_hostname: ssl.match_hostname(self.sock.getpeercert(), self.host) |