Skip to content

Commit

Permalink
ssl: Implement SSLSession support.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniël van de Giessen <[email protected]>
  • Loading branch information
DvdGiessen committed Mar 19, 2024
1 parent 661efa4 commit 7e9b2c4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python-stdlib/ssl/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
MBEDTLS_VERSION,
PROTOCOL_TLS_CLIENT,
PROTOCOL_TLS_SERVER,
SSLSession,
)


Expand Down Expand Up @@ -38,13 +39,14 @@ def load_verify_locations(self, cafile=None, cadata=None):
self._context.load_verify_locations(cadata)

def wrap_socket(
self, sock, server_side=False, do_handshake_on_connect=True, server_hostname=None
self, sock, server_side=False, do_handshake_on_connect=True, server_hostname=None, session=None,
):
return self._context.wrap_socket(
sock,
server_side=server_side,
do_handshake_on_connect=do_handshake_on_connect,
server_hostname=server_hostname,
session=session,
)


Expand All @@ -57,6 +59,7 @@ def wrap_socket(
cadata=None,
server_hostname=None,
do_handshake=True,
session=None,
):
con = SSLContext(PROTOCOL_TLS_SERVER if server_side else PROTOCOL_TLS_CLIENT)
if cert or key:
Expand All @@ -69,4 +72,5 @@ def wrap_socket(
server_side=server_side,
do_handshake_on_connect=do_handshake,
server_hostname=server_hostname,
session=session,
)

0 comments on commit 7e9b2c4

Please sign in to comment.