How kludex/zttp works
zttp is a sans-IO HTTP parser for Python backed by a Zig engine. An integrator supplies bytes (or HTTP/3 datagrams), pulls parsed events, and requests serialized output; zttp does not own sockets or perform I/O. The Python API exposes the native connection and event types, while protocol engines handle HTTP/1.1, HTTP/2, and HTTP/3; HTTP/3 also depends on the QUIC transport. The QUIC endpoint routes datagrams to HTTP/3 connections. Several core implementation files were not excerpted, so their internal call relationships are omitted; documented relationships use the README as evidence.
Main entry points: connection_obj.zig Native Connection · h3 HTTP/3 Engine · __init__.py Public API · endpoint.py QUIC Endpoint
Components 15
Python API
- Public API
zttp/__init__.py - QUIC Endpoint
zttp/endpoint.py - Address Tokens
zttp/_tokens.py - TLS and QUIC Config
zttp/config.py - Native Connection
src/python/connection_obj.zig - Python Extension
src/python/module.zig
HTTP Engines
- HTTP/1.1 Engine
src/core/h1 - HTTP/2 Engine
src/core/h2 - HTTP/3 Engine
src/core/h3
QUIC Transport
- QUIC Connection
src/core/quic/connection.zig - QUIC TLS
src/core/quic/tls - Loss Recovery
src/core/quic/recovery.zig
Shared Core
- Events and Errors
src/core/events.zig - Header Fields
src/core/fields.zig
Other components
- I/O Integrator
Connections 20
- I/O Integrator → Public API: feeds bytes
README.md - Public API → Native Connection: exposes connections
- Native Connection → Python Extension: uses extension
- Public API → QUIC Endpoint: exposes endpoint
zttp/__init__.py - QUIC Endpoint → Address Tokens: validates tokens
zttp/endpoint.py - QUIC Endpoint → TLS and QUIC Config: accepts configuration
zttp/endpoint.py - QUIC Endpoint → HTTP/3 Engine: creates connections
zttp/endpoint.py - Native Connection → HTTP/1.1 Engine: dispatches protocol
- Native Connection → HTTP/2 Engine: dispatches protocol
- Native Connection → HTTP/3 Engine: dispatches protocol
- HTTP/1.1 Engine → Events and Errors: emits events
- HTTP/2 Engine → Events and Errors: emits events
- HTTP/3 Engine → Events and Errors: emits events
- HTTP/3 Engine → QUIC Connection: uses transport
README.md - QUIC Connection → QUIC TLS: performs handshake
- QUIC Connection → Loss Recovery: recovers loss
- HTTP/1.1 Engine → Header Fields: parses fields
- HTTP/2 Engine → Header Fields: parses fields
- HTTP/3 Engine → Header Fields: parses fields
- Public API → I/O Integrator: returns events and bytes
README.md