Set Handler.timeout = 30. Python's BaseHTTPRequestHandler.setup() calls self.request.settimeout(timeout), which raises socket.timeout on idle or slow connections after the configured duration. This defends against Slowloris-style attacks where a client holds connections open indefinitely, exhausting threads in ThreadingHTTPServer. Also recovers threads from crashed clients with hung TCP connections. Addresses #194.
3.9 KiB
3.9 KiB