summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-04-01 16:55:35 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-04-01 16:55:35 (GMT)
commit9a8d6934df77a6c45bd8d39e4919b93ba45e195d (patch)
tree117251effa8dc8f74a4bbc2f50f375759e6b8f4f /Lib/urllib
parent7d197de987ff97de90a855c933de0e1ed8deb4fb (diff)
downloadcpython-9a8d6934df77a6c45bd8d39e4919b93ba45e195d.zip
cpython-9a8d6934df77a6c45bd8d39e4919b93ba45e195d.tar.gz
cpython-9a8d6934df77a6c45bd8d39e4919b93ba45e195d.tar.bz2
Issue #17483: remove unreachable code in urlopen().
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/request.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 8b3cdf9..5c87591 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -143,16 +143,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()