How the Internet works

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].

laptopserver preface, SETTINGS, WINDOW_UPDATE, HEADERS 1SETTINGS, WINDOW_UPDATESETTINGS ACKSETTINGS ACKHEADERS 1: 200, age, alt-svcDATA 1 + END_STREAM
From the book: Round trip 3 on the HTTP/2 connection, frame by frame

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 2022, Proposed Standard
  • RFC 7540 Hypertext Transfer Protocol Version 2 (HTTP/2) 2015, Proposed Standard; obsoleted by RFC 9113
  • RFC 7541 HPACK: Header Compression for HTTP/2 2015, Proposed Standard
  • RFC 9218 Extensible Prioritization Scheme for HTTP 2022, Proposed Standard
  • RFC 8441 Bootstrapping WebSockets with HTTP/2 2018, Proposed Standard
  • RFC 7301 Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension 2014, Proposed Standard
  • [Chromium2026] Chromium source tree, version 159.0.8138.0 (commit e0fb9dd9ecb25, 1 November 2026) 2026, free

All 42 documents this chapter cites, each with a link to its publisher and a copy kept here.

Applications, chapter 30 of 36

QUIC: A Transport in Userspace

Applications, chapter 31 of 36

HTTP/3: The Web on QUIC

Applications, chapter 32 of 36

Mail: SMTP and Forty Years of Patches

Applications, chapter 33 of 36

Time, Shells, and Files: NTP, SSH, Telnet, and FTP

The Whole Path, chapter 34 of 36

Measuring and Debugging the Path

The Whole Path, chapter 35 of 36

The Whole Journey, Byte by Byte

The Whole Path, chapter 36 of 36

Ossification and What Comes Next

You have reached the server. The book goes further.

Everything on this site is a short version. Follow the Packet is the long one: 36 chapters and about 280,000 words, with every protocol fact traced to the section of the standard that defines it, every byte dump built by a script you can run, and a directory of more than a thousand cited documents. It comes as a printable book and as an audiobook.

Hear how chapter 1 opens. 70 seconds, narrated by a synthetic voice.

Get the book or the audiobook Read the start of chapter 1 Browse every source

Cover of Follow the Packet: How the Internet Works, Layer by Layer, from ARPANET to QUIC, by Wolfgang Kerschbaumer

The signup uses double opt-in. Every message includes an unsubscribe link.

Published by Sysinit Press. The public addresses, AS numbers and names of the scenario come from ranges reserved for documentation, and the home network uses private addresses, so the site describes no real network. RFC texts are copied unchanged from the RFC Editor.