Include host in TLS setup
This enabled SNI, and allows it to check the certificate for the correct host.
This commit is contained in:
parent
f632fa0285
commit
b6c02b13e3
|
|
@ -140,7 +140,8 @@ class WebSocket(object):
|
|||
|
||||
if uri.scheme in ("wss", "https"):
|
||||
context = ssl.create_default_context()
|
||||
self.socket = context.wrap_socket(self.socket)
|
||||
self.socket = context.wrap_socket(self.socket,
|
||||
server_hostname=uri.hostname)
|
||||
self._state = "ssl_handshake"
|
||||
else:
|
||||
self._state = "headers"
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ class WebSockifyServer():
|
|||
sock.connect(addrs[0][4])
|
||||
if use_ssl:
|
||||
context = ssl.create_default_context()
|
||||
sock = context.wrap_socket(sock)
|
||||
sock = context.wrap_socket(sock, server_hostname=host)
|
||||
else:
|
||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
sock.bind(addrs[0][4])
|
||||
|
|
|
|||
Loading…
Reference in New Issue