diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2013-04-05 02:34:02 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2013-04-05 02:34:02 (GMT) |
commit | 4a2ab120f327f20ef320586831f50e4896dd44ef (patch) | |
tree | 37cc8c58a7581798cd84fccac72050496334f425 | |
parent | 09f0ddec2138e2c78ceca98adff74ddcea597fb9 (diff) | |
download | cpython-4a2ab120f327f20ef320586831f50e4896dd44ef.zip cpython-4a2ab120f327f20ef320586831f50e4896dd44ef.tar.gz cpython-4a2ab120f327f20ef320586831f50e4896dd44ef.tar.bz2 |
Issue #17483: 3.3 Branch - Remove unreachable code in urllib.request
-rw-r--r-- | Lib/urllib/request.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index e6f877d..b2a77eb 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -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() |