]> granicus.if.org Git - python/commitdiff
use context's check_hostname attribute rather than the HTTPSHandler check_hostname...
authorBenjamin Peterson <benjamin@python.org>
Sun, 7 Dec 2014 18:46:02 +0000 (13:46 -0500)
committerBenjamin Peterson <benjamin@python.org>
Sun, 7 Dec 2014 18:46:02 +0000 (13:46 -0500)
Lib/urllib/request.py

index e0c8116373299819dc4cc10e0f9bbd3a5c4ef35a..6da9007ac80ee4c587bb5882beb65deb44e0bfe3 100644 (file)
@@ -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)