summaryrefslogtreecommitdiffstats
path: root/Lib/ssl.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-11-03 19:29:33 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-11-03 19:29:33 (GMT)
commit4ffb0752710f0c0720d4f2af0c4b7ce1ebb9d2bd (patch)
tree5082a5a3f18e25c9f0c7ede2717f7170e11b722f /Lib/ssl.py
parent8cf7c1cff0f1176387118826fffdf1c517405f3a (diff)
downloadcpython-4ffb0752710f0c0720d4f2af0c4b7ce1ebb9d2bd.zip
cpython-4ffb0752710f0c0720d4f2af0c4b7ce1ebb9d2bd.tar.gz
cpython-4ffb0752710f0c0720d4f2af0c4b7ce1ebb9d2bd.tar.bz2
PEP 476: enable HTTPS certificate verification by default (#22417)
Patch by Alex Gaynor with some modifications by me.
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r--Lib/ssl.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index e2636ef..b6e6f16 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -441,8 +441,7 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None,
context.load_default_certs(purpose)
return context
-
-def _create_stdlib_context(protocol=PROTOCOL_SSLv23, *, cert_reqs=None,
+def _create_unverified_context(protocol=PROTOCOL_SSLv23, *, cert_reqs=None,
check_hostname=False, purpose=Purpose.SERVER_AUTH,
certfile=None, keyfile=None,
cafile=None, capath=None, cadata=None):
@@ -480,6 +479,14 @@ def _create_stdlib_context(protocol=PROTOCOL_SSLv23, *, cert_reqs=None,
return context
+# Used by http.client if no context is explicitly passed.
+_create_default_https_context = create_default_context
+
+
+# Backwards compatibility alias, even though it's not a public name.
+_create_stdlib_context = _create_unverified_context
+
+
class SSLSocket(socket):
"""This class implements a subtype of socket.socket that wraps
the underlying OS socket in an SSL context when necessary, and