don't require OpenSSL SNI to pass hostname to ssl functions (#22921)

Patch by Donald Stufft.
This commit is contained in:
Benjamin Peterson 2014-11-23 17:04:34 -06:00
parent 378e15d7ab
commit 7243b574e5
16 changed files with 22 additions and 67 deletions

View file

@ -745,9 +745,8 @@ class IMAP4:
ssl_context = ssl._create_stdlib_context()
typ, dat = self._simple_command(name)
if typ == 'OK':
server_hostname = self.host if ssl.HAS_SNI else None
self.sock = ssl_context.wrap_socket(self.sock,
server_hostname=server_hostname)
server_hostname=self.host)
self.file = self.sock.makefile('rb')
self._tls_established = True
self._get_capabilities()
@ -1223,9 +1222,8 @@ if HAVE_SSL:
def _create_socket(self):
sock = IMAP4._create_socket(self)
server_hostname = self.host if ssl.HAS_SNI else None
return self.ssl_context.wrap_socket(sock,
server_hostname=server_hostname)
server_hostname=self.host)
def open(self, host='', port=IMAP4_SSL_PORT):
"""Setup connection to remote server on "host:port".