Applications, chapter 29 of 36
HTTP/2: Multiplexing over One Connection
HTTP/2's client preface carries PRI and SM, which together read PRISM, and the drafts give no reason for them.
The server's EncryptedExtensions message has named h2, and the laptop sends its TLS Finished. Right behind it go 24 octets that any HTTP/1.1 server would take for a broken request: PRI * HTTP/2.0, an empty line, SM, and another empty line. After that, everything on this connection is a frame. Our GET / is one of them, 145 octets long and labeled stream 1.
- 19 octets
- the HPACK field block of our stylesheet request, against 131 for the
GET /before it - 0.04%
- of sessions used server push, in the IETF 102 material nginx cited when it removed push
- 398 million
- requests per second, topped by the largest Rapid Reset attack Google saw in August 2023
HPACK, field by field
Our two requests, one field at a time, against the static table and the server's dynamic table. Step through stream 1, then switch to stream 3 and watch 131 octets become 19.
How did one company's experiment become HTTP/2?
In 2012 the HTTPbis working group collected proposals for HTTP/2.0. Poul-Henning Kamp of the Varnish Cache Project argued against starting from SPDY, because what the group was doing "is a popularity contest, it is not engineering" [Kamp2012]. The chair, Mark Nottingham, replied that SPDY as a de facto HTTP/2.0 outside the IETF process "would be a worse outcome" [Nottingham2012a].
His report of 4 August 2012 records "agreement in the room to use SPDY as the starting point" [Nottingham2012b]. Kamp did not come around. In January 2015 he wrote that he "would flunk students" who handed it in [Kamp2015]. His name appears in the acknowledgments of RFC 7540 all the same.
Why does HTTP/2 need its own compressor?
SPDY compressed header fields with DEFLATE, which "exposed a security risk" (RFC 7541, Section 1). The risk was CRIME, presented by Juliano Rizzo and Thai Duong at Ekoparty 2012. An attacker who can add text to a request and watch the length of the encrypted result learns a cookie a character at a time, because a correct guess compresses better (RFC 7457, Section 2.6).
HPACK, by Roberto Peon and Herve Ruellan, compresses by reference, with a static table of 61 entries and a dynamic table that both ends build. A guess must match a whole field value, and values with low entropy remain at risk (RFC 7541, Section 7.1.1).
Why does HTTP/2 need flow control when TCP already has it?
Because many streams share one TCP receive window. A proxy that cannot get rid of the data of one stream must not stall the others, so each stream and the connection get a credit window that the receiver opens with WINDOW_UPDATE frames (RFC 9113, Section 5.2). Only DATA frames count, and both windows start at 65,535 octets.
On our 12 ms path that default caps a stream at about 43.7 Mbit/s, and Chromium's 6 MiB window allows about 4.2 Gbit/s. The server lifts its connection window to 2^31 minus 1, which RFC 9113, Section 5.2.2 describes as the way to disable flow control for a receiver.
What happened to server push?
The browsers turned it off. A PUSH_PROMISE reserves an even-numbered stream and carries the request the server attributes to the client (RFC 9113, Section 8.4). The server cannot see the browser's cache, so it may push what the client already has.
Chrome 106 disabled push in 2022, after the share of HTTP/2 sites using it had fallen from 1.25 percent to 0.7 percent [Pollard2022]. Firefox 132 followed in October 2024 [Mozilla2024]. The replacement leaves the decision with the client: the 103 (Early Hints) status of RFC 8297 sends Link fields ahead of the final response.
Did HTTP/2 end head-of-line blocking?
It moved it down one layer. HTTP/2 interleaves frames, so a slow response no longer blocks the others. All of them still travel in one TCP byte stream, and TCP delivers nothing past a lost segment until the retransmission arrives. RFC 9113, Section 1 says so: "TCP head-of-line blocking is not addressed by this protocol."
With six HTTP/1.1 connections a dropped segment stalls one response. With one HTTP/2 connection it stalls all of them and cuts the only congestion window. The NSDI 2014 study traced most SPDY benefits to the single connection, which is "also detrimental under high packet loss" [Wang2014].
How do you attack a state machine that must answer?
You make it do work that the protocol obliges it to do. A PING must be answered, and a field block must be decompressed even when its stream is being discarded (RFC 9113, Section 4.3 and Section 10.5). In August 2019 Netflix published eight such attacks at once [Netflix2019].
Rapid Reset (CVE-2023-44487) needed two legal frames. The client opens a stream with HEADERS and cancels it at once with RST_STREAM, so the server starts the work and loses the stream. A reset stream no longer counts against SETTINGS_MAX_CONCURRENT_STREAMS, and Cloudflare saw peaks slightly above 201 million requests per second from "a botnet of merely 20,000 machines" [Pardue2023].
The book keeps asking
This chapter has 5,577 words and 13 questions. These 7 are answered only in the book and the audiobook.
- Why did Google build SPDY?
- How do the two ends agree to speak HTTP/2?
- What does the laptop send first?
- How does our GET become a HEADERS frame?
- How do many streams share one connection?
- Who decides which response goes first?
- How do WebSocket and gRPC fit onto a stream?
Open the sources
- RFC 9113 HTTP/2
- RFC 7540 Hypertext Transfer Protocol Version 2 (HTTP/2)
- RFC 7541 HPACK: Header Compression for HTTP/2
- RFC 9218 Extensible Prioritization Scheme for HTTP
- RFC 8441 Bootstrapping WebSockets with HTTP/2
- RFC 7301 Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension
- [Chromium2026] Chromium source tree, version 159.0.8138.0 (commit e0fb9dd9ecb25, 1 November 2026)
All 42 documents this chapter cites, each with a link to its publisher and a copy kept here.
