Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(21296)

Unified Diff: Lib/http/client.py

Issue 19689: ssl.create_default_context()
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/ftplib.py ('k') | Lib/imaplib.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/http/client.py Fri Nov 22 16:20:53 2013 +0100
+++ b/Lib/http/client.py Fri Nov 22 18:04:20 2013 +0100
@@ -1179,17 +1179,16 @@
self.key_file = key_file
self.cert_file = cert_file
if context is None:
- # Some reasonable defaults
- context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
- context.options |= ssl.OP_NO_SSLv2
+ context = ssl.create_default_context(certfile=cert_file,
+ keyfile=key_file)
+ elif key_file or cert_file:
+ context.load_cert_chain(cert_file, key_file)
will_verify = context.verify_mode != ssl.CERT_NONE
if check_hostname is None:
check_hostname = will_verify
elif check_hostname and not will_verify:
raise ValueError("check_hostname needs a SSL context with "
"either CERT_OPTIONAL or CERT_REQUIRED")
- if key_file or cert_file:
- context.load_cert_chain(cert_file, key_file)
self._context = context
self._check_hostname = check_hostname
« no previous file with comments | « Lib/ftplib.py ('k') | Lib/imaplib.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+