Skip to content

Instantly share code, notes, and snippets.

@nszceta
Created April 27, 2025 20:55
Show Gist options
  • Save nszceta/3f918edef30f9792bfdbdbc18ac91f0a to your computer and use it in GitHub Desktop.
Save nszceta/3f918edef30f9792bfdbdbc18ac91f0a to your computer and use it in GitHub Desktop.
ssl_server_test.py
# test_server.py
from http.server import HTTPServer, SimpleHTTPRequestHandler
import ssl
server_address = ('localhost', 4443)
httpd = HTTPServer(server_address, SimpleHTTPRequestHandler)
# Configure SSL
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(certfile='server.crt', keyfile='server.key')
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)
print(f"Server running on https://{server_address[0]}:{server_address[1]}")
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment