Why
Most Go web work happens through net/http, which hides the wire format entirely. go-http builds the protocol layer itself — a streaming request parser, a header parser, and a response writer — to understand what net/http is actually doing underneath.
What go-http Does
An HTTP/1.1 server implemented directly on top of raw TCP, with no net/http on the server side. It parses raw request bytes off the wire and writes responses — status lines, headers, chunked encoding, trailers — by hand, byte for byte, per the HTTP/1.1 spec.
How It Works
- Streaming request parser parses the request line, headers, and body incrementally as bytes arrive, without buffering the full request first.
- Case-insensitive header handling per RFC 9110, with repeated header fields merged into a single comma-separated value.
- Each accepted connection is handled on its own goroutine.
- Response writer supports fixed-length responses, chunked transfer encoding with hex-prefixed chunks, and trailers sent after the body.
- A small reverse proxy streams responses from an upstream host (httpbin.org) back to the client chunk by chunk, live.
Why It Matters
The parser is tested against reads split across arbitrary byte-sized chunks, so it never assumes a request arrives in one piece, and an end-to-end test dials the running server over a real TCP socket to assert on raw response bytes — 85–90% statement coverage on the request/header parsers.