0164: HTTP protocol code lives in a Harness plugin
Status: Accepted by maintainer 2026-11-07
Context
Parsing HTTP means parsing untrusted bytes. C parsers fail with
undefined behavior; Harness code is bounds-checked, runs in both
backends, and gets differential tests for free.
mcp_server.serve_line, a2a.handle and
agent/sse already keep protocol logic pure while the
host owns the I/O (ADR-0004, ADR-0153, ADR-0154).
Decision
A plugin plugins/http with
capabilities = []:
http.wire: an incremental HTTP/1.1 request parser (feed(Parser, bytes) -> Need | Done | Bad), a response serializer,Limits. Strict rules: CRLF only, origin-form targets, oneContent-Length, anyTransfer-Encodingis 501, header values strict UTF-8, CR/LF/NUL in response headers is a 500, noDateheader,Connection: closealways.http.serve:interface Handler,serve_conn,serve(listener, handler, limits, max_requests).http.files: puresafe_pathandcontent_typehelpers; the app reads files with its ownFs.http.client: outbound requests (ADR-0166).
No router in v1.
Consequences
The kernel holds only socket mechanisms; protocol policy is
Harness code agents can read and change. Parser speed in compiled
Harness is unmeasured and is optimized only with a
bench/ case. The plugin is a fuzz target for
M16.2.
Alternatives
- A C parser in the runtime (picohttpparser
style): faster, but adds memory-unsafe parsing and a
second implementation for
interp. - A Rust-side built-in: compiled C programs could not use it.