L3 · NetworksNetworking 101 · part 4 of 7

HTTP/2 and HTTP/3: Same Requests, Different Wire

A GET request still means the same thing. What changed twice is how it travels: HTTP/2 put every request on one TCP connection, and HTTP/3 moved everything onto QUIC to fix the one problem HTTP/2 couldn't.

Takumi Yamada
· 10 min read · 3 references
networkinghttphttp2http3quictcpprotocols

In How the Internet Delivers a Packet, the request at the end of the trip looked like this.

GET / HTTP/1.1
Host: negensystems.com

That's a real , called HTTP/1.1, and it's from 1997. Your browser rarely uses it with a public website today.

Instead, it uses (Hypertext Transfer Protocol)/2 or HTTP/3. Neither one changed what a request means. Methods like GET, status codes like 200, and all work exactly as before. What changed, twice, is how requests are sent over the network.

HTTP/2 changed how requests are packaged. HTTP/3 changed the connection they travel on. Both had the same goal: less waiting.

What was wrong with HTTP/1.1

HTTP/1.1 is plain text, and a connection handles one request at a time. You send a request, and you wait for the whole response before that connection can do anything else.

A modern page needs dozens of files: HTML, scripts, stylesheets, images and fonts. Fetching them one after another is slow. So browsers settled on opening about six connections to each site and using them side by side.

conn 1index.htmlapp.jsconn 2style.csslogo.svgconn 3font.woff2conn 6hero.jpg…request 7waits for a connection to come freetime
Six connections, each busy with one file at a time.

Each of those connections needs its own (Transmission Control Protocol) and (Transport Layer Security) . Each one also starts slowly, because TCP raises its sending speed carefully on every new connection. And six is still not many.

So web developers worked around the protocol. They joined many scripts into one big file, packed many small icons into one image, and spread their files across several names to get six more connections for each. All of these tricks existed because each request was expensive.

HTTP/1.1 did have a fix on paper, called pipelining. It let a browser send several requests without waiting. But the responses still had to come back in the order they were asked for, so one slow response held up all the others. Browsers ended up turning it off.

That problem has a name: head-of-line blocking. It comes back later in this post, one layer further down.

HTTP/2: one connection, many streams

HTTP/2 grew out of a Google experiment called SPDY, and became a standard in 2015. Its idea is to stop opening more connections, and to share one connection properly instead.

The text is replaced by small binary pieces called frames. Every frame starts with a 9- header.

length0type3flags4stream id59then the payloadbytewhich request this frame belongs to
The header in front of every HTTP/2 frame, to scale.

The last field is the important one. A stream is one request and its response, and every frame says which stream it belongs to. So frames from different streams can be mixed together on the same connection and sorted out again at the other end. This is called multiplexing.

ON THE WIREone connectionHEADERSstream 1HEADERSstream 3HEADERSstream 5DATAstream 3DATAstream 1DATAstream 5DATAstream 3DATAstream 1SORTEDby stream idstream 1HEADERSDATADATAstream 3HEADERSDATADATAstream 5HEADERSDATA
Eight frames from three requests on one connection. The stream number on each frame is what lets the other end sort them back out.

A hundred requests can be in progress at the same time. A slow response no longer holds up a fast one, because the fast one's frames simply pass it.

The request itself looks a little different too.

:method: GET
:scheme: https
:authority: negensystems.com
:path: /
accept: text/html

The old first line of the request became four special headers that start with a colon, and Host became :authority. Everything else is an ordinary header with a lowercase name. The meaning is the same. Only the way it's written changed.

Three more features are built on top of the frames.

Header compression. Requests to the same site send almost the same headers every time, including . HPACK (HTTP/2 Header Compression) keeps a table of headers that both sides have already seen. Instead of the full header, it sends its row number in the table, so a repeated header shrinks to a byte or two.

FIRST REQUESTsent in fullcookie: session=8f3ac19e07d25be432 bytesTABLE KEPT BY BOTH SIDES62cookie: session=8f3ac19e07d25be4NEXT REQUESTsent as a row number621 bytemeans: the header in row 62
A header is sent in full once. After that both sides have it in a table, and its row number is enough.

Flow control for each stream. Each stream gets its own limit on how much can be sent, as well as one for the whole connection. So one large download can't use up the connection and leave nothing for the rest.

Priorities. The browser can say which responses it needs first. For example, the stylesheet the page needs before it can be drawn goes out before an image at the bottom of the page.

One feature didn't last. Server push let a send files before the browser asked for them. In practice, it kept sending files the browser already had, and Chrome removed it in 2022.

Choosing HTTP/2 doesn't cost an extra round trip. During the TLS handshake, the browser lists the protocols it understands, in a part of the handshake called ALPN (Application-Layer Protocol Negotiation), and the server picks one. HTTP/2's name in that list is h2. The standard also allows HTTP/2 without TLS, but no browser supports that, so in practice HTTP/2 always means (Hypertext Transfer Protocol Secure).

