turnloop-http
Own HTTP/1.1 and HTTP/2 wire engines, with no runtime or transport dependency.
http1::Decoder::receiveconsumes a prefix and returns one event. Retain the unconsumed bytes, including bytes after a CONNECT/WebSocket upgrade. A zero-consumption event is progress; call again until both consumption and event are empty.eofdistinguishes close-delimited completion from truncated framing.client::Http1Connectionadds non-pipelined requests, streamed uploads,100-continue, output acknowledgements, deadline/abort state, and one terminal completion per accepted request. Take the completion before reusing the connection.http2::Connectionhandles both roles. Flush and acknowledgeoutput, retain incomplete input, consume one frame/event at a time.send_datacan accept only a prefix or zero when flow-controlled; retain the remainder. Return DATA capacity withrelease_capacityafter the application consumes it. Queue application responses in the host during stalls. On transport loss calleof, then drainpoll_failed_stream.hpackprovides the independent bounded RFC 7541 codec. The encoder never indexes credentials/cookies. Decode failures poison a context.client::Poolreserves connections before DNS/connect so parallel commands respect per-origin/proxy limits.Routeemits resolution/TLS requests and builds proxy CONNECT or absolute-form heads.Resolverbelongs to the host.Request::redirectapplies Fetch redirects; useDEFAULT_MAX_REDIRECTS(20). JS conversions and promise delivery remain with Perry.compression::StreamingDecoderaccepts input and caller-owned output. Reuse it withresetto retain scratch buffers across bodies. Hosts may cache one per content encoding.decodeis the convenience whole-body path and constructs algorithm state each time.
No engine samples a clock. The host passes Instant deadlines and invokes timeout handlers. Hold output storage stable until a completion-shaped write finishes: do not mutate the engine while an I/O operation borrows its output. Error codes are transport causes; Perry creates the JS error objects and detailed OS diagnostics.
WASM uses the published turnloop-zstd-decoder fork of ruzstd 0.8.3 with retained sequence tables. Consumers need no workspace patch. Native builds use the reference zstd decoder by default; pure-rust-zstd selects the same decoder as WASM, including its allocation gates. See the decoder crate’s UPSTREAM.md.
Tests use private ephemeral loopback servers, Node 26, curl, generated TLS certificates, RFC vectors and a vendored HPACK corpus. examples/h2spec_server.rs is a blocking conformance driver, not the future turnloop adapter. Exact commands and limitations are in the root LANE_REPORT.md.