File tree 1 file changed +1
-13
lines changed
1 file changed +1
-13
lines changed Original file line number Diff line number Diff line change 1
- # Copyright (c) 2015 , Menno Smits
1
+ # Copyright (c) 2023 , Menno Smits
2
2
# Released subject to the New BSD License
3
3
# Please see http://en.wikipedia.org/wiki/BSD_licenses
4
4
20
20
def wrap_socket (
21
21
sock : socket .socket , ssl_context : Optional [ssl .SSLContext ], host : str
22
22
) -> socket .socket :
23
- if not hasattr (ssl , "create_default_context" ):
24
- # Python 2.7.0 - 2.7.8 do not have the concept of ssl contexts.
25
- # Thus we have to use the less flexible and legacy way of wrapping the
26
- # socket
27
- if ssl_context is not None :
28
- raise RuntimeError (
29
- "Cannot precisely configure the SSL connection, upgrade to "
30
- "Python >= 2.7.9 to fine tune the settings."
31
- )
32
-
33
- return ssl .wrap_socket (sock )
34
-
35
23
if ssl_context is None :
36
24
ssl_context = ssl .create_default_context (purpose = ssl .Purpose .SERVER_AUTH )
37
25
You can’t perform that action at this time.
0 commit comments