mirror of
https://github.com/python/cpython.git
synced 2025-07-12 05:45:15 +00:00
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.
This commit is contained in:
parent
4ebfdf01bb
commit
d532321f7b
9 changed files with 137 additions and 14 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue