mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
don't require OpenSSL SNI to pass hostname to ssl functions (#22921)
Patch by Donald Stufft.
This commit is contained in:
parent
378e15d7ab
commit
7243b574e5
16 changed files with 22 additions and 67 deletions
|
|
@ -684,9 +684,8 @@ class SMTP:
|
|||
if context is None:
|
||||
context = ssl._create_stdlib_context(certfile=certfile,
|
||||
keyfile=keyfile)
|
||||
server_hostname = self._host if ssl.HAS_SNI else None
|
||||
self.sock = context.wrap_socket(self.sock,
|
||||
server_hostname=server_hostname)
|
||||
server_hostname=self._host)
|
||||
self.file = None
|
||||
# RFC 3207:
|
||||
# The client MUST discard any knowledge obtained from
|
||||
|
|
@ -915,9 +914,8 @@ if _have_ssl:
|
|||
print('connect:', (host, port), file=stderr)
|
||||
new_socket = socket.create_connection((host, port), timeout,
|
||||
self.source_address)
|
||||
server_hostname = self._host if ssl.HAS_SNI else None
|
||||
new_socket = self.context.wrap_socket(new_socket,
|
||||
server_hostname=server_hostname)
|
||||
server_hostname=self._host)
|
||||
return new_socket
|
||||
|
||||
__all__.append("SMTP_SSL")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue