Skip to content

Commit

Permalink
build/tests: for python test http server use SSLContext.wrap_socket()…
Browse files Browse the repository at this point in the history
… instead of deprecated ssl.wrap_socket() (#8169)
  • Loading branch information
sharvilshah committed Oct 20, 2023
1 parent c50451c commit 59b08a6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tools/tests/test_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,10 @@ def run_http_server(bind_port=80, **kwargs):

httpd = HTTPServer(('localhost', bind_port), RealSimpleHandler)
if ARGS['tls']:
httpd.socket = ssl.wrap_socket(
httpd.socket,
ca_certs=ARGS['ca'],
ssl_version=ssl.PROTOCOL_SSLv23,
certfile=ARGS['cert'],
keyfile=ARGS['key'],
server_side=True)
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.load_cert_chain(certfile=ARGS['cert'], keyfile=ARGS['key'])
context.load_verify_locations(ARGS['ca'])
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)
debug("Starting TLS/HTTPS server on TCP port: %d" % bind_port)
else:
debug("Starting HTTP server on TCP port: %d" % bind_port)
Expand Down

0 comments on commit 59b08a6

Please sign in to comment.