Field Notes

Reading HTTP/2 frames by hand

12 November 2026 · 8 min read

Most of the time a packet capture is the wrong tool. But when a client and a server disagree about a connection, the wire is the only place where both are telling the truth. HTTP/2 is friendly in this respect: the framing layer is small, fixed, and self-describing.

The preface

Every client connection opens with the same 24 bytes:

PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n

If you see that, everything after it is a length-prefixed frame. There is no ambiguity and no version negotiation beyond the ALPN result in the TLS handshake.

One frame, nine bytes of header

Each frame starts with a 9-byte header: a 24-bit length, an 8-bit type, an 8-bit flags field, and a 31-bit stream identifier with one reserved bit. The length counts the payload only.

00 00 12            length = 18
04                  type   = SETTINGS
00                  flags  = none
00 00 00 00         stream = 0

Settings are always sent on stream zero, because they belong to the connection and not to any request. The payload is a list of 6-byte entries, each an identifier and a value. The first entry in almost every capture is 0x0003, MAX_CONCURRENT_STREAMS, usually a round number chosen by the server.

Where it gets interesting

Header blocks are compressed with HPACK, and that is the part people avoid. You do not need to implement it to debug a connection. What you need is to know which frames carry state that survives across requests:

Reading a stalled connection

A connection that hangs usually shows one of three shapes. Flow-control starvation looks like a WINDOW_UPDATE that never arrives. A stream that has been reset shows RST_STREAM with a code you can look up in a table. A server that has stopped reading shows PING frames going out and nothing coming back.

None of this requires a protocol library. It requires a hex dump and the frame header diagram, which fits on an index card.


← Back to all writing