Python 3.14+http.serverterm
http.server.ThreadingHTTPSServer
servers
An HTTPS server that handles each request in its own thread: HTTPSServer plus ThreadingMixIn. Added in Python 3.14.
Syntax
ThreadingHTTPSServer(server_address, Handler, bind_and_activate=True, *, certfile, keyfile=None, password=None, alpn_protocols=None)
It is what python -m http.server --tls-cert cert.pem --tls-key key.pem runs. As with ThreadingHTTPServer, the threads are daemonic and die at exit, and shared data needs a lock. The TLS handshake happens in the request thread, so a slow client does not hold up the others, unlike the single-threaded HTTPSServer.
Examples
import socketserver
from http.server import ThreadingHTTPSServer, HTTPSServer
print(issubclass(ThreadingHTTPSServer, HTTPSServer)) # → True
print(issubclass(ThreadingHTTPSServer, socketserver.ThreadingMixIn)) # → True
print(ThreadingHTTPSServer.daemon_threads) # → True
See also
Open in the full glossarydocs.python.orgReport an inaccuracy