Backend · 2026

PyHTTP

HTTP/1.1 server from raw sockets in Python with a select() event loop

Complete · source available

Overview

About 600 lines, one concept per file. Handlers are pure Request to Response functions; trade-offs listed in the README include no keep-alive, TLS or chunked encoding.

Highlights

  • 72 tests: 22 request-parser, 26 router/response/static and 24 integration tests against a live server.
  • Three real bugs documented with fixes, including a malformed request that crashed the event loop.
  • Directory traversal blocked with Path.resolve() and a root-prefix check.