Skip to content

Commit 74e42df

Browse files
authored
Merge pull request mjs#254 from mlorant/master
provide default ssl_context, if not given explicitly [rebased]
2 parents 99d6a70 + 1503e95 commit 74e42df

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

imapclient/tls.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ def create_default_context(cafile=None, capath=None, cadata=None):
3030
capath=capath,
3131
cadata=cadata)
3232

33-
wrap_socket = lambda sock, context, host: \
34-
context.wrap_socket(sock, server_hostname = host)
33+
def wrap_socket(sock, ssl_context, host):
34+
if ssl_context is None:
35+
ssl_context = create_default_context()
36+
return ssl_context.wrap_socket(sock, server_hostname = host)
3537

3638
else:
3739
# Explicitly check that the required pyOpenSSL is installed. On some

0 commit comments

Comments
 (0)