Created
March 9, 2024 23:14
-
-
Save alecandido/d60b559c71a9f7bb1709d16110f71a59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.server | |
import ssl | |
import socket | |
class HTTPServerV6(http.server.HTTPServer): | |
address_family = socket.AF_INET6 | |
httpd = HTTPServerV6(("::", 443), http.server.SimpleHTTPRequestHandler) | |
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) | |
context.load_cert_chain(certfile="cert.pem", keyfile="key.pem") | |
httpd.socket = context.wrap_socket(httpd.socket, server_side=True) | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A simple HTTPS server supporting IPv6 on arbitrary address.
Working with Python 3.11 (avoiding deprecated features).