Skip to content

Commit f9ca027

Browse files
dkirov-ddiliakur
andauthored
Apply suggestions from code review
Co-authored-by: Ilia Kurenkov <ilia.kurenkov@datadoghq.com>
1 parent 093eaf3 commit f9ca027

File tree

1 file changed

+2
-6
lines changed
  • datadog_checks_base/datadog_checks/base/utils

1 file changed

+2
-6
lines changed

datadog_checks_base/datadog_checks/base/utils/http.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ def __init__(self, instance, init_config, remapper=None, logger=None, session=No
400400
if config['kerberos_cache']:
401401
self.request_hooks.append(lambda: handle_kerberos_cache(config['kerberos_cache']))
402402

403-
# Create TLS context for consistent TLS configuration
404403
self.tls_config = {key: value for key, value in config.items() if key.startswith('tls_')}
405404
self._https_adapters = {}
406405

@@ -603,10 +602,8 @@ def __del__(self): # no cov
603602
def _mount_https_adapter(self, session, tls_config):
604603
# Reuse existing adapter if it matches the TLS config
605604
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])
610607
return
611608

612609
context = create_ssl_context(tls_config)
@@ -628,7 +625,6 @@ def init_poolmanager(self, connections, maxsize, block=False, **pool_kwargs):
628625

629626
https_adapter = SSLContextHostHeaderAdapter(context)
630627
else:
631-
# Use SSLContextHTTPSAdapter for consistent TLS configuration
632628
https_adapter = SSLContextAdapter(context)
633629

634630
# Cache the adapter for reuse

0 commit comments

Comments
 (0)