Once requests are cheap, the old tricks start to cost more than they save. Spreading files over several domain names now slows a page down, because each name means one more connection to set up.

The problem HTTP/2 could not fix

HTTP/2 removed head-of-line blocking from HTTP. But it put every stream on one TCP connection, and TCP has the same problem one layer down.

TCP knows nothing about streams. It sees one long, ordered row of bytes. If one is lost, TCP holds back everything that arrived after it, until the missing packet has been sent again. That's the behaviour described in TCP vs UDP, and Why It Matters, and here it really hurts.

ON THE WIREone TCP connectionDATAstream 1DATAstream 3DATAstream 5DATAstream 1DATAstream 3DATAstream 5DATAstream 1DATAstream 5LOSTdeliveredstreams 1 and 5 lost nothing,and are held back anyway
One lost packet for stream 3. TCP holds back the packets behind it, whichever stream they belong to.

One lost packet stops every stream on the connection, including streams that lost nothing.

On a good fibre line, packets are rarely lost, so this hardly matters. On a mobile connection that loses packets often, one HTTP/2 connection can be slower than HTTP/1.1's six connections. With six connections, a lost packet only held up a sixth of the page.

The obvious fix would be to teach TCP about streams, and that can't be done. TCP is built into , and into the and (Network Address Translation) devices between you and the server. Many of those devices inspect TCP packets and throw away anything they don't recognize. Changing TCP takes a decade, when it works at all.

HTTP/3: move the streams into the transport

The way out was to stop using TCP.

QUIC (Quick Internet Connections) is a new transport protocol, built on top of UDP (User Datagram Protocol). Like TCP, it's reliable, delivers data in order, and controls its speed. Unlike TCP, it knows about streams. HTTP/3, which became a standard in 2022, is HTTP carried over .

HTTP/2TLSTCPIPHTTP/3QUICwith TLS insideUDPIPstreams, reliability,congestion controland encryption
QUIC takes over the jobs of TCP and TLS, and runs on UDP.

Streams moved out of HTTP and down into the transport, and four things follow from that.

A lost packet only affects its own streams. QUIC keeps each stream in order separately. A lost packet only delays the streams that had data in it, and every other stream keeps going.

Setting up is faster. TCP needs one round trip for its handshake, and TLS 1.3 needs another. QUIC does both at once.

REQUESTREQUESTTCP + TLS 1.3BROWSERSERVERSYNSYN-ACKACK, hello, keyshello, keys, certificateGET /two round trips before the requestQUICBROWSERSERVERhello, keyshello, keys, certificateGET /one round trip before the request
The first request over each stack. The outlined span is the request itself.

When a browser returns to a server it has used before, it can even put the request in its very first packet. This is called 0-RTT, meaning zero round trips. There is one risk. An attacker who records that first packet can send it again, so servers should only accept 0-RTT requests that are safe to repeat, such as reading a page.

Connections survive a change of network. A TCP connection is identified by two IP (Internet Protocol) addresses and two ports. When you walk out of Wi-Fi range, your phone's address changes, and every TCP connection breaks. A QUIC connection is identified by a connection ID inside its packets, so it carries on over mobile data without starting again.

on Wi-Fiafter moving to mobile dataTCPnamed by addressesWi-Fi IP, server IP, 2 portsmobile IP, server IP, 2 portsthe address changed, so it is a different connection and has to start againQUICnamed by an IDconnection IDconnection IDthe ID travels inside the packets, so the same connection carries on
What identifies a connection in each protocol, before and after the address changes.

Almost everything is encrypted. There is no unencrypted QUIC. Even most of QUIC's own bookkeeping, such as packet numbers, is hidden from the network. That protects your privacy. It also stops network devices from starting to depend on QUIC's details, the way they did with TCP.

Header compression had to be redesigned too. HPACK assumes that frames arrive in order, which TCP guaranteed and QUIC doesn't. Its replacement for HTTP/3 is called QPACK.

How a browser finds out

A (Uniform Resource Locator) says https. It says nothing about the HTTP version.

With HTTP/2 that was easy, because the answer came during the TLS handshake. HTTP/3 can't work that way. It uses a different transport, so the browser has to choose between TCP and UDP before it sends its first packet.

The usual answer is that the server announces HTTP/3 on the first visit, in a response header.

$ curl -sI https://negensystems.com | grep -i alt-svc
alt-svc: h3=":443"; ma=2592000

That header means: "HTTP/3 is available on UDP 443, and you can remember this for thirty days". So the first visit to a site usually uses HTTP/2, and later visits use HTTP/3. There is also a (Domain Name System) record type called HTTPS that gives the same hint, so even the first visit can use QUIC.

FIRST VISITnothing known yetBROWSERSERVERHTTP/2 over TCPalt-svc: h3=":443"the browser remembers the hint for thirty daysLATER VISITShint rememberedBROWSERSERVERHTTP/3 over QUIC, UDP port 443
The first visit carries the hint, and later visits use it.

