@@ -81,30 +81,23 @@ class VerifiedHTTPSConnection(HTTPSConnection):
8181
8282** * REMOVED ** * * * * REMOVED ** * def connect (self ):
8383** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * self .connection_kwargs = {}
84- ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * # for > py2.5
85- * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * if hasattr (self , 'timeout' ):
86- ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * self .connection_kwargs .update (timeout = self .timeout )
87-
88- ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * # for >= py2.7
89- * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * if hasattr (self , 'source_address' ):
90- ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * self .connection_kwargs .update (source_address = self .source_address )
84+ ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * self .connection_kwargs .update (timeout = self .timeout )
85+ ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * self .connection_kwargs .update (source_address = self .source_address )
9186
9287** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * sock = socket .create_connection (
9388** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * (self .host , self .port ), ** self .connection_kwargs )
9489
95- ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * # for >= py2.7
96- * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * if getattr (self , '_tunnel_host' , None ):
97- ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * self .sock = sock
90+ ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * if self ._tunnel_host :
9891** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * self ._tunnel ()
9992
10093** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * cert_path = os .path .join (os .path .dirname (__file__ ), 'cacert.pem' )
10194
102- ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * context = ssl .SSLContext ()
95+ ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * context = ssl .SSLContext (protocol = ssl . PROTOCOL_TLS_CLIENT )
10396** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * context .verify_mode = ssl .CERT_REQUIRED
10497** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * context .load_verify_locations (cert_path )
10598** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * if hasattr (self , 'cert_file' ) and hasattr (self , 'key_file' ) and self .cert_file and self .key_file :
10699** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * context .load_cert_chain (certfile = self .cert_file , keyfile = self .key_file )
107- ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * self .sock = context .wrap_socket (sock )
100+ ** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * self .sock = context .wrap_socket (sock , server_hostname = self . host )
108101
109102** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * try :
110103** * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * * * * REMOVED ** * match_hostname (self .sock .getpeercert (), self .host )
0 commit comments