From 96939642944fc299350bb60712cf200581f442df Mon Sep 17 00:00:00 2001 From: Ilia Kurenkov Date: Fri, 30 Aug 2024 18:32:04 +0200 Subject: [PATCH] Switch away from deprecated ssl API (#18472) --- spark/tests/test_spark.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spark/tests/test_spark.py b/spark/tests/test_spark.py index 6a057f7460e14..d9dab0e246274 100644 --- a/spark/tests/test_spark.py +++ b/spark/tests/test_spark.py @@ -1306,9 +1306,11 @@ def do_GET(self): def run_ssl_server(): cert_file = os.path.join(CERTIFICATE_DIR, 'server.pem') + context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + context.load_cert_chain(cert_file) httpd = BaseHTTPServer.HTTPServer((SSL_SERVER_ADDRESS, SSL_SERVER_PORT), StandaloneAppsResponseHandler) - httpd.socket = ssl.wrap_socket(httpd.socket, certfile=cert_file, server_side=False) + httpd.socket = context.wrap_socket(httpd.socket, server_side=False) httpd.timeout = 5 threading.Thread(target=httpd.handle_request).start()