summaryrefslogtreecommitdiffstats
path: root/Lib/smtplib.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-11-23 23:04:34 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-11-23 23:04:34 (GMT)
commit7243b574e5fc6f9ae68dc5ebd8252047b8e78e3b (patch)
tree4cd25f9fde37754132337eebdd1b1e958bf979f4 /Lib/smtplib.py
parent378e15d7abedb4a1990230d5e3c74d2390be96c4 (diff)
downloadcpython-7243b574e5fc6f9ae68dc5ebd8252047b8e78e3b.zip
cpython-7243b574e5fc6f9ae68dc5ebd8252047b8e78e3b.tar.gz
cpython-7243b574e5fc6f9ae68dc5ebd8252047b8e78e3b.tar.bz2
don't require OpenSSL SNI to pass hostname to ssl functions (#22921)
Patch by Donald Stufft.
Diffstat (limited to 'Lib/smtplib.py')
-rwxr-xr-xLib/smtplib.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index 09b4ea6..fa7f9e6 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -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")