[Python-checkins] cpython (3.4): use context's check_hostname attribute rather than the HTTPSHandler

benjamin.peterson python-checkins at python.org
Sun Dec 7 19:47:48 CET 2014


https://hg.python.org/cpython/rev/d5e15f5067c9
changeset:   93774:d5e15f5067c9
branch:      3.4
parent:      93771:a409a7cd908d
user:        Benjamin Peterson <benjamin at python.org>
date:        Sun Dec 07 13:46:02 2014 -0500
summary:
  use context's check_hostname attribute rather than the HTTPSHandler check_hostname parameter

files:
  Lib/urllib/request.py |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -146,10 +146,10 @@
             )
         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)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list