]> granicus.if.org Git - python/commitdiff
Issue #17483: 3.3 Branch - Remove unreachable code in urllib.request
authorSenthil Kumaran <senthil@uthcode.com>
Fri, 5 Apr 2013 02:34:02 +0000 (19:34 -0700)
committerSenthil Kumaran <senthil@uthcode.com>
Fri, 5 Apr 2013 02:34:02 +0000 (19:34 -0700)
Lib/urllib/request.py

index e6f877d56ee9181bd08a407df252cfbf65430df6..b2a77ebf2fbdb64ebadae7b3edd9077dff1f8782 100644 (file)
@@ -142,16 +142,12 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
             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()