[Python-checkins] cpython: Use ssl.create_default_context in Lib/test/ssl_servers.py

antoine.pitrou python-checkins at python.org
Thu Apr 17 12:25:49 CEST 2014


http://hg.python.org/cpython/rev/42b2a51761b4
changeset:   90379:42b2a51761b4
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Thu Apr 17 12:21:36 2014 +0200
summary:
  Use ssl.create_default_context in Lib/test/ssl_servers.py

files:
  Lib/test/ssl_servers.py |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Lib/test/ssl_servers.py b/Lib/test/ssl_servers.py
--- a/Lib/test/ssl_servers.py
+++ b/Lib/test/ssl_servers.py
@@ -150,7 +150,7 @@
 def make_https_server(case, *, context=None, certfile=CERTFILE,
                       host=HOST, handler_class=None):
     if context is None:
-        context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+        context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
     # We assume the certfile contains both private key and certificate
     context.load_cert_chain(certfile)
     server = HTTPSServerThread(context, host, handler_class)
@@ -192,7 +192,7 @@
     else:
         handler_class = RootedHTTPRequestHandler
         handler_class.root = os.getcwd()
-    context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
+    context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
     context.load_cert_chain(CERTFILE)
     if args.curve_name:
         context.set_ecdh_curve(args.curve_name)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list