File tree Expand file tree Collapse file tree 1 file changed +1
-13
lines changed Expand file tree Collapse file tree 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
22# Released subject to the New BSD License
33# Please see http://en.wikipedia.org/wiki/BSD_licenses
44
2020def wrap_socket (
2121 sock : socket .socket , ssl_context : Optional [ssl .SSLContext ], host : str
2222) -> 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-
3523 if ssl_context is None :
3624 ssl_context = ssl .create_default_context (purpose = ssl .Purpose .SERVER_AUTH )
3725
You can’t perform that action at this time.
0 commit comments