From eee7387dde1ff876f8fdbdb0fa25a25d973551df Mon Sep 17 00:00:00 2001 From: Jon Walker Date: Wed, 2 Oct 2024 10:54:52 -0400 Subject: [PATCH] fix: do not set assert_hostname=True (#201) --- src/sasctl/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sasctl/core.py b/src/sasctl/core.py index 50cf4cd3..8b2ea4ad 100644 --- a/src/sasctl/core.py +++ b/src/sasctl/core.py @@ -327,7 +327,9 @@ def __init__( def is_ipaddress(hst): return re.match(r"^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$", hst) - verify_hostname = not is_ipaddress(hostname) + # Do not verify hostname if IP address is used. Otherwise, will + # verify that cert hostname matches the hostname used in the URL. + verify_hostname = False if is_ipaddress(hostname) else None adapter = SSLContextAdapter(assert_hostname=verify_hostname) self.mount("https://", adapter)