diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-02-05 20:20:51 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-02-05 20:20:51 (GMT) |
commit | da23259f992a5f962fa9f95acb6608c2ecada348 (patch) | |
tree | 83ad109c52a2392454666594c52e1bcd1d5a79d5 /Lib/test/ssl_servers.py | |
parent | ca4220be1ff291fed1b6d1da4ebcf3eab7f1a2ca (diff) | |
download | cpython-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.py | 8 |
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() |