Expand description
A hand-rolled HTTP/1.1 engine — no framework dependency, the same
style as crates/monitor/src/server.rs and the accept loops of
crates/coap-bridge/crates/websocket-bridge, extended to what
those two don’t need: request/response bodies beyond one read()
call, chunked Transfer-Encoding (RFC 7230 §4.1) on the request
side, keep-alive (RFC 7230 §6.3), and a Content-Length DoS cap.
Scope: reads one request at a time off a blocking Read + Write
stream, and writes one response. A caller loops read_request /
write_response on the same connection for keep-alive; closes the
stream (or a request/response that named Connection: close) ends
it. Response bodies are always sent as Content-Length — every body
this daemon serves (XML, WSDL, a SOAP fault) is fully materialized
before it is sent, so there is no reason to chunk the output; only
an inbound request body may arrive chunked, from a client library
that does not know its body’s length up front.
Structs§
Enums§
- Http
Error - Read/parse error.
Constants§
- DEFAULT_
MAX_ BODY - Default cap on a request’s
Content-Length/ total chunked body size. DDS-WEB samples are typically small; a body larger than this is refused with413 Payload Too Largebefore it is read into memory. - MAX_
HEADER_ BYTES - Cap on the request line + header block, read before any body handling — bounds a client that never sends a blank line.
Functions§
- read_
request - Reads one HTTP/1.x request off
stream, decoding a chunked body ifTransfer-Encoding: chunkedis present, or reading exactlyContent-Lengthbytes otherwise. Neither may exceedmax_body. - write_
response - Writes
responsetostreamasContent-Length-framed HTTP/1.1, honoringkeep_alivein theConnectionheader.