Skip to content

HTTP/1.1, 2 and 3: what changed

Deep diveUnder the hood

A request means the same thing in HTTP/1.1, 2 and 3, yet the same page loads very differently over each. The difference is how requests share a connection: one at a time, interleaved on one TCP connection, then split into independent streams over UDP. Here is each one, drawn packet by packet.

01 Same request, three ways to carry it

A GET /users/7 means the same thing in every HTTP version: the same methods, status codes and headers (the shared rules are in RFC 9110). What changed between 1.1, 2 and 3 is only how those requests travel: how many can share a connection, how they are written down, and what carries the bytes.

Three versions at a glance
VersionStandard sinceRuns onWritten asRequests at once per connection
HTTP/1.11997 (RFC 2068)TCPText linesOne
HTTP/22015 (RFC 7540)TCP, in practice with TLSBinary framesMany, as streams
HTTP/32022 (RFC 9114)QUIC, over UDPBinary framesMany, as QUIC streams

Each version fixed the biggest delay left by the one before. Follow one page that needs three files, a.css, b.js and c.png, through all three.

02 HTTP/1.1: one exchange at a time

HTTP/1.1 keeps the connection open between requests (keep-alive), which saves a TCP handshake each time. But on one connection, a request can only go once the previous response has finished, because nothing in the bytes says which response belongs to which request: they are matched purely by order.

Three files over one HTTP/1.1 connection
Step 1 of 7
One HTTP/1.1 connection
BrowserServerNothing sent yet
Requests waiting in the browser
a.css
b.js
c.png
  • just sent

The browser has read the HTML and found three files it needs. It has one open connection to the server. (Real browsers open up to six per host; one keeps the picture small.)

0 round trips

The standard does allow pipelining, sending the next requests without waiting, but responses must still come back in the order asked, so a slow first response blocks the rest anyway. Browsers ship with it turned off. Their workaround is more connections: up to six per host. Sites went further with domain sharding (spreading files over static1., static2....) and bundling many files into one, all to get more requests moving at once.

03 HTTP/2: many streams, one connection

HTTP/2 stops matching by order. Every message is cut into binary frames, and each frame carries a stream id. A request and its response share one stream id, so frames of different streams can be mixed on one connection and sorted out at the other end. This is multiplexing.

The same three files over HTTP/2
Step 1 of 6
One HTTP/2 connection (frames)
BrowserServerNothing sent yet
Streams on the connection
Empty
  • just sent or opened
  • just finished

TCP and TLS are up, and during the TLS handshake both sides agreed (through ALPN) to speak h2. No HTTP/2 frames yet.

Headers get smaller too. Every request repeats nearly the same headers (user-agent, accept, cookies), so HTTP/2 compresses them with HPACK: a built-in table of 61 common header fields plus a table of recent ones that both sides keep in step. A repeated header can shrink to a single byte that points into the table.

HTTP/2 also had server push, where the server sent files before the browser asked. It was hard to use well and often wasted bandwidth on files already cached. Chrome removed it in 2022 and other major browsers have since dropped it. The 103 Early Hints response, which tells the browser what to start fetching, took its place.

04 The blocking moved down a layer

HTTP/2 removed head-of-line blocking between requests. It did not remove it from TCP. TCP promises to hand over one stream of bytes, in order, with no gaps. It has no idea that the bytes after a lost packet belong to a different file. So one lost packet stalls every stream on the connection until the resend arrives.

One lost packet, under TCP and under QUIC
Step 1 of 6
TCP (HTTP/2): packets received
p1 · s1
p2 · s1
p3 · s3
p4 · s5
Given to the browser by TCP
Empty
QUIC (HTTP/3): packets received
p1 · s1
p2 · s1
p3 · s3
p4 · s5
Given to the browser by QUIC
Empty
  • arrived or delivered
  • lost on the way
  • held back by TCP
  • not here yet

The server sends four packets: two carry parts of a.css (stream 1), one carries b.js (stream 3) and one c.png (stream 5). The same four go over a TCP connection and over a QUIC one.

On a clean network this hardly matters. On a lossy mobile link it can make HTTP/2’s single connection behave worse than HTTP/1.1’s six, where a loss only stalls one of them. TCP could not be changed to fix this: it lives in every operating system kernel, and routers and firewalls on the path inspect and sometimes drop TCP packets that look unusual. So the fix was a new transport, built on UDP, which those boxes already let through.

05 HTTP/3: QUIC on top of UDP

QUIC (RFC 9000) rebuilds what TCP and TLS did, inside UDP packets: reliable delivery, resends and congestion control, but per stream, as the trace showed. It is usually implemented in a library inside the browser or server rather than in the kernel, so it can be updated like any other software. HTTP/3 is HTTP’s frames mapped onto QUIC streams.

QUIC also merges the transport and TLS 1.3 handshakes into one, and encryption is not optional: even most of the packet header is protected. The result is fewer round trips before the first request:

HTTP/1.1 or HTTP/2, TLS 1.32 round trips firstOne for the TCP handshake, one for TLS. Only then does the request go out.
HTTP/3, new connection1 round trip firstThe QUIC handshake sets up transport and encryption together.
HTTP/3, resumed with 0-RTT0 round trips firstA client that connected before can send its request in the first packet. That data can be replayed by an attacker, so servers accept it only for safe requests like GET.

Two more changes matter in practice. A QUIC connection is identified by a connection id, not by the IP address and port, so a phone that moves from Wi-Fi to mobile data can keep the same connection instead of starting over. And headers are compressed with QPACK, a version of HPACK that does not assume packets arrive in order.

A browser cannot know in advance that a server speaks HTTP/3, because the address alone does not say so. Usually the first visit uses HTTP/2 over TCP and the response carries an Alt-Svc: h3=":443" header; later requests try QUIC on UDP port 443. Servers can also announce it in a DNS HTTPS record. If UDP is blocked, the browser stays on TCP.

06 See which version you got

curl can report the version it ended up with. These are real runs with curl 8.7.1 on macOS, against www.cloudflare.com, which supports all three:

Shell
curl -s -o /dev/null -w '%{http_version}\n' https://www.cloudflare.com/
curl -s -o /dev/null -w '%{http_version}\n' --http1.1 https://www.cloudflare.com/
Text
2
1.1

With -v, curl shows the negotiation. It offers both protocols through ALPN during TLS, the server picks h2, and the response advertises HTTP/3 for next time (lines trimmed):

Shell
curl -sv -o /dev/null https://www.cloudflare.com/ 2>&1 | grep -iE 'alpn|using http|alt-svc'
Text
* ALPN: curl offers h2,http/1.1
* ALPN: server accepted h2
* using HTTP/2
< alt-svc: h3=":443"; ma=86400

--http3 needs a curl built with QUIC support; the one shipped with macOS answers the installed libcurl version doesn't support this. In a browser, open the developer tools, go to the Network tab and turn on the Protocol column: you will see h2 and h3 side by side, often on the same page.

07 When it bites

static1.example.com, static2…HTTP/1.1 tricks left in placeDomain sharding forces extra connections and handshakes and splits HPACK’s tables, undoing what HTTP/2 gives you. Serve from one host. Huge bundles also matter less now that many small requests are cheap.
UDP 443 blockedHTTP/3 not reachableSome company and hotel networks block or throttle UDP. Browsers fall back to TCP, so pages still load, but you never see HTTP/3’s gains there.
h2cPlain-text HTTP/2 in a browserBrowsers only speak HTTP/2 over TLS. Cleartext HTTP/2 (h2c) works between your own services, for example gRPC inside a cluster, but not from a browser.
load balancer → app over HTTP/1.1The version stops at the edgeOften the CDN or load balancer speaks HTTP/2 or 3 to browsers and HTTP/1.1 to your servers. Logs on the app show 1.1 even when users get h3.
one lossy connectionOne connection is one point of failureUnder heavy packet loss, a single HTTP/2 connection stalls everything on it. That is the case HTTP/3 was built for.

Don’t confuse "many requests at once" with "unlimited". HTTP/2 servers announce SETTINGS_MAX_CONCURRENT_STREAMS (100 is a common value), and requests past the limit queue in the client, which looks like slow responses.

08 Check yourself

Question

An HTTP/2 connection carries 10 downloads. One TCP packet for download 4 is lost. What waits for the resend?

Question

Why is QUIC built on UDP instead of being a new version of TCP?

Question

Over HTTP/1.1 your site loads files from static1 to static4.example.com to get more parallel requests. What happens after moving to HTTP/2?

09 Practise this

Was this tutorial useful?Your vote tells us what to improve next.
Spotted a mistake, or something unclear?