aboutsummaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-12-07 13:46:02 -0500
committerBenjamin Peterson <benjamin@python.org>2014-12-07 13:46:02 -0500
commitb666697fa8e815ca09ace0cd6d4cd2bd76080f5e (patch)
treebbe89155a2392f7cc71c5ac22bb010b136b69d7e /Lib
parentHTTPSConnection: prefer the context's check_hostname attribute over the const... (diff)
downloadcpython-b666697fa8e815ca09ace0cd6d4cd2bd76080f5e.tar.gz
cpython-b666697fa8e815ca09ace0cd6d4cd2bd76080f5e.tar.bz2
cpython-b666697fa8e815ca09ace0cd6d4cd2bd76080f5e.zip
use context's check_hostname attribute rather than the HTTPSHandler check_hostname parameter
Diffstat (limited to 'Lib')
-rw-r--r--Lib/urllib/request.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index e0c81163732..6da9007ac80 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -146,10 +146,10 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
)
if not _have_ssl:
raise ValueError('SSL support not available')
- context = ssl._create_stdlib_context(cert_reqs=ssl.CERT_REQUIRED,
+ context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH,
cafile=cafile,
capath=capath)
- https_handler = HTTPSHandler(context=context, check_hostname=True)
+ https_handler = HTTPSHandler(context=context)
opener = build_opener(https_handler)
elif context:
https_handler = HTTPSHandler(context=context)