18. HTTP: What the Browser Actually Says

The laptop's 37-byte request and the server's 1,256-byte answer decoded byte by byte, then the same exchange carried as HTTP/2 frames with HPACK and as HTTP/3 over QUIC, with caching, HTTPS and head-of-line blocking along the way

Picture the counter of an old-fashioned library's closed stacks. You don't wander the shelves yourself. You fill in a slip, "please fetch: shelf 4, Moby-Dick", and hand it over. The clerk disappears, comes back with the book, and staples a note to it: "Here you are. Due back in two weeks. If you just want to check whether we have a newer edition, show us this note and we'll tell you without fetching it again." Then the next person in the queue steps up.

That's HTTP, the Hypertext Transfer Protocol, almost exactly. The slip is a request: a method, the thing you want, and a few lines of extra detail. The book with its note is a response: a status, some header fields describing what came back and how long you may keep it, and the body. The queue is the problem every version since 1991 has tried to fix. One clerk serving one slip at a time is slow, so libraries opened more counters, then let one clerk juggle many slips at once, and finally gave each slip its own conveyor belt.

The TCP article opened a connection from the laptop, 192.168.10.10:47130, to the web server at 203.0.113.80:80 and sent 37 bytes of data, GET / HTTP/1.1…. It promised to explain what flows over the connection once it's open, and how HTTP/1.1, HTTP/2 and HTTP/3 each deal with head-of-line blocking. The DNS article ended with the laptop holding the server's address and a hint that Host: example.com would tell the server which site it wants. The Congestion Control article pointed ahead to HTTP/3, where congestion control moved into the application. This last page of the series keeps all three promises. It decodes the request and builds the server's reply byte by byte, then carries the same exchange over HTTP/2 and HTTP/3, so you can see exactly what changed and why.

(As everywhere in this series, 203.0.113.80 and 2001:db8:113::80 are documentation addresses standing in for the server. The real example.com lives elsewhere and serves a different page.)

From One Line to Three Protocols

Tim Berners-Lee wrote the first web server and browser at CERN in 1990. The protocol between them was as small as a protocol can be. A note he published in 1991, The Original HTTP as defined in 1991, describes all of it: open a TCP connection to port 80, send one line, GET and a document address, ending in a carriage return and line feed. The server answers with the HTML document and closes the connection. That's it. No version number, no status codes, no headers, no way to send anything but HTML, and no way to say "not found" except by sending an HTML page that says so. It's now called HTTP/0.9, and the whole request for the home page is 7 bytes:

GET /\r\n

Everything since has kept that shape, a request and a response, and added to it:

Version Defined in What it added
0.9 A note by Berners-Lee, 1991 One line, GET only; HTML back, then close
1.0 RFC 1945, May 1996 Versions, status codes, headers, POST, any media type
1.1 RFC 2068 (1997), 2616 (1999), 7230–7235 (2014), 9112 (2022) Host, persistent connections, chunked bodies, caching
2 RFC 7540 (2015), RFC 9113 (2022) Binary frames, many streams on one connection, HPACK
3 RFC 9114 (2022), on QUIC, RFC 9000 (2021) Streams that don't block each other, QPACK, over UDP

HTTP/1.0 (RFC 1945, May 1996, by Berners-Lee, Roy Fielding and Henrik Frystyk) wasn't a design so much as a record of what browsers and servers were already doing. It added the version to the request line, a status line to the response, and header fields to both, so a server could say what kind of data it was sending and a client could say what it would accept.

HTTP/1.1 came out in January 1997 as RFC 2068 and was revised as RFC 2616 in June 1999, which stood for fifteen years. It's the version that made the web scale: virtual hosting with Host, connections that stay open between requests, bodies whose length isn't known in advance, and a serious caching model. In June 2014 RFC 2616 was split into six documents, RFC 7230 to 7235. Then in June 2022, Fielding, Mark Nottingham and Julian Reschke rewrote the lot into a cleaner split that separates what HTTP means from how each version writes it down:

  • RFC 9110, HTTP Semantics: methods, status codes, header fields, content negotiation. Shared by every version.
  • RFC 9111, HTTP Caching: when a stored response may be reused. Also shared.
  • RFC 9112, HTTP/1.1: the text format on the wire, and connection management.
  • RFC 9113 for HTTP/2 and RFC 9114 for HTTP/3: other ways of writing the same messages down.

That split is the key to this whole page. A GET for / on example.com means the same thing in all three versions. What changes is the encoding: lines of text, binary frames on one TCP connection, or binary frames on independent QUIC streams.

The Request, Byte by Byte

Here are the 37 bytes the laptop sent, as a capture tool would show them, eight to a row with the ASCII alongside:

The request: 37 bytes

0000  47 45 54 20 2f 20 48 54  GET / HT
0008  54 50 2f 31 2e 31 0d 0a  TP/1.1..
0010  48 6f 73 74 3a 20 65 78  Host: ex
0018  61 6d 70 6c 65 2e 63 6f  ample.co
0020  6d 0d 0a 0d 0a           m....

0d 0a is a carriage return and a line feed, written \r\n and called CRLF. HTTP/1.1 ends every line with one. Counting: the request line is 14 bytes plus CRLF, 16; the Host line is 17 plus CRLF, 19; the empty line is 2. 16 + 19 + 2 = 37.

An HTTP/1.1 message has a start line, then zero or more header field lines, then an empty line, then an optional body. The start line and headers together are the message's head:

The request · 37 bytes The response · 1,256 bytes GET / HTTP/1.1 \r\n Host: example.com \r\n \r\n HTTP/1.1 200 OK \r\n Server … Accept-Ranges: 9 fields, 256 bytes \r\n <!doctype html> … 981 bytes method target version CRLF version code reason CRLF a header field: name, colon, value empty line: the head ends here no body: a GET doesn't need one empty line body; its length comes from Content-Length 16 + 19 + 2 = 37 17 + 256 + 2 + 981 = 1,256
  1. The method: GET

    What the client wants done. GET means "send me a representation of this resource". Methods are case-sensitive and, by convention, upper case. A single space separates the three parts of the request line.

  2. The request target: /

    Which resource. Here it's the path of the URL, plus the query if there were one, like /search?q=http. This is the origin form. A request sent to a proxy uses the whole URL instead, GET http://example.com/ HTTP/1.1, the absolute form, because the proxy needs to know where to forward it.

  3. The version: HTTP/1.1

    Which rules the rest of the message follows. A server that only speaks HTTP/1.0 answers with a 1.0 response, and both sides fall back to the older rules.

  4. One header field: Host: example.com

    A field name, a colon, optional whitespace and a value. Names are case-insensitive: host: means the same thing. Host is the only header an HTTP/1.1 request must have, and the next section explains why.

  5. The empty line: \r\n

    The head is over. This is the delimiter the TCP article mentioned: TCP delivers a stream of bytes with no boundaries, so the server reads until it sees \r\n\r\n. A GET carries no body, so the request ends right here, and the server can start on its answer.

What a browser really sends

A browser never sends anything this short. Asking for the same page, Firefox or Chrome adds a dozen more headers: User-Agent naming the browser, Accept listing the media types it prefers, Accept-Language, Accept-Encoding saying it can decompress gzip, Brotli and Zstandard, cookies, and several more. A typical browser request is 500 to 800 bytes, and every one of those bytes is sent again with every request for every image on the page. Remember that when we get to HPACK.

Our 37 bytes are the smallest valid HTTP/1.1 request, and you can send exactly those with curl. The -H 'User-Agent:' and -H 'Accept:' options remove the two headers curl adds by itself, and -v shows everything that happens:

$ curl -sv -H 'User-Agent:' -H 'Accept:' \
       http://example.com/ -o page.html
* Host example.com:80 was resolved.
* IPv6: 2001:db8:113::80
* IPv4: 203.0.113.80
*   Trying 203.0.113.80:80...
* Established connection to example.com
  (203.0.113.80 port 80) from 192.168.10.10
  port 47130
