summaryrefslogtreecommitdiff
path: root/Lib/http
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-12-07 13:18:25 -0500
committerBenjamin Peterson <benjamin@python.org>2014-12-07 13:18:25 -0500
commit33ddfca80b6d9db38222f87511b6e5699cc10870 (patch)
treeb971bbcb44131c190728a9c8a57ed29fb0de5b81 /Lib/http
parent56a97a93bddb879711a239b8f174bba951b55fe4 (diff)
downloadcpython-33ddfca80b6d9db38222f87511b6e5699cc10870.tar.gz
HTTPSConnection: prefer the context's check_hostname attribute over the constructor parameter (#22959)
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/client.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py
index 281e7f2880..c0760ddeb6 100644
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -1210,8 +1210,8 @@ else:
context = ssl._create_default_https_context()
will_verify = context.verify_mode != ssl.CERT_NONE
if check_hostname is None:
- check_hostname = will_verify
- elif check_hostname and not will_verify:
+ check_hostname = context.check_hostname
+ if check_hostname and not will_verify:
raise ValueError("check_hostname needs a SSL context with "
"either CERT_OPTIONAL or CERT_REQUIRED")
if key_file or cert_file: