Skip to content

CONCEPT Cited by 1 source

Binary HTTP

Definition

Binary HTTP (RFC 9292) is a binary encoding of HTTP messages — requests and responses — designed for use inside encrypted protocol envelopes where textual HTTP framing is unnecessary or undesirable.

In Oblivious HTTP (OHTTP), the inner HTTP request is encoded as Binary HTTP before encryption. The format is length-prefixed: each component (method, scheme, authority, path, headers, body) is preceded by its byte length.

Format overview

A Binary HTTP request encodes:

  • 02 — indeterminate-length request marker
  • Method as length-prefixed string (e.g. 04504f5354 = 4 bytes + "POST")
  • Scheme as length-prefixed string (e.g. 056874747073 = 5 bytes + "https")
  • Authority as length-prefixed string (e.g. 117461726765742e6f687474702e696e666f = 17 bytes + "target.ohttp.info")
  • Path as length-prefixed string
  • Headers as length-prefixed key-value pairs
  • Body as length-prefixed content
  • 00 terminator

Why it exists

OHTTP encrypts the entire inner HTTP request for the gateway. The gateway needs a compact, unambiguous binary format to reconstruct the plaintext HTTP request from the decrypted blob. Textual HTTP/1.1 framing (CR-LF line endings, optional whitespace, folded headers) introduces parsing ambiguity that a binary format eliminates.

Debugging hazard

Because the format is length-prefixed, a single misplaced byte corrupts all subsequent fields. Cloudflare's 2026-07-27 pvcli post gives a concrete example: an accidental space character (0x20) appended to a body payload specified as 10 bytes long (0x0a) — the parser expected 10 bytes but found 11, silently corrupting the message without an obvious error. This class of bug motivated the creation of systems/pvcli to automate encoding and provide step-by-step hex dumps for verification.

Seen in

Last updated · 598 distilled / 1,814 read