From: Seth Michael Larson Date: Tue, 24 Sep 2019 15:02:46 +0000 (-0500) Subject: Add debug logging to SSLConfig (#378) X-Git-Tag: 0.7.4~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fa55bb6d4d5eeb4b56112ebb00974de0662644b;p=thirdparty%2Fhttpx.git Add debug logging to SSLConfig (#378) --- diff --git a/httpx/config.py b/httpx/config.py index b7c5ee64..f0f694fa 100644 --- a/httpx/config.py +++ b/httpx/config.py @@ -6,7 +6,7 @@ from pathlib import Path import certifi from .__version__ import __version__ -from .utils import get_ca_bundle_from_env +from .utils import get_ca_bundle_from_env, get_logger CertTypes = typing.Union[str, typing.Tuple[str, str], typing.Tuple[str, str, str]] VerifyTypes = typing.Union[str, bool, ssl.SSLContext] @@ -40,6 +40,9 @@ DEFAULT_CIPHERS = ":".join( ) +logger = get_logger(__name__) + + class SSLConfig: """ SSL Configuration. @@ -91,6 +94,14 @@ class SSLConfig: ) -> ssl.SSLContext: http_versions = HTTPVersionConfig() if http_versions is None else http_versions + logger.debug( + f"load_ssl_context " + f"verify={self.verify!r} " + f"cert={self.cert!r} " + f"trust_env={self.trust_env!r} " + f"http_versions={http_versions!r}" + ) + if self.ssl_context is None: self.ssl_context = ( self.load_ssl_context_verify(http_versions=http_versions) @@ -152,8 +163,10 @@ class SSLConfig: pass if ca_bundle_path.is_file(): + logger.debug(f"load_verify_locations cafile={ca_bundle_path!s}") context.load_verify_locations(cafile=str(ca_bundle_path)) elif ca_bundle_path.is_dir(): + logger.debug(f"load_verify_locations capath={ca_bundle_path!s}") context.load_verify_locations(capath=str(ca_bundle_path)) self._load_client_certs(context)