Course map

Topic 028 / Core

HTTP fundamentals: HTTP/1.1, HTTP/2 and HTTP/3

Chapter 3.2 · TLS and HTTP

What and why

TLS (→ 27) secures a byte stream, but applications still need a shared language for requests and responses. HTTP is the application-layer protocol defining that language — methods, status codes, headers, bodies (RFC 9110) — with three versions in production differing in how that language rides on the transport below it: HTTP/1.1 (one request in flight per connection, text framing), HTTP/2 (binary framing, multiplexed streams over one TCP connection), HTTP/3 (the same semantics over QUIC/UDP, RFC 9114). Builds on: → 27.

Diagram

Version Transport Concurrency Head-of-line blocking
HTTP/1.1 TCP one request per connection (often several connections) per connection
HTTP/2 TCP many streams multiplexed on one connection yes — one lost packet stalls every stream, because all streams share one TCP connection
HTTP/3 QUIC/UDP many streams, each with independent loss recovery no — a lost packet only stalls its own stream

How it works

  1. HTTP/1.1 opens one or more TCP connections per host to get any parallelism, sending one request at a time per connection.
  2. HTTP/2 multiplexes many logical streams over a single TCP connection, interleaving frames from each stream.
  3. Because it is still one TCP connection, a single lost packet stalls every multiplexed stream until it's retransmitted — TCP's own head-of-line blocking, just moved up a level.
  4. HTTP/3 replaces TCP with QUIC over UDP, giving each stream its own independent loss recovery, so a lost packet only stalls the one stream it belonged to.
  5. QUIC also folds transport and TLS (→ 27) setup into fewer round trips, shortening the wait before the first request can be sent.
  6. Across all versions, method and status semantics stay the same (RFC 9110): GET and HEAD are safe (no side effects); GET, PUT, and DELETE are idempotent (repeating them has the same effect as doing them once); POST is neither — a distinction this chapter returns to at → 38.

Practical example

(illustrative). A page loading many small resources over HTTP/1.1 either queues behind a small connection limit or opens many connections to get parallelism; the same page over HTTP/2 sends every request as a separate stream on one connection; on a network dropping packets, that one connection's loss stalls all of them, while an HTTP/3 connection loses only the stream whose packet was dropped.

When to use it

  • Use when: HTTP/1.1 with keep-alive is enough for low-traffic, low-concurrency services; HTTP/2 is the sensible default for most modern web traffic; reach for HTTP/3 when measured head-of-line blocking or connection-setup latency on lossy or mobile networks is an actual, observed cost.
  • Avoid when: assuming HTTP/2 "solves" head-of-line blocking — it only removes application-level queuing, not the TCP-level stall from step 3.
  • Failure scenarios: on a sufficiently lossy network, HTTP/2's single shared connection can be slower than several independent HTTP/1.1 connections would have been, because every multiplexed stream shares that one connection's fate.
  • Simpler alternative: HTTP/1.1 with keep-alive — upgrading protocol versions is an infrastructure decision, not a default, until a measured latency problem demands it.

Practice

(mechanism kind — trace/predict-then-verify; 20–30 min, no lab services). First, explain in three sentences, with no undefined jargon, why HTTP/2 multiplexing still stalls on packet loss and how HTTP/3 fixes it. Then verify your own explanation: capture a real request with curl -v --http1.1 and again with curl -v --http2 against a server that supports both, and compare what differs in the connection setup shown in each trace. Done when your three-sentence explanation survives the comparison of the two traces.

Key takeaway

HTTP's semantics (methods, status, headers) stay constant across versions; what changes is how those semantics are carried over the transport, and that choice is what determines behavior under packet loss. Done when you can: explain HTTP/2's head-of-line blocking and why HTTP/3 removes it, without hand-waving the transport difference. Used next in → 29, 31, 32, 33, 40; Project 2 (checklist: redirect status codes, topic 28).

References

RFC 9110: HTTP Semantics — see references.md. RFC 9114: HTTP/3 — see references.md.

Source directory

Search the guide