BHTTP-1
PROTOTYPEA binary, HTTP-like protocol over persistent TCP, written in Go with a spec, server, client and chaos proxy.
Personal project ยท Sep 2026
THE PROBLEM
Learn what HTTP does for you by designing a small binary protocol and making its parser survive hostile input.
HOW IT WORKS
- A 12-byte frame header (length, type, flags, stream id) with request, response, data and error frames.
- A reference server (bserve), a client (bcurl), a chaos proxy (bchaos) that splits reads to one byte and injects unknown frames, and independent Python interop clients.
ENGINEERING EVIDENCE
- Frame length is validated before any allocation, and unknown frame types are skipped by their length. reader.go โ
- Four fuzz targets, and the Go test suite (about 370 test runs) passes.
- Written spec, wire-format document and an annotated hexdump of a real captured exchange.
DECISIONS & INVESTIGATIONS
TestDrainIsBoundedInSizeAndTime (an endless sender and a silent peer, over net.Pipe, which has no CloseWrite, so the FIN step is not exercised there) and TestServerStopsTalkingToAPeerThatKeepsSending (real TCP) pin...
TestFileThatShrinksMidTransferEndsWithAnErrorNotASilentTruncation creates a 48 MiB file, holds the client back so the server blocks mid-file, truncates it to zero, and asserts an ERROR frame with code PROTOCOL_ERROR...
WHAT ISN'T DONE
- Version 1 handles one request at a time: no multiplexing and no TLS.
- Standard library only; not deployed.
STACK
- Go
- Python
- Docker