File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,21 +99,12 @@ def connect(self):
9999
100100 cert_path = os .path .join (os .path .dirname (__file__ ), 'cacert.pem' )
101101
102- # for >= py3.7, mandatory since 3.12
103- if hasattr (ssl .SSLContext , 'wrap_socket' ):
104- context = ssl .SSLContext ()
105- context .verify_mode = ssl .CERT_REQUIRED
106- context .load_verify_locations (cert_path )
107- if hasattr (self , 'cert_file' ) and hasattr (self , 'key_file' ) and self .cert_file and self .key_file :
108- context .load_cert_chain (certfile = self .cert_file , keyfile = self .key_file )
109- self .sock = context .wrap_socket (sock )
110- else :
111- self .sock = ssl .wrap_socket (
112- sock ,
113- self .key_file ,
114- self .cert_file ,
115- cert_reqs = ssl .CERT_REQUIRED ,
116- ca_certs = cert_path )
102+ context = ssl .SSLContext ()
103+ context .verify_mode = ssl .CERT_REQUIRED
104+ context .load_verify_locations (cert_path )
105+ if hasattr (self , 'cert_file' ) and hasattr (self , 'key_file' ) and self .cert_file and self .key_file :
106+ context .load_cert_chain (certfile = self .cert_file , keyfile = self .key_file )
107+ self .sock = context .wrap_socket (sock )
117108
118109 try :
119110 match_hostname (self .sock .getpeercert (), self .host )
You can’t perform that action at this time.
0 commit comments