[Python-checkins] cpython (3.3): Issue #17483: 3.3 Branch - Remove unreachable code in urllib.request

senthil.kumaran python-checkins at python.org
Fri Apr 5 04:35:28 CEST 2013


http://hg.python.org/cpython/rev/fc39b8f0348d
changeset:   83102:fc39b8f0348d
branch:      3.3
parent:      83098:40f582a73901
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Thu Apr 04 19:34:02 2013 -0700
summary:
  Issue #17483: 3.3 Branch - Remove unreachable code in urllib.request

files:
  Lib/urllib/request.py |  14 +++++---------
  1 files changed, 5 insertions(+), 9 deletions(-)


diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -142,16 +142,12 @@
             raise ValueError('SSL support not available')
         context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
         context.options |= ssl.OP_NO_SSLv2
-        if cafile or capath or cadefault:
-            context.verify_mode = ssl.CERT_REQUIRED
-            if cafile or capath:
-                context.load_verify_locations(cafile, capath)
-            else:
-                context.set_default_verify_paths()
-            check_hostname = True
+        context.verify_mode = ssl.CERT_REQUIRED
+        if cafile or capath:
+            context.load_verify_locations(cafile, capath)
         else:
-            check_hostname = False
-        https_handler = HTTPSHandler(context=context, check_hostname=check_hostname)
+            context.set_default_verify_paths()
+        https_handler = HTTPSHandler(context=context, check_hostname=True)
         opener = build_opener(https_handler)
     elif _opener is None:
         _opener = opener = build_opener()

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


More information about the Python-checkins mailing list