Browsers prepare for both cases. Some networks block all UDP traffic except DNS, so the browser keeps TCP ready as a fallback and uses whichever one works.

Seeing it yourself

Open your browser's developer tools, go to the Network tab, and turn on the Protocol column. You'll see h2, h3 or http/1.1 next to every request.

In a terminal, you can tell curl which version to use.

$ curl -sI --http2 https://negensystems.com | head -1
HTTP/2 200

$ curl -sI --http3 https://negensystems.com | head -1
HTTP/3 200

The second command needs a version of curl built with HTTP/3 support. Run curl --version and look for HTTP3 in the list of features.

There's a third way that needs no tools at all. The trace on the home page of this site reads the protocol from your own browser, and shows the version that carried the page to you.

What it takes to serve them

For this site, almost nothing. Caddy, the web server in front of the site, supports all three versions by default. The only lines in the whole setup that exist for HTTP/3 open UDP port 443: once in the Compose file, and once in the firewall.

ports:
  - "80:80"
  - "443:443"
  - "443:443/udp"
ufw allow 443/tcp
ufw allow 443/udp

Forgetting the UDP line is the classic mistake, and it fails quietly. Nothing breaks. Browsers fall back to TCP, and the site stays on HTTP/2 without a single error.

There's a detail here that's easy to miss. The Go server behind Caddy never sees HTTP/3, or HTTP/2 either. Caddy handles the QUIC connection itself, and passes each request on to Go as plain HTTP/1.1 inside the server.

So the HTTP version only applies to one step of the trip, not to the whole request. That's why the browser (Application Programming Interface) that reports it is called nextHopProtocol, meaning the protocol of the next step. It's also why the Go code never had to change. A request arrives with a method, a path and headers, and nothing in it says how it travelled.

BROWSERHTTP/3CADDYends QUIC hereHTTP/1.1GO SERVERa plain requestone hop,over the internetanother hop,on the internal network
Two hops, each with its own HTTP version.

The three side by side

HTTP/1.1HTTP/2HTTP/3
Standardized199720152022
On the wireTextBinary framesBinary frames
TransportTCPTCPQUIC over UDP
Requests in parallelOne per connectionMany streams, one connectionMany streams, one connection
Header compressionNoneHPACKQPACK
A lost packet stallsOne connectionEvery streamOnly the streams inside it
Round trips before the request221, or 0 on return
OptionalRequired by browsersAlways
Survives a change of networkNoNoYes

HTTP/3 has costs too. QUIC runs inside programs, so it uses more (Central Processing Unit) time per byte than TCP, which is built into the operating system and has had decades of tuning and help from network hardware. QUIC is harder to inspect, because almost nothing in it is readable. And on a fast wired connection that rarely loses packets, you will have trouble measuring any difference from HTTP/2. The gains appear on slow mobile networks that lose packets, which is where many people actually are.

The Bottom Line

HTTP/1.1 made every request expensive, so browsers opened six connections and developers bundled everything together.

HTTP/2 made requests cheap by running many streams over one connection. Then it turned out that TCP underneath still treated them as a single queue.

HTTP/3 fixed that by replacing TCP with QUIC, a transport that knows what a stream is.

As an application developer, you don't choose between them in your code, because your handlers can't tell which one delivered a request. You choose at the server in front, and the right choice is to turn all three on, open UDP port 443, and let each browser use the best one it can reach.

Both upgrades left the layer above unchanged and replaced the layer underneath. That's the layering from the OSI post doing exactly what it was designed to do.

Check yourself

3 questions · nothing is saved
  1. 1.What did HTTP/2 change?
  2. 2.On a mobile connection that loses packets often, why can one HTTP/2 connection be slower than HTTP/1.1's six?
  3. 3.You forget to open UDP port 443 on a server that supports HTTP/3. What happens?

References & Primary Sources

Official specifications, standards, and documentation cited in this post.

  1. [1]

    Hypertext Transfer Protocol Version 3 (HTTP/3) over QUIC

    RFCrfc-editor.org
  2. [2]

    Core transport protocol specification eliminating head-of-line blocking

    RFCrfc-editor.org
  3. [3]

    Binary framing layer and single TCP connection multiplexing

    RFCrfc-editor.org

Who wrote this

Author profile and background

Takumi Yamada

Takumi Yamada

· Backend Engineer

Backend engineer building services, databases, Linux tooling, and NEGEN SYSTEMS. Writing about low-level mechanics, distributed systems, and real-world security.

End of post
NEGEN SYSTEMS
Receipt · post 31 of 31
Written
Sep 30, 2026
Length
2,189 words · 10 min
Built
…
Served by
…
Delivered
…
Over the wire
…
Go's share
…
Next in Networking 101 · part 5 of 7

The OSI Model: Seven Layers, and Why We Only Use Four

The OSI model is networking's best known diagram. Its protocols were never widely used, but its layer names are used everywhere. All seven layers, what actually runs at each one, and how to use them to find problems.

9 min read