@@ -83,16 +83,20 @@ def _urllib3_request_context(
83
83
request : "PreparedRequest" ,
84
84
verify : "bool | str | None" ,
85
85
client_cert : "typing.Tuple[str, str] | str | None" ,
86
+ poolmanager : "PoolManager" ,
86
87
) -> "(typing.Dict[str, typing.Any], typing.Dict[str, typing.Any])" :
87
88
host_params = {}
88
89
pool_kwargs = {}
89
90
parsed_request_url = urlparse (request .url )
90
91
scheme = parsed_request_url .scheme .lower ()
91
92
port = parsed_request_url .port
93
+ poolmanager_kwargs = getattr (poolmanager , "connection_pool_kw" , {})
94
+ has_poolmanager_ssl_context = poolmanager_kwargs .get ("ssl_context" )
95
+
92
96
cert_reqs = "CERT_REQUIRED"
93
97
if verify is False :
94
98
cert_reqs = "CERT_NONE"
95
- elif verify is True :
99
+ elif verify is True and not has_poolmanager_ssl_context :
96
100
pool_kwargs ["ssl_context" ] = _preloaded_ssl_context
97
101
elif isinstance (verify , str ):
98
102
if not os .path .isdir (verify ):
@@ -423,7 +427,7 @@ def build_connection_pool_key_attributes(self, request, verify, cert=None):
423
427
portion of the Pool Key including scheme, hostname, and port. The
424
428
second is a dictionary of SSLContext related parameters.
425
429
"""
426
- return _urllib3_request_context (request , verify , cert )
430
+ return _urllib3_request_context (request , verify , cert , self . poolmanager )
427
431
428
432
def get_connection_with_tls_context (self , request , verify , proxies = None , cert = None ):
429
433
"""Returns a urllib3 connection for the given request and TLS settings.
0 commit comments