* using HTTP/1.x
> GET / HTTP/1.1
> Host: example.com
>
* Request completely sent off
< HTTP/1.1 200 OK
< Server: nginx
< Date: Sat, 31 Oct 2026 09:14:07 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 981
< Last-Modified: Thu, 15 Oct 2026 12:00:00 GMT
< Connection: keep-alive
< ETag: "6ad0c040-3d5"
< Cache-Control: max-age=3600
< Accept-Ranges: bytes
<
* Connection #0 to host example.com:80 left intact

Lines starting * are curl's commentary, > is what it sent and < is what came back. (The "Established connection" line is one long line in a real terminal; it's wrapped here. And curl would try the IPv6 address first, as the IPv6 article's Happy Eyeballs section described; we're following the IPv4 connection from the TCP article.) Before we decode the reply, let's look at what all those parts mean.

What a Request Means

RFC 9110 defines the meaning of HTTP independently of any wire format. Its building blocks are resources, identified by URLs; methods, which say what to do to a resource; status codes, which say how it went; and fields, which carry everything else.

URLs and origins

A URL packs several things into one string:

Taking a URL apart

https://example.com:443/photo1.jpg?size=s#top
└─┬─┘   └────┬────┘ └┬┘└────┬────┘ └──┬──┘ └┬┘
scheme     host   port   path    query  fragment

The scheme says which protocol to use, and with it the default port: 80 for http, 443 for https. The host is looked up in DNS. The path and query become the request target. The fragment never leaves the browser at all: it only tells the browser where to scroll once the page has arrived.

The first three parts together, scheme, host and port, make up the URL's origin. https://example.com and http://example.com are different origins, and so are https://example.com and https://www.example.com. Origins are the unit browsers use to keep sites apart: the same-origin policy stops a script from one origin reading responses from another, and cookies, storage and permissions are all kept per origin (or per site). They're also the unit of connection reuse: a browser keeps connections per origin, which will matter when we count them later.

Methods, safe and idempotent

RFC 9110 defines eight methods, and RFC 5789 (2010) added a ninth, PATCH. Two properties matter more than the names:

  • A method is safe if it's read-only, as far as the client is concerned. A crawler, a link prefetcher or a cache may send a safe request on its own initiative, because nothing should change as a result.
  • A method is idempotent if sending the same request twice has the same effect as sending it once. Idempotent requests can be retried automatically when a connection drops before the answer arrives, because the client can't know whether the first copy got through.
Method What it's for, and its properties
GET Fetch a representation of the resource. Safe and idempotent
HEAD The same response as GET, but headers only. Safe and idempotent
POST Process the enclosed data: forms, most API calls. Neither
PUT Replace the resource with the enclosed data. Idempotent
DELETE Remove the resource. Idempotent
PATCH Apply a partial change. Neither
OPTIONS Ask what the server allows; CORS preflight. Safe and idempotent

The other two are special. CONNECT asks a proxy to open a raw tunnel, which is how a browser behind a proxy reaches HTTPS sites, and TRACE echoes the request back for debugging; most servers disable it.

These are promises the server's application is supposed to keep, and nothing enforces them. A website that deletes an account when you follow a GET link will one day be emptied by a search engine crawler. That's why browsers warn you before re-sending a form after a refresh: the form was a POST, and nobody can tell whether a second copy would buy a second sofa.

Status codes

Every response starts with a three-digit status code. The first digit is the class, and a client that doesn't know a particular code treats it like the x00 of its class:

  • 1xx, informational: an interim response; the real one is still coming.
  • 2xx, success: the request worked.
  • 3xx, redirection: look somewhere else, or use your cached copy.
  • 4xx, client error: the request was wrong; sending it again won't help.
  • 5xx, server error: the request may have been fine, but the server failed.

The ones you'll meet most often:

Code and name When
100 Continue "Go ahead and send the body"
101 Switching Protocols WebSocket upgrade accepted
103 Early Hints Preload these while I think (RFC 8297)
200 OK The resource, in the body
201 Created A POST or PUT made something new
204 No Content Success, and nothing to send back
206 Partial Content The byte range you asked for
301 / 308 Moved Permanently / Permanent Redirect Update your bookmark
302 / 307 Found / Temporary Redirect Look over there, this time
304 Not Modified Your cached copy is still good
400 Bad Request Malformed, or no Host
401 / 403 Unauthorized / Forbidden Log in / you may not
404 Not Found Nothing here
429 Too Many Requests Slow down (RFC 6585)
500 Internal Server Error The application crashed
502 / 504 Bad Gateway / Gateway Timeout A proxy couldn't get an answer upstream
503 Service Unavailable Overloaded or down for maintenance

The difference between 301 and 308 (and between 302 and 307) is the method. Early browsers turned a redirected POST into a GET, and the specification ended up allowing it for 301 and 302. The newer codes, 307 and 308, guarantee the method stays the same. And yes, there's a 418, "I'm a teapot", from an April Fools' RFC in 1998 about controlling coffee pots over HTTP. RFC 9110 reserves the number so that nobody can give it a real meaning.

The words after the code, like OK, are the reason phrase. Clients ignore them; they're for humans reading a capture. HTTP/2 and HTTP/3 drop them altogether.

Header fields

Fields carry everything else: metadata about the body (Content-Type, Content-Length, Content-Encoding), about the request (Host, User-Agent, Referer, Authorization), about caching (Cache-Control, ETag), about the connection, and about whatever a new extension needs. They're extensible by design: a client or server ignores fields it doesn't understand, which is how features like CORS, HSTS and Early Hints could be added without a new version of HTTP. A field may appear more than once, and the values combine as a comma-separated list, except for Set-Cookie, which predates the rules and has to be kept separate.

Content negotiation

One URL can have several representations: the page in English or German, as HTML or JSON, compressed with gzip or Brotli. The client says what it prefers, and the server picks:

Accept: text/html,application/xhtml+xml;q=0.9,*/*;q=0.8
Accept-Language: en-GB,en;q=0.7,de;q=0.3
Accept-Encoding: gzip, br, zstd

q is a weight from 0 to 1, defaulting to 1, so this browser prefers British English, will settle for any English, and would take German at a pinch. If the server compresses the page with Brotli, it says Content-Encoding: br, and the body on the wire is the compressed bytes. It should also say Vary: Accept-Encoding, which matters for caching: it warns every cache along the way that a different Accept-Encoding might get a different response.

Our request sent no Accept-Encoding, so the server sent the page uncompressed. That's why its Content-Length is the size of the HTML itself.

Many Sites, One Address: the Host Header

HTTP/1.0 requests didn't say which site they wanted, only which path. A server with one IP address could therefore serve one site, and every website needed its own address. With the web growing fast in the mid-1990s and IPv4 addresses already being rationed (the IPv4 article tells that story), that couldn't last.

HTTP/1.1's fix is the Host header: the host name, and port if it isn't the default, from the URL the user asked for. Now one server, on one address, can host thousands of sites, and look at Host to decide which one each request is for. That's name-based virtual hosting, and it's how almost all shared hosting and every CDN works. An nginx configuration for two sites on the same address looks like this:

server {
    listen 80;
    server_name example.com www.example.com;
    root /srv/example;
}
server {
    listen 80;
    server_name example.org;
    root /srv/other;
}

The rule is strict: RFC 9112 says a server must answer 400 Bad Request to an HTTP/1.1 request that lacks a Host header or has more than one. HTTPS has the same problem one step earlier, because the server must choose a certificate before it has seen any HTTP at all; the TLS handshake's SNI extension, below, carries the name for that. In HTTP/2 and HTTP/3 the host travels in the :authority pseudo-header instead.

The Response, Byte by Byte

The server at 203.0.113.80 has the request. Its web server, nginx in this example, reads up to the empty line, sees GET / for example.com, finds the file for the site's home page, and answers. Here's the whole head of its response, 275 bytes:

The response head: 275 bytes

HTTP/1.1 200 OK\r\n
Server: nginx\r\n
Date: Sat, 31 Oct 2026 09:14:07 GMT\r\n
Content-Type: text/html; charset=utf-8\r\n
Content-Length: 981\r\n
Last-Modified: Thu, 15 Oct 2026 12:00:00 GMT\r\n
Connection: keep-alive\r\n
ETag: "6ad0c040-3d5"\r\n
Cache-Control: max-age=3600\r\n
Accept-Ranges: bytes\r\n
\r\n

Line by line, CRLFs included: 17 + 15 + 37 + 40 + 21 + 46 + 24 + 22 + 29 + 22 + 2 = 275 bytes. The first 24 bytes in hex are 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 53 65 72 76 65 72 3a, HTTP/1.1 200 OK\r\nServer:.

  1. The status line: HTTP/1.1 200 OK

    The version the server speaks, the status code, and the reason phrase. 200: here's the page.

  2. Server and Date

    What software answered, and when: always GMT, always this fixed-length format, borrowed from email's date headers. Caches use Date to work out how old a response is.

  3. Content-Type: text/html; charset=utf-8

    What the body is: a media type, the same registry email uses, with a parameter giving the character encoding. Without it the browser would have to guess, and browsers guessing ("MIME sniffing") has caused many security bugs.

  4. Content-Length: 981

    How many bytes of body follow the empty line. This is how the laptop knows where the response ends without the server closing the connection; the next section is about exactly that.

  5. Last-Modified and ETag

    Two validators for this version of the page: when it last changed, and an opaque tag that changes whenever it does. nginx builds its ETags from the file's modification time and size in hex: 6ad0c040 is 1,792,065,600 seconds since 1970, which is the Last-Modified time, and 3d5 is 981. We'll use both in [Caching](#caching).

  6. Cache-Control: max-age=3600

    Anyone may keep this response and reuse it for an hour without asking again.

  7. Connection: keep-alive and Accept-Ranges: bytes

    The connection stays open for another request, which in HTTP/1.1 it would anyway; and the server will honour Range requests for parts of the body, answering 206 Partial Content. That's how a download manager resumes a broken download and how a video player seeks.

Then, straight after the empty line, the body: 981 bytes of HTML.

The body: 981 bytes

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
      content="width=device-width">
<title>Example Domain</title>
<link rel="stylesheet" href="/style.css">
<script src="/app.js" defer></script>
</head>
<body>
<header>
<img src="/logo.svg" alt="" width="48">
<h1>Example Domain</h1>
</header>
<main>
<p>This domain is for use in documentation
examples. You may use it in your own examples
without asking permission.</p>
<p>The photographs below are here so that the
browser has something more to fetch once it
has read this page: nine more requests
in total.</p>
<div class="gallery">
<img src="/photo1.jpg" alt="Photo 1">
<img src="/photo2.jpg" alt="Photo 2">
<img src="/photo3.jpg" alt="Photo 3">
<img src="/photo4.jpg" alt="Photo 4">
<img src="/photo5.jpg" alt="Photo 5">
<img src="/photo6.jpg" alt="Photo 6">
</div>
</main>
<footer>
<p><a href="https://www.iana.org/domains/example">
More information here.</a></p>
</footer>
</body>
</html>

38 lines, each ending in a single line feed, as text files on the server usually do. (Only HTTP's own head needs CRLFs; the body is whatever bytes the file contains.) 275 + 981 = 1,256 bytes.

1,256 bytes is exactly the response the TCP article closed its connection after. It fits in one TCP segment: the laptop's SYN offered an MSS of 1460, and with 12 bytes of timestamps in every segment, 1,448 bytes of data fit. So the server sends one segment from port 80 to port 47130, flags PSH and ACK, sequence number 3558738488 (its ISN plus one) and acknowledgment number 1798279658 (the laptop's ISN plus one for the SYN plus 37 for the request). In Wireshark's relative numbers it's bytes 1 to 1,256, which is why the laptop's FIN in the TCP article acknowledged 1257. The NAT article's R1 rewrites the segment's destination from 198.51.100.23 back to 192.168.10.10 on the way in.

The browser now parses the HTML and finds nine more things to fetch: a stylesheet, a script, a logo and six photos. How it fetches them is where the versions of HTTP part company. But first, the problem that shaped HTTP/1.1: how does the laptop know the response has ended?

Where Does a Message End?

In HTTP/0.9 the answer was simple: when the server closes the connection. That works, but it means one connection per request, and a connection that dies halfway through looks exactly like a short page. HTTP/1.1 has three ways to mark the end of a body:

  • Content-Length: the size in bytes, decimal. Read exactly that many bytes after the empty line. That's what our server did, because it knew the file's size before it started.
  • Transfer-Encoding: chunked: the body is sent in pieces, each preceded by its length, and ended by a zero-length piece. For bodies whose size isn't known in advance.
  • Closing the connection: still allowed for responses, as a last resort, but never for requests, because then the server would have no way to reply.

And some responses never have a body, whatever their headers say: any response to HEAD, and every 1xx, 204 and 304.

Chunked transfer encoding

A server generating a page on the fly, from a database or a template, often doesn't know how long it will be until it's finished. It could build the whole thing in memory first, but then the browser waits for the slowest part before it gets any of it. Chunked encoding lets it send each piece as soon as it's ready:

A chunked response: 101 bytes, 13 of them body

HTTP/1.1 200 OK\r\n
Content-Type: text/plain\r\n
Transfer-Encoding: chunked\r\n
\r\n
7\r\n
Hello, \r\n
6\r\n
world!\r\n
0\r\n
\r\n

Each chunk is its size in hexadecimal, CRLF, that many bytes, CRLF. A chunk of size 0 ends the body, and the final CRLF ends an (empty) list of trailer fields, headers that could only be computed after the body, such as a checksum. The body the application sees is the 13 bytes Hello, world!.

Chunks are a feature of the HTTP/1.1 connection, not of the content: a proxy can receive a response chunked and pass it on with a Content-Length, or the other way round. HTTP/2 and HTTP/3 don't have chunked encoding at all, because their frames already carry lengths; a Transfer-Encoding header in an HTTP/2 message is an error.

Two ways to say one thing

What if a message has both Content-Length and Transfer-Encoding: chunked? RFC 9112 says Transfer-Encoding wins, that such a message "ought to be handled as an error", and that a proxy forwarding it must remove the Content-Length first. The reason for the stern language is that when two programs in a chain disagree about where one request ends, an attacker can hide a second request inside the first. That's request smuggling, and it's in the security section. Framing isn't a detail.

Connections: Keep-Alive, Pipelining and Six at a Time

Our page needs ten requests: the HTML and then nine more. How they share TCP connections has driven most of HTTP's evolution.

HTTP/1.0 opened a new TCP connection for every request, and the server closed it after the response. Every image paid for a three-way handshake, one round trip before any data, and started its congestion window from scratch in slow start, so the connection never got fast before it was thrown away. Browsers and servers soon added an unofficial Connection: keep-alive header to keep the connection open.

HTTP/1.1 made that the default. A connection is persistent unless one side sends Connection: close. The laptop sends a request, reads the response, the length of which it knows from the framing, and sends the next request on the same connection. Servers close idle connections after a while to free resources (nginx's default keepalive_timeout is 75 seconds).

HTTP/1.1 also allowed pipelining: sending several requests in a row without waiting for each response. It would have saved a round trip per request, but responses must come back in the same order as the requests, because nothing in an HTTP/1.1 response says which request it answers.

HTTP/1.0 Keep-alive Pipelining new connection each one at a time all at once, in order TCP GET 1 TCP GET 2 TCP GET 3 TCP GET 1 GET 2 GET 3 TCP 1 2 3 4 round trips 2 round trips, but if response 1 is slow, 2 and 3 wait 0123456 RTT

Pipelining never worked in practice. If the first response is slow, a big image or a page the server takes a second to generate, every response behind it waits, however quick it would have been. That's head-of-line blocking at the HTTP level. Worse, plenty of servers and proxies mishandled pipelined requests, losing or mixing up responses, and a client can't easily tell in advance. Browsers shipped pipelining switched off or not at all; Firefox removed its support in version 54, in 2017. Today only a few non-browser clients use it.

Six connections per origin

So browsers did the obvious thing and opened several connections in parallel, each carrying one request at a time. RFC 2616 asked clients to open no more than two connections to a server. Browsers ignored it, settled on six per origin, and RFC 7230 dropped the number in 2014: it now just asks clients to be "conservative". The six is still what Chrome, Firefox and Safari use for HTTP/1.1.

Six connections means six handshakes, six slow starts, and six times the server's memory. It also means six congestion windows competing for the same bottleneck. The Congestion Control article explained that TCP shares a link fairly per connection, so a browser with six connections gets six shares against a neighbour's one. And six still wasn't enough for pages with a hundred images, so web developers invented a whole toolbox of workarounds:

  • Domain sharding: spreading images over img1.example.com, img2.example.com and so on, to get six connections to each.
  • Concatenation and sprites: gluing all the scripts into one file, and all the icons into one big image cut up with CSS, so there are fewer requests to make.
  • Inlining: pasting small images straight into the HTML as base64 data URLs.

Every one of them made caching worse. Change one icon and the whole sprite has to be downloaded again. They were hacks around a protocol that could only do one thing at a time per connection, and they're exactly what HTTP/2 set out to make unnecessary.

Caching: the Fastest Request Is the One You Don't Send

The server said Cache-Control: max-age=3600. RFC 9111 defines what that allows. Two kinds of cache can keep a copy of a response:

  • A private cache belongs to one user: the browser's own disk and memory cache.
  • A shared cache serves many users: a CDN's edge servers, a company's proxy, or a reverse proxy in front of the web server.

Freshness

A stored response is fresh until its age exceeds its freshness lifetime. The lifetime comes from Cache-Control: max-age (in seconds), or from s-maxage for shared caches only, or from an older Expires date. If none is given, caches may guess, and RFC 9111 suggests 10% of the time since Last-Modified as a typical heuristic. Our page was served at 09:14:07 with max-age=3600, so until 10:14:07 the browser uses its copy without asking anyone: no DNS, no TCP, no request at all. A shared cache tells later clients how long it has held a response with an Age header.

Validation and 304

After 10:14:07 the copy is stale. It's probably still correct, though, so instead of fetching it again the browser asks a conditional question, using the validator it saved:

The browser asks: 68 bytes

GET / HTTP/1.1\r\n
Host: example.com\r\n
If-None-Match: "6ad0c040-3d5"\r\n
\r\n

"Send the page, unless its ETag is still this one."

The server answers: 202 bytes

HTTP/1.1 304 Not Modified\r\n
Server: nginx\r\n
Date: Sat, 31 Oct 2026 10:20:00 GMT\r\n
Last-Modified: Thu, 15 Oct 2026 12:00:00 GMT\r\n
Connection: keep-alive\r\n
ETag: "6ad0c040-3d5"\r\n
Cache-Control: max-age=3600\r\n
\r\n

"Still the same. Keep using it for another hour." No body.

The 304 saves the 981-byte body, and for a 2 MB photo it would save 2 MB. It can't save the round trip, which is why max-age matters more than validation does. If-Modified-Since, with the Last-Modified date, does the same job as If-None-Match for servers that don't send ETags.

The other directives

Directive Meaning
no-store Don't keep a copy anywhere: banking pages, private data
no-cache Keep it, but revalidate before every use
private Only the user's own browser may store it
public Shared caches may store it, even if normally they wouldn't
s-maxage=N Like max-age, but for shared caches only
immutable It will never change; don't revalidate even on reload
stale-<wbr>while-<wbr>revalidate=N Serve stale for N more seconds while refreshing in the background

no-cache is the one everyone gets wrong: it means "check first", not "don't cache". The big trick of modern sites combines two of these. Put a hash of the file's content in its name, app.3f9a1c.js, and serve it with max-age=31536000, immutable; a new version gets a new name, so the old one never needs to be revalidated. The HTML that refers to it gets no-cache.

Vary

A cache stores responses by URL, but a URL can have several representations. Vary lists the request headers the choice depended on, and a cache only reuses a stored response for a request that matches on all of them. Vary: Accept-Encoding keeps a Brotli-compressed page from being served to a client that only understands gzip. Vary: User-Agent makes a response almost uncacheable, since nearly every browser version sends a different one.

Cookies: state on a stateless protocol

Every HTTP request stands on its own. Nothing in the protocol links the second request on a connection to the first, and requests from one user may arrive on different connections, at different servers behind a load balancer. That statelessness is why HTTP scales so well, and why caches and proxies can work at all. But a shopping basket needs state.

Cookies, invented at Netscape in 1994 by Lou Montulli and now specified in RFC 6265 (2011), add it from the outside. The server sends Set-Cookie: session=8f2c41; Secure; HttpOnly; SameSite=Lax, and the browser sends Cookie: session=8f2c41 with every later request to that site. The server looks the value up to find the basket. Secure keeps the cookie off plain HTTP, HttpOnly hides it from JavaScript, and SameSite limits when other sites can cause it to be sent. The Web Authentication article in the Encryption series covers sessions and their attacks properly. For caching, the rule is simple: a response that depends on a cookie should be private.

HTTPS: the Same Messages, Encrypted

Everything so far crossed the network in plain text. The café's Wi-Fi, the ISP, and every router on the path from the routing articles could read the page and the request, and change either one. HTTPS is HTTP inside TLS, the protocol the Encryption series takes apart. The scheme https means: connect to port 443, run a TLS handshake, check the server's certificate for the host name, and then send exactly the same HTTP messages through the encrypted channel. To an observer, the bytes after the handshake are indistinguishable from random.

Three pieces of TLS matter specifically to HTTP:

  • SNI (Server Name Indication, first specified in RFC 3546, 2003). The client puts the host name in its first handshake message, the ClientHello, so that a server hosting many sites can choose the right certificate. It's the TLS version of the Host header, and it was the last piece needed for HTTPS virtual hosting. SNI is sent in clear, so an observer still learns the site name; Encrypted Client Hello hides it, with keys published in the DNS HTTPS record.
  • ALPN (Application-Layer Protocol Negotiation, RFC 7301, 2014). The ClientHello also lists the protocols the client speaks, and the server picks one in its reply, inside the same handshake, at no extra cost. curl shows it: ALPN: curl offers h2,http/1.1, then ALPN: server accepted h2. That's how a browser and a server agree to use HTTP/2 without an extra round trip, and why, in practice, HTTP/2 only ever runs over TLS: no browser supports unencrypted HTTP/2.
  • HSTS (HTTP Strict Transport Security, RFC 6797, 2012). The first request to http://example.com goes out in plain text, and an attacker on the path can answer it instead of letting it upgrade to HTTPS. A site that sends Strict-Transport-Security: max-age=31536000; includeSubDomains over HTTPS tells the browser to use HTTPS for the next year, whatever the user types. That still leaves the very first visit exposed, so browsers ship a built-in preload list of sites that have asked to be HTTPS-only from the start.

The cost of HTTPS over TCP is time. TCP's handshake takes one round trip, and TLS 1.3 takes another before the request can go out. TLS 1.2 took two. We'll count them properly in the HTTP/3 section, because saving those round trips is half of what QUIC is for.

HTTP/2: One Connection, Many Streams

By 2009 the average page was making dozens of requests, and Google started experimenting with a replacement for the HTTP/1.1 wire format called SPDY, announced that November. It kept HTTP's meaning and changed everything about how it was written down: binary frames instead of text lines, many requests interleaved on one connection, and compressed headers. Chrome and Google's servers spoke it within a year, and other browsers followed. In 2012 the IETF's HTTP working group took SPDY as the starting point for HTTP/2, published as RFC 7540 in May 2015, with header compression in RFC 7541. RFC 9113 replaced RFC 7540 in June 2022. Browsers dropped SPDY itself in 2016.

Frames

An HTTP/2 connection is a sequence of frames, and every frame starts with the same 9-byte header. Here's the one in front of the laptop's request:

012345678 9 … 00000d 0105 00000001 82 87 41 88 … Length: 13 Type: 1 Flags: 05 Stream: 1 Payload 24 bits, payload size HEADERS END_STREAM 0x01 + END_HEADERS 0x04 1 reserved bit + 31 bits 13 bytes of HPACK Every HTTP/2 frame starts with these 9 bytes; stream 0 means the connection itself.

The length says how much payload follows, up to 16,384 bytes unless the receiver allows more. The type says what the frame is. The flags are per-type bits. The stream identifier says which request and response the frame belongs to. The frame types are:

Type and name Carries
0x0 DATA Body bytes for one stream
0x1 HEADERS A compressed header block; opens a stream
0x3 RST_STREAM Cancel one stream, leave the connection open
0x4 SETTINGS Connection parameters, and their acknowledgement
0x5 PUSH_PROMISE Server push (see below)
0x6 PING Measure RTT, check the connection is alive
0x7 GOAWAY Shutting down; last stream I'll process
0x8 WINDOW_UPDATE Flow control: you may send N more bytes
0x9 CONTINUATION The rest of a header block too big for one frame

(Type 0x2, PRIORITY, belonged to RFC 7540's priority scheme, which RFC 9113 deprecated. Browsers now signal priority with a simpler Priority header, RFC 9218.)

Compare the TCP article's framing section: HTTP/1.1 found the end of the head with a delimiter and the end of the body with a length or with chunks. HTTP/2 puts a length on everything. There's nothing to scan for and nothing to disagree about.

Streams and multiplexing

A stream is one request and its response. The client numbers its streams with odd numbers, 1, 3, 5 and so on, never reusing one, and a stream ends when each side has sent a frame with the END_STREAM flag. Because every frame names its stream, frames from different streams can be interleaved on the one connection:

HEADERS  stream 1   GET /
HEADERS  stream 3   GET /style.css
HEADERS  stream 5   GET /photo1.jpg
DATA     stream 3   (CSS, part 1)
DATA     stream 5   (photo, part 1)
DATA     stream 3   (CSS, part 2)  END_STREAM
DATA     stream 5   (photo, part 2)
…

That's multiplexing. The laptop can ask for all nine resources the moment it has parsed the HTML, on the one connection it already has, and the server can send them back in whatever order they're ready. A slow response no longer holds up a fast one, so the HTTP-level head-of-line blocking of pipelining is gone. So is the need for six connections, domain sharding, sprites and concatenation. One connection also means one congestion window, which grows big and stays big, instead of six small ones.

Each stream and the connection as a whole have a flow-control window, which starts at 65,535 bytes and is raised by WINDOW_UPDATE frames, just like TCP's receive window from the TCP article. It exists so that one huge download can't fill the receiver's buffers and starve every other stream.

The connection, byte by byte

Over HTTPS, the TLS handshake has already agreed on h2 with ALPN. The first thing the laptop sends through the encrypted channel is the 24-byte connection preface, a fixed string chosen so that an HTTP/1.1 server that receives it by mistake fails cleanly:

The client's first 89 bytes

# connection preface, 24 bytes
50 52 49 20 2a 20 48 54  PRI * HT
54 50 2f 32 2e 30 0d 0a  TP/2.0..
0d 0a 53 4d 0d 0a 0d 0a  ..SM....
# SETTINGS: 12 bytes, flags 0, stream 0
00 00 0c 04 00 00 00 00 00
00 02 00 00 00 00   ENABLE_PUSH = 0
00 04 00 60 00 00   INITIAL_WINDOW_SIZE
                    = 6,291,456
# WINDOW_UPDATE: 4 bytes, stream 0
00 00 04 08 00 00 00 00 00
00 ef 00 01         increment 15,663,105
# HEADERS: 13 bytes, flags 05, stream 1
00 00 0d 01 05 00 00 00 01
82 87 41 88 2f 91 d3 5d 05 5c 87 a7 84
# SETTINGS with the ACK flag
00 00 00 04 01 00 00 00 00

PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n looks like a request with a made-up method, "PRI" and "SM", which spell PRISM, the surveillance programme revealed while HTTP/2 was being written; it's widely read as a wry nod. Then a SETTINGS frame: each setting is a 2-byte identifier and a 4-byte value. This client turns server push off and raises every stream's flow-control window to 6 MB; a browser might send several more. The WINDOW_UPDATE on stream 0 raises the whole connection's window from 65,535 by 15,663,105 bytes, to 15 MB. Then the request itself, and, once the server's SETTINGS arrive, an empty SETTINGS frame with the ACK flag (0x01) to say "got them". The client doesn't wait for the server's settings before sending its request.

The 13-byte payload of the HEADERS frame is the whole request: :method GET, :scheme https, :authority example.com, :path /. HTTP/2 moves the request line into four pseudo-header fields, whose names start with a colon, and Host becomes :authority. Every field name must be lower case. The 37 bytes of HTTP/1.1 have become 13. Here's how.

HPACK: Compressing the Headers

SPDY compressed headers with zlib, the DEFLATE compressor. It worked well, and in 2012 it turned out to be a security hole: the CRIME attack showed that an attacker who could make a browser send requests containing chosen text, and could see the size of the encrypted result, could recover a secret cookie one character at a time, because a guess that matched the cookie compressed better. So HTTP/2 got a compressor designed to be boring and safe: HPACK, RFC 7541. It has three tools.

A static table of 61 common fields, the same for everyone, chosen from the headers popular websites sent most often. A field that's in it, name and value, is sent as a single index. Some entries have only a name.

Index Name Value
1 :authority
2 :method GET
4 :path /
7 :scheme https
8 :status 200
24 cache-control
28 content-length
31 content-type
33 date
34 etag
54 server

A dynamic table, starting empty, which both ends build up identically as headers are sent. A field sent "with incremental indexing" is added at index 62, pushing older entries up. The table is limited to 4,096 bytes by default, with each entry counting as its name's and value's length plus 32, and the oldest entries fall out when it fills.

A Huffman code, a fixed one built from the statistics of real headers, which the sender may use on any string literal if it makes it shorter. Most lower-case letters and digits get 5 or 6 bits; rare bytes get up to 30.

The request, decoded

The first byte of each field says how it's represented, using prefix bits:

  1. 82: indexed, entry 2

    1000 0010. A first bit of 1 means "indexed field": the remaining seven bits are a table index. Entry 2 is :method GET. One byte.

  2. 87: indexed, entry 7

    :scheme https. One byte.

  3. 41 88 2f 91 d3 5d 05 5c 87 a7: a literal, to be remembered

    41 is 01 000001: a first two bits of 01 mean "literal with incremental indexing", and the remaining six bits name entry 1, :authority, so only the value follows. 88 is 1 0001000: the top bit says the string is Huffman-coded, and its length is 8 bytes. Those 8 bytes decode to example.com, 11 characters in 62 bits, plus two padding bits of 1. Both ends now add :authority example.com to their dynamic tables, at index 62.

  4. 84: indexed, entry 4

    :path /. One byte.

The Huffman bits for example.com are 00101 1111001 00011 101001 101011 101000 00101 010111 00100 00111 101001: an e is 5 bits, an x, being rarer, 7. Padded to a byte boundary with 1s, they're 2f 91 d3 5d 05 5c 87 a7.

The payoff comes with the next request. When the laptop asks for /style.css on the same connection, :authority example.com is already in the dynamic table:

82                             :method GET
87                             :scheme https
be                             :authority, entry 62
44 87 61 09 f5 41 57 22 11     :path /style.css

be is 1 0111110, index 62. The new path is a literal with the name :path (index 4, 44) and a Huffman-coded value, 7 bytes for 10 characters. Twelve bytes. With a real browser's 600 bytes of headers, almost all of which are the same on every request, the second request on a connection shrinks to a few dozen bytes. That's what HPACK was for.

The response, decoded

The server's answer is a HEADERS frame and a DATA frame on stream 1:

# HEADERS: 110 bytes, END_HEADERS, stream 1
00 00 6e 01 04 00 00 00 01
88 76 84 aa 63 55 e7 61 96 …
# DATA: 981 bytes, END_STREAM, stream 1
00 03 d5 00 01 00 00 00 01
3c 21 64 6f 63 74 79 70 …   <!doctyp…

There's no Connection header: HTTP/2 forbids connection-specific fields, because the connection is managed by frames. The other nine fields compress like this:

Field Encoded as Bytes (HTTP/1.1 → HPACK)
:status 200 88, static entry 8 17 → 1
server nginx 76, name entry 54, Huffman value 15 → 6
date … 61, name entry 33, Huffman, 29 → 22 37 → 24
content-type … 5f 92, name entry 31, Huffman, 24 → 18 40 → 20
content-length 981 5c 03, name entry 28, plain 981 21 → 5
last-modified … 6c 96, name entry 44, Huffman 46 → 24
etag … 62 8b, name entry 34, Huffman, 14 → 11 22 → 13
cache-control … 58 89, name entry 24, Huffman, 12 → 9 29 → 11
accept-ranges bytes 52 84, name entry 18, Huffman 22 → 6

The 275-byte head has become 110 bytes. 981 went out as plain text, because its Huffman code is 17 bits and wouldn't save a byte: the encoder only uses Huffman when it helps. The eight literal fields all went into the dynamic table (:status 200 was a static hit), so when the stylesheet's response follows on stream 3, with the same server, date, modification time and cache policy, most of its fields are a single byte each: 88 c5 c4, then a literal for content-type text/css, and so on. Its whole header block is 33 bytes.

Checked against a real implementation

Every byte in this section was produced by a small encoder written for this article and then fed to Node.js's built-in http2 module, which uses the nghttp2 library: the raw client bytes above to an HTTP/2 server, and the server's frames to an HTTP/2 client. Both decoded the headers exactly. Node's own client, asked for the same page, encodes it as 84 41 88 2f 91 d3 5d 05 5c 87 a7 87 82: the same fields, in a different order.

HPACK's defence against CRIME is that it never compresses across fields the way DEFLATE does. A field either matches a table entry exactly or doesn't, so an attacker learns at most whether a whole guess was right. Fields like cookies and authorisation tokens can also be sent "never indexed", a representation starting 0001, which tells every intermediary never to put them in a table.

Build a request or a response and see it three ways: as HTTP/1.1 text, as HTTP/2 frames with every HPACK field explained, and as HTTP/3 with QPACK. With Same connection ticked, each message you send is remembered, so the next one is compressed against the dynamic tables it left behind. Or switch to Decode and paste a message.

Examples from the article

The message

The request's Host field comes from the authority. Content-Length isn't added for you: if it disagrees with the body, the HTTP/1.1 view says so. With Transfer-Encoding: chunked, a | in the body marks where one chunk ends and the next begins. Never index credentials sends cookie and authorization fields with HPACK's never-indexed representation.

The connection

The message

The dynamic table after this

The bytes


    

What HTTP/2 didn't fix

Server push let a server send responses the client hadn't asked for yet, with a PUSH_PROMISE frame: "you'll want /style.css, here it is". It sounded ideal and was almost never a win in practice. The server couldn't know what the browser already had in its cache, so it often pushed bytes that were thrown away, and only a small fraction of sites ever used it. Chrome turned it off by default in version 106, in 2022, and Firefox removed it in version 132, in October 2024. Its replacement is 103 Early Hints, an interim response that just names the resources, so the browser can fetch the ones it doesn't have.

The bigger problem is underneath. HTTP/2 multiplexes many streams over one TCP connection, and TCP delivers one ordered byte stream. If a single segment is lost, carrying part of one photo, TCP holds back everything after it until the retransmission arrives, including complete frames for the stylesheet and the other five photos. The browser can't see them: they're sitting in the kernel's receive buffer, and the kernel won't hand them over out of order. The TCP article described exactly this. HTTP/2 removed head-of-line blocking at the HTTP level and left it at the TCP level, and with all the streams on one connection, one lost packet now stalls the whole page instead of one of six connections. On a lossy mobile link, HTTP/2 can be slower than HTTP/1.1. Fixing that meant replacing TCP.

HTTP/3: HTTP over QUIC

At Google, Jim Roskind designed QUIC in 2012, and Chrome began using it with Google's servers in 2013. It's a new transport protocol, with connections, reliable streams, flow control and congestion control, that runs inside UDP datagrams. The UDP article explained why it's built on UDP rather than as a new IP protocol: middleboxes block anything they don't recognise, and TCP lives in operating system kernels that take years to change. The IETF took QUIC on in 2016, reworked it heavily, and published it as RFC 9000 in May 2021, with TLS integration in RFC 9001 and loss detection and congestion control in RFC 9002. "HTTP over QUIC" was renamed HTTP/3 in 2018, and was published as RFC 9114 in June 2022, with its header compression, QPACK, in RFC 9204.

The UDP article already followed the first packet of such a connection: from the laptop's port 52114 to 203.0.113.80:443, which R1's NAT recorded as a UDP flow.

Streams without head-of-line blocking

QUIC carries many independent streams in one connection, and it knows about them. Each QUIC packet holds frames, and a STREAM frame says which stream its bytes belong to and at what offset. When a packet is lost, QUIC retransmits its frames, and meanwhile delivers everything else it has received, for every other stream, straight to the application. Only the streams that lost data wait.

On the wire HTTP/2, TCP HTTP/3, QUIC delivers in order only delivers per stream 1 3 5 3 ✕ 1 5 3 1 5 1 1 3 5 1 5 3 1 5 1 1 3 5 1 5 3 1 5 1 lost grey: received, but waiting for the retransmission Coloured: handed to the browser at once. Numbers are stream IDs (shown as 1, 3, 5 for both).

(QUIC actually numbers a client's request streams 0, 4, 8 and so on: the bottom two bits of a stream ID say who opened it and whether it's bidirectional. The diagram keeps one numbering for both rows.)

QUIC also took over everything else TCP did. It has its own packet numbers, which never repeat, even for retransmissions, so there's no ambiguity about which copy an ACK refers to. Its ACKs can describe many gaps at once, like SACK without the limits of TCP options. And its loss detection and congestion control live in the QUIC library, inside the browser and the server software, rather than in the kernel. That's the move the Congestion Control article pointed to: a browser can ship a new congestion controller with its next release, which also means each implementation must get it right on its own.

One round trip, or none

QUIC builds TLS 1.3 into its own handshake, instead of running it on top. The transport and cryptographic handshakes happen in the same packets, so a new connection is ready after one round trip:

TCP + TLS 1.3 QUIC, new connection QUIC, 0-RTT laptopserver laptopserver laptopserver SYN SYN-ACK ACK, ClientHello ServerHello … Finished Finished, GET 200 OK Initial: ClientHello ServerHello … Finished Finished, GET 200 OK ClientHello + GET ServerHello … + 200 OK 3 RTT to the first byte 2 RTT 1 RTT

On a 100 ms path, HTTPS over TCP with TLS 1.3 gets the first byte of the page after about 300 ms, HTTP/3 after 200 ms. (Plain HTTP over TCP, our port-80 example, takes 200 ms too, with no encryption at all.)

On a repeat visit, the client can remember a key from the previous connection and send its request in the very first flight, encrypted with it: 0-RTT. The page starts arriving after a single round trip. The catch is the one the TCP article found with TCP Fast Open: 0-RTT data can be replayed by an attacker who copies the first packet. Browsers therefore generally send only safe requests like GET in 0-RTT, and a server that doesn't want to risk a particular one can answer 425 Too Early (RFC 8470), telling the client to send it again after the handshake. TLS 1.3 over TCP has 0-RTT too, but the TCP handshake still costs its round trip first.

QPACK

HTTP/3 can't use HPACK as it is. HPACK's dynamic table assumes every header block arrives in the order it was sent, because each one may add entries the next one refers to. On one TCP connection that's guaranteed. Over QUIC's independent streams it isn't: if stream 4's headers refer to an entry that stream 0's lost packet was going to add, stream 4 is stuck after all, and head-of-line blocking is back.

QPACK (RFC 9204) keeps the static table, much bigger now at 99 entries, and the same Huffman code, but moves dynamic table updates onto a separate one-way encoder stream. A header block says up front how many table insertions it depends on, and the decoder acknowledges insertions on a decoder stream. An encoder that never wants a request to wait can stick to entries the decoder has already acknowledged. By default, a peer's dynamic table has a capacity of zero until it says otherwise, so the first request uses the static table only. Here's the laptop's request as an HTTP/3 HEADERS frame:

The request over HTTP/3: 17 bytes on stream 0

01                       frame type: HEADERS
0f                       length: 15
00 00                    QPACK prefix: no dynamic
                         table entries needed
d1                       :method GET (static 17)
d7                       :scheme https (static 23)
50 88 2f 91 d3 5d 05 5c 87 a7
                         :authority (static name 0)
                         + Huffman "example.com"
c1                       :path / (static 1)

d1 is 11 010001: 1 for "indexed", a second 1 for "the static table", and index 17. 50 is 0101 0000: a literal with a name reference to static entry 0. The value is the same 8 Huffman bytes as in HPACK. Frame lengths in HTTP/3 are QUIC variable-length integers, whose top two bits give their size: one byte up to 63, two bytes up to 16,383. There's no END_STREAM flag: the request ends where QUIC's stream ends.

The response comes back on the same stream, as a HEADERS frame, 01 40 5a and a 90-byte QPACK block, then a DATA frame, 00 43 d5 and the 981 bytes of HTML; 40 5a is 90 and 43 d5 is 981 as variable-length integers. The QPACK static table even has content-type: text/html; charset=utf-8 and accept-ranges: bytes as complete entries, one byte each. Each side also opens a one-way control stream carrying its SETTINGS, plus the QPACK encoder and decoder streams. QUIC handles flow control and stream cancellation itself, so HTTP/3 needs no WINDOW_UPDATE or RST_STREAM frames of its own.

Finding HTTP/3, and keeping it

A browser that's never visited a site doesn't know whether it speaks HTTP/3, and it can't just try: a firewall may silently drop UDP to port 443. There are two ways to find out:

  • Alt-Svc (RFC 7838, 2016). The server, answering over HTTP/2 or HTTP/1.1, says alt-svc: h3=":443"; ma=86400: "this origin is also available over HTTP/3 on UDP port 443, and you can remember that for a day". The browser tries QUIC for later requests, usually racing it against TCP, the way Happy Eyeballs races IPv6 against IPv4.
  • The DNS HTTPS record. The DNS article put one in example.com's zone: HTTPS 1 . alpn="h3,h2" ipv4hint=203.0.113.80 ipv6hint=2001:db8:113::80. A browser that looks it up alongside the A and AAAA records knows before connecting that HTTP/3 works, and can go straight to QUIC on the very first visit.

QUIC connections are identified by connection IDs chosen by each end, not by the four-tuple of addresses and ports that identifies a TCP connection. That makes connection migration possible: when the laptop moves from Wi-Fi to a phone's hotspot and gets a new address, it keeps using the same connection from the new address. The server checks the new path with a PATH_CHALLENGE frame and carries on. A TCP connection would simply die. The same feature rescues the connection when a NAT changes the mapping under it: the NAT article showed R1 expiring an idle UDP mapping after 120 seconds, and if the laptop's next packet leaves from a new outside port, the server sees the same connection ID and carries on.

How much of the web uses it?

Measure Share
Requests to Cloudflare in 2025 over HTTP/3 21%
… over HTTP/2 50%
… over HTTP/1.x 29%
Websites supporting HTTP/3, W3Techs, October 2026 41.2%

Those numbers measure different things. W3Techs counts websites that offer HTTP/3, and most sites behind a big CDN get it switched on for them. Cloudflare's counts actual requests, which include the many clients, from API libraries to bots and older devices, that only speak HTTP/1.1 or HTTP/2, and browsers that fall back to TCP when UDP is blocked. Either way, HTTP/3 is a large and growing part of the web, and HTTP/1.1 and HTTP/2 aren't going anywhere: every HTTP/3 server also has to serve them.

Head-of-Line Blocking, Three Ways

It's time to put the three versions side by side, loading the same page over the same lossy path: the HTML, then its stylesheet, script, logo and six photos, about 383 kB in all.

  • HTTP/1.1 opens up to six connections, each paying for its own TCP and TLS handshakes and its own slow start, and sends one request at a time on each. Ten requests over six connections means some wait for a connection to come free. A lost packet stalls one connection, and the one response on it.
  • HTTP/2 uses one connection with all ten streams interleaved. Nothing waits for a free connection, and the single congestion window grows quickly. But a lost packet stalls every stream until TCP's retransmission arrives, which takes at least a round trip, longer if the retransmission timer has to fire.
  • HTTP/3 uses one QUIC connection, a round trip quicker to set up, and a lost packet stalls only the stream whose data it carried.

The page from this article: the HTML, then its stylesheet, script, logo and six photos, about 383 kB, all requested together once the HTML has arrived. Every version sends about 1,400 bytes per packet through the same bottleneck, starts each connection's congestion window at 10 packets, doubles it every round trip and halves it on a loss. A loss is noticed when three later packets arrive, or after max(200 ms, 2 RTT), and the retransmission arrives one round trip after that. The same packets are lost in all three runs. Requests and handshakes are never lost.

The path

Watch it

Losses and recoveries

Start with no loss, at 20 Mb/s and a 100 ms round trip. HTTP/2 loads the page in 864 ms on one connection, as fast as HTTP/1.1 manages with six (861 ms), and HTTP/3 beats both by the handshake round trip it saves, at 764 ms, or 664 ms on a repeat visit with 0-RTT. Now lose one packet. HTTP/2's streams all stop together: six of them stall, for 605 ms of stalled time between them, while over HTTP/1.1 and HTTP/3 only the one stream that lost data waits, for 102 ms. That's the head-of-line difference, and it shows in the stall times and in when each stream finishes.

The total page-load time tells a subtler story. HTTP/3's lead over HTTP/2 under loss (768 against 868 ms here, 943 against 1,043 ms at 2% loss) is mostly the handshake round trip again, because both put every stream behind one congestion window, and a loss halves it for all of them. And in this model HTTP/1.1 often finishes first: 929 ms at 2% loss, ahead of HTTP/3 as well as HTTP/2. Six connections start with six congestion windows, 60 packets in flight instead of 10, and a loss halves only one of them. That's the per-connection unfairness from the Congestion Control article, working in the page's favour and against everyone else on the link, and it's why browsers cap the number of connections. The simulator is a simplified model, without real congestion controllers, pacing or prioritisation, so read it for the shape of the effects rather than as a verdict on which version is faster on real networks.

HTTP in Practice

curl

curl speaks all three versions and will tell you everything with -v:

curl -sv http://example.com/ -o /dev/null
curl -sv --http1.1 https://example.com/ -o /dev/null
curl -sv --http2 https://example.com/ -o /dev/null
curl -sv --http3 https://example.com/ -o /dev/null
curl -sI https://example.com/          # HEAD: headers only
curl -s -o /dev/null -w '%{http_version}\n' \
     https://example.com/

--http2 offers h2 in ALPN and falls back to HTTP/1.1 if the server declines; --http3 tries QUIC and falls back to TCP; --http3-only doesn't fall back. (HTTP/3 needs a curl built with QUIC support; curl --version lists HTTP3 among its features if yours has it.) Over HTTP/2, the verbose output shows the pseudo-headers before the familiar-looking request:

* ALPN: curl offers h2,http/1.1
* SSL connection using TLSv1.3 / …
* ALPN: server accepted h2
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://example.com/
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: example.com]
* [HTTP/2] [1] [:path: /]
> GET / HTTP/2
> Host: example.com
>
< HTTP/2 200
< server: nginx
< date: Sat, 31 Oct 2026 09:14:07 GMT
…

The > GET / HTTP/2 lines are curl translating the frames back into HTTP/1.1 style so that they're easy to read: nothing like them crosses the wire. Note the lower-case field names and the missing reason phrase. Over HTTP/3 it says [HTTP/3] [0], stream 0.

Browser developer tools

Every browser's developer tools have a Network panel listing each request, and it's the best way to watch the versions at work. Right-click the column headers to add Protocol, which shows http/1.1, h2 or h3 for each request. The timing breakdown for a request splits it into queueing (waiting for a connection, the HTTP/1.1 six-connection limit at work), DNS lookup, initial connection, TLS, request sent, waiting for the first byte, and content download. A page loaded over HTTP/1.1 shows a staircase of requests waiting their turn; the same page over HTTP/2 shows them all starting together. To see the actual frames, Chrome's chrome://net-export and Firefox's about:logging record them, and Wireshark can decrypt HTTPS captures if the browser is started with the SSLKEYLOGFILE environment variable naming a file for it to write its session keys to.

What's really answering

In practice, the laptop rarely talks to the program that made the page. Between them there's usually some of:

  • A CDN (content delivery network), whose edge servers in hundreds of cities answer from their caches and only forward misses to the origin. They're reached through DNS answers and anycast routes, as in the DNS and BGP articles.
  • A load balancer spreading requests over many servers.
  • A reverse proxy such as nginx, HAProxy, Caddy or Envoy, which terminates TLS, serves static files, compresses responses, and passes everything else to the application.

Each of these is a full HTTP endpoint, and each hop can speak a different version. A typical large site speaks HTTP/3 and HTTP/2 to browsers at the edge, and HTTP/1.1 or HTTP/2 over private connections to the servers behind it. Because the server only sees the proxy's address, proxies add a Forwarded (RFC 7239) or X-Forwarded-For header with the client's, much as R1's NAT hides the laptop behind 198.51.100.23.

When Framing Goes Wrong

Request smuggling

Picture a front-end proxy and a back-end server sharing one persistent connection, forwarding requests from many users. Each must work out where one request ends and the next begins, and the framing rules give two answers: Content-Length and Transfer-Encoding. If an attacker sends a request carrying both, and the proxy believes one while the server believes the other, the two disagree about where the request ends. The tail of the attacker's request, which the proxy thought was body, is read by the server as the start of the next request, and gets glued onto whatever the next user sends. That's HTTP request smuggling. It can bypass the proxy's security checks, poison its cache, or capture another user's request.

It was described by researchers from Watchfire in 2005, then largely forgotten until James Kettle of PortSwigger showed in 2019 that it worked against a startling number of real sites. Variants exploit proxies that translate HTTP/2 to HTTP/1.1 for the back end. The defences are the strict rules in RFC 9112: treat a message with both headers as an error, close the connection after it, reject anything ambiguous, and, best of all, use the same parser, or HTTP/2 with its explicit frame lengths, all the way through.

HTTP/2 Rapid Reset

HTTP/2's multiplexing has a cost of its own. A server limits how many streams a client may have open at once with SETTINGS_MAX_CONCURRENT_STREAMS, typically 100 or 128. But a client can open a stream and cancel it straight away with RST_STREAM, and a cancelled stream no longer counts against the limit, while the server may already have started the work. In August 2023, attackers used exactly that, opening and resetting streams as fast as they could send frames, from botnets of modest size. Google measured a peak of more than 398 million requests per second, Cloudflare 201 million and Amazon 155 million, all record-breaking. The flaw, CVE-2023-44487, was disclosed by the three companies together on 10 October 2023, and servers now limit how quickly a client may reset streams. A feature that made the protocol efficient for honest clients made it efficient for attackers too.

The Whole Journey

This is the last article in the series, and the 37-byte request we've just decoded is the same one the series has followed since its first page. Here's everything that had to happen for the laptop to get its 1,256 bytes back.

Laptop Switch R1 R2 R3 R4 Server 192.168.10.10 VLAN 10 NAT to198.51.100.23 ISP edge ISP core datacentre 203.0.113.80 DHCP · Ethernet · VLANs · STP · ARP · DNS OSPF inside the ISP BGP between networks end to end: IP · TCP or QUIC · TLS · HTTP · congestion control
  1. Getting on the network

    The laptop joined VLAN 10 and asked for an address. R1's DHCP server gave it 192.168.10.10/24, a default gateway and a DNS server, both 192.168.10.1 (DHCP). It also gave itself an IPv6 address from R1's Router Advertisements (IPv6). The mask told it that 203.0.113.80 wasn't on its own subnet, so the packets would go to the gateway (IPv4 Addressing).

  2. Frames across the house

    Every packet left the laptop as an Ethernet frame (Ethernet), addressed to R1's MAC address, which the laptop had found by broadcasting an ARP request (ARP). The switches learned where everyone lived, tagged the frames for VLAN 10 on their trunks (VLANs), and kept their redundant cables from looping thanks to the Spanning Tree protocol. The Layers article showed the envelopes inside envelopes that every one of those frames is.

  3. A name becomes an address

    The browser needed example.com's address. A 29-byte query went to R1 in a UDP datagram (UDP), and R1's forwarder passed it to the ISP's resolver, which found the answer from the root, .com and example.com's own servers: 203.0.113.80, plus an HTTPS record advertising HTTP/3 (DNS).

  4. A connection, through the NAT

    The laptop sent a SYN from port 47130 to port 80 and completed the three-way handshake (TCP). On its way out, R1 rewrote the source to 198.51.100.23 and recorded the mapping, so the replies could find their way back (NAT).

  5. Across the Internet

    R2, R3 and R4 each looked up the destination in their routing tables, picked the longest matching prefix, decremented the TTL and passed the packet on (Routing Basics). Those tables were filled in by routing protocols: inside the ISP by OSPF, which floods link states instead of counting to infinity like the distance-vector protocols before it, and between the ISP and the hosting company by BGP.

  6. The request, and the answer

    The laptop sent 37 bytes: GET / HTTP/1.1 and Host: example.com. The server sent 1,256 bytes back in one segment, paced by its congestion window (Congestion Control), and the browser found nine more things to fetch. Over HTTPS, HTTP/2 or HTTP/3, the bytes change, but the meaning doesn't.

Every one of those steps is a protocol someone designed to solve one problem, usually decades ago, and nearly all of them still run on every page load, in a few hundred milliseconds, billions of times a day.

Key Takeaways

  • HTTP is requests and responses: a method, a target and header fields; a status code, header fields and a body. HTTP/0.9 (1991) was one line; HTTP/1.0 (RFC 1945, 1996) added versions, status codes and headers; HTTP/1.1 (RFC 2068, 2616, 7230–7235, now 9112) added Host, persistent connections, chunked bodies and caching.
  • Since 2022, RFC 9110 defines what HTTP means and RFC 9111 how caching works, for every version. HTTP/1.1 (RFC 9112), HTTP/2 (RFC 9113) and HTTP/3 (RFC 9114) are three ways of writing the same messages down.
  • The laptop's request is 37 bytes: GET / HTTP/1.1\r\nHost: example.com\r\n\r\n. The server's response is a 275-byte head (status line, nine fields, empty line) and a 981-byte body: 1,256 bytes, one TCP segment, seq 3558738488, ack 1798279658.
  • Safe methods (GET, HEAD, OPTIONS) change nothing; idempotent ones (those plus PUT and DELETE) can be retried. Status classes: 1xx informational, 2xx success, 3xx redirection, 4xx client error, 5xx server error. Host enables name-based virtual hosting; HTTP/1.1 requests without it get a 400.
  • HTTP/1.1 bodies end by Content-Length, by chunked encoding (hex sizes, a 0 chunk at the end) or by closing the connection. Ambiguous framing enables request smuggling, so a message with both headers is treated as an error.
  • Persistent connections are the default in HTTP/1.1; pipelining failed because responses must come back in order. Browsers open six connections per origin, which costs handshakes and per-flow fairness, and led to sharding, sprites and concatenation.
  • Caching: max-age makes a response fresh; stale ones are revalidated with If-None-Match or If-Modified-Since, and 304 Not Modified saves the body. no-cache means revalidate, no-store means don't keep; Vary names the request headers a response depends on. Cookies add state to a stateless protocol.
  • HTTPS is HTTP inside TLS on port 443. SNI names the site in the handshake, ALPN negotiates h2 or http/1.1 at no cost, and HSTS (with the preload list) keeps browsers off plain HTTP.
  • HTTP/2 frames have a 9-byte header (length, type, flags, stream ID) after a 24-byte preface. Streams multiplex many requests on one connection. HPACK uses a 61-entry static table, a dynamic table and a Huffman code: the request is 13 bytes, 82 87 41 88 2f 91 d3 5d 05 5c 87 a7 84, the next one 12, the response head 110 and then 33. Server push is gone from browsers; TCP head-of-line blocking remains.
  • HTTP/3 runs on QUIC over UDP 443: independent streams so a loss stalls only its own stream, congestion control in the application, a combined 1-RTT handshake and replayable 0-RTT. QPACK keeps dynamic table updates on separate streams; the request is a 17-byte HEADERS frame. Alt-Svc and the DNS HTTPS record advertise it; connection IDs allow migration. In 2025, 21% of Cloudflare's requests used HTTP/3.

That's the series. It started with a single request wrapped in envelopes and has opened every one of them: the frame, the address, the route, the transport, the name, and finally the 37 bytes the whole thing was for. The next time a page takes a moment to load, you'll know what's happening in that moment, and on which of the machines between you and the server.