summaryrefslogtreecommitdiffstats
path: root/Lib/test/ssl_servers.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-02-05 20:20:51 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-02-05 20:20:51 (GMT)
commitda23259f992a5f962fa9f95acb6608c2ecada348 (patch)
tree83ad109c52a2392454666594c52e1bcd1d5a79d5 /Lib/test/ssl_servers.py
parentca4220be1ff291fed1b6d1da4ebcf3eab7f1a2ca (diff)
downloadcpython-da23259f992a5f962fa9f95acb6608c2ecada348.zip
cpython-da23259f992a5f962fa9f95acb6608c2ecada348.tar.gz
cpython-da23259f992a5f962fa9f95acb6608c2ecada348.tar.bz2
Issue #17107: Test client-side SNI support in urllib.request thanks to the new server-side SNI support in the ssl module.
Initial patch by Daniel Black.
Diffstat (limited to 'Lib/test/ssl_servers.py')
-rw-r--r--Lib/test/ssl_servers.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/ssl_servers.py b/Lib/test/ssl_servers.py
index f4a0bed..759b3f4 100644
--- a/Lib/test/ssl_servers.py
+++ b/Lib/test/ssl_servers.py
@@ -147,9 +147,11 @@ class HTTPSServerThread(threading.Thread):
self.server.shutdown()
-def make_https_server(case, certfile=CERTFILE, host=HOST, handler_class=None):
- # we assume the certfile contains both private key and certificate
- context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+def make_https_server(case, *, context=None, certfile=CERTFILE,
+ host=HOST, handler_class=None):
+ if context is None:
+ context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+ # We assume the certfile contains both private key and certificate
context.load_cert_chain(certfile)
server = HTTPSServerThread(context, host, handler_class)
flag = threading.Event()