Skip to content

Commit

Permalink
uasyncio: open_connection: Implement server_hostname param for SSL.
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
  • Loading branch information
pfalcon committed Oct 26, 2020
1 parent 3f0cb77 commit cf87ad9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions uasyncio/uasyncio/__init__.py
Expand Up @@ -206,7 +206,7 @@ def __repr__(self):
StreamReader = StreamWriter = const(Stream)


def open_connection(host, port, ssl=False):
def open_connection(host, port, ssl=False, server_hostname=None):
if DEBUG and __debug__:
log.debug("open_connection(%s, %s)", host, port)
ai = _socket.getaddrinfo(host, port, 0, _socket.SOCK_STREAM)
Expand All @@ -229,7 +229,7 @@ def open_connection(host, port, ssl=False):
if ssl is True:
import ussl
ssl = ussl.SSLContext()
s2 = ssl.wrap_socket(s, do_handshake=False)
s2 = ssl.wrap_socket(s, server_hostname=server_hostname, do_handshake=False)
s2.setblocking(False)
return StreamReader(s, s2), StreamWriter(s, s2)

Expand Down

0 comments on commit cf87ad9

Please sign in to comment.