Same semantics, new plumbing: a binary framing layer that multiplexes many requests over one connection — and still trips on the TCP it rides.
HTTP/2 keeps every HTTP semantic — methods, headers, status codes — but stops sending them as text. Instead it inserts a binary framing layer between the application and TCP. A request/response is chopped into typed frames that flow over logical streams, all sharing a single TCP connection.
HEADERS,
DATA, SETTINGS, WINDOW_UPDATE, RST_STREAM, …), a
length, flags, and a stream ID. Because each frame is tagged with its stream, the receiver can
pull them apart no matter how they're interleaved.
Streams are independent and bidirectional. Client-initiated streams use odd IDs, server-initiated use
even. A slow response no longer blocks the others at the HTTP layer — the server can send
/b's frames while /a is still computing.
| HTTP/1.1 | HTTP/2 | |
|---|---|---|
| Requests per connection | One at a time | Many, interleaved |
| Connections per origin | ~6 | 1 |
| Response ordering | Strict (FIFO) | Any order, per-stream |
Cookie,
User-Agent, Accept… often more bytes than the request itself. Text HTTP/1.1
had no way to compress them safely.
HPACK compresses headers with two tricks:
:method: GET) referenced by a tiny index.With everything on one connection, the client needs to say what matters first — HTML and CSS before a below-the-fold image. HTTP/2 defined a priority tree (dependencies + weights) so the server could allocate bandwidth sensibly.
Flow control (via WINDOW_UPDATE frames) is per-stream and
per-connection — a receiver can slow a firehose stream without stalling the whole connection.
HTTP/2 let a server push resources the client hadn't asked for yet — send
style.css alongside index.html before the browser parses the link.
<link rel="preload"> and 103 Early Hints instead. Don't design
around server push.
So on a lossy network, HTTP/2 can be worse than six independent HTTP/1.1 connections, because those connections fail independently. This is the exact problem HTTP/3 was created to solve — see the head-of-line blocking deep-dive.
| Mechanism | What it buys |
|---|---|
| Binary frames | Fast, unambiguous parsing; strict framing |
| Streams + multiplexing | Many concurrent requests, one connection |
| HPACK | Header sizes cut dramatically, safely |
| Flow control | Per-stream backpressure |
| TCP underneath | Still one shared byte-stream → transport HOL blocking |