@@ -400,7 +400,6 @@ def __init__(self, instance, init_config, remapper=None, logger=None, session=No
400
400
if config ['kerberos_cache' ]:
401
401
self .request_hooks .append (lambda : handle_kerberos_cache (config ['kerberos_cache' ]))
402
402
403
- # Create TLS context for consistent TLS configuration
404
403
self .tls_config = {key : value for key , value in config .items () if key .startswith ('tls_' )}
405
404
self ._https_adapters = {}
406
405
@@ -603,10 +602,8 @@ def __del__(self): # no cov
603
602
def _mount_https_adapter (self , session , tls_config ):
604
603
# Reuse existing adapter if it matches the TLS config
605
604
tls_config_key = TlsConfig (** tls_config )
606
- https_adapter = self ._https_adapters .get (tls_config_key )
607
-
608
- if https_adapter is not None :
609
- session .mount ('https://' , https_adapter )
605
+ if tls_config_key in self ._https_adapters :
606
+ session .mount ('https://' , self ._https_adapters [tls_config_key ])
610
607
return
611
608
612
609
context = create_ssl_context (tls_config )
@@ -628,7 +625,6 @@ def init_poolmanager(self, connections, maxsize, block=False, **pool_kwargs):
628
625
629
626
https_adapter = SSLContextHostHeaderAdapter (context )
630
627
else :
631
- # Use SSLContextHTTPSAdapter for consistent TLS configuration
632
628
https_adapter = SSLContextAdapter (context )
633
629
634
630
# Cache the adapter for reuse
0 commit comments