Labs / Speaking Protocols / HTTP, TLS & mail

Lab 3 of 4 · HTTP, TLS & mail

HTTP/1.1, HTTP/2 and HTTP/3

Compare HTTP versions: ALPN picks one, HTTP/2 shares a connection, HTTP/3 rides QUIC.

Open this lab Pro 5 steps

The idea

Three HTTP versions, one request: what changes on the wire from HTTP/1.1 to HTTP/2 and HTTP/3. The laptop fetches pages through homeRouter from webServer, which speaks all three on Port 443.

Parallel requests
Parallel requests
Round trips before the first byte
Round trips before the first byte

Steps

  1. HTTP/2: the same request, in frames

    Text lines are slow for a machine to parse, so HTTP/2 sends the same request as binary frames over one TCP connection. Fetch the page over HTTP/2, then with nghttp, which prints what crosses the wire.

    laptop:~# curl -sv --http2 https://webServer.lab/
    laptop:~# nghttp -nv https://webServer.lab/
  2. Six files: six connections, or one

    A page needs many files, and each new connection costs a handshake before its first byte. curl fetches six style sheets at once over HTTP/1.1 while the laptop counts new TCP connections. Then fetch the same six over HTTP/2.

    laptop:~# curl -s --http1.1 -Z -o '/tmp/#1.css' -w '%{http_version}\n' 'https://webServer.lab/assets/{1,2,3,4,5,6}.css'
    laptop:~# curl -s --http2 -Z -o '/tmp/#1.css' -w '%{http_version}\n' 'https://webServer.lab/assets/{1,2,3,4,5,6}.css'

Pro

3 more steps in the app

  1. HTTP/3: the same streams over QUIC
  2. Finding HTTP/3, and falling back
  3. When UDP 443 is blocked
Get Pro

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab