Commit 71a5c481 authored by Senthil Kumaran's avatar Senthil Kumaran

Issue #17483: 3.3 Branch - Remove unreachable code in urllib.request

parent 8f1bb5ea
...@@ -142,16 +142,12 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, ...@@ -142,16 +142,12 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
raise ValueError('SSL support not available') raise ValueError('SSL support not available')
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.options |= ssl.OP_NO_SSLv2 context.options |= ssl.OP_NO_SSLv2
if cafile or capath or cadefault:
context.verify_mode = ssl.CERT_REQUIRED context.verify_mode = ssl.CERT_REQUIRED
if cafile or capath: if cafile or capath:
context.load_verify_locations(cafile, capath) context.load_verify_locations(cafile, capath)
else: else:
context.set_default_verify_paths() context.set_default_verify_paths()
check_hostname = True https_handler = HTTPSHandler(context=context, check_hostname=True)
else:
check_hostname = False
https_handler = HTTPSHandler(context=context, check_hostname=check_hostname)
opener = build_opener(https_handler) opener = build_opener(https_handler)
elif _opener is None: elif _opener is None:
_opener = opener = build_opener() _opener = opener = build_opener()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment