linuxlab.io
Tutorials▾
  • Linux & networking
    File system, processes, TCP/IP, BGP and OSPF
    →
  • Terraform & IaC
    HCL, state, plan/apply on a LocalStack sandbox
    →
  • Git & GitHub
    Object model, plumbing, branching, GitHub Actions
    →
All tutorials →
PricingAboutSign inCreate account
/
  • Introduction
  • Lessons
  • How it works
  • Simulator
  • Knowledge base
  • Interview prep
Index
Categories
All entries
Footer
linuxlab-TutorialsPricingAboutPrivacy & cookies
Copyright © 2026 LinuxLab. All rights reserved.
home/linux/kb/Networking: L4 and above/http-protocol

kb/network-l4 ── Networking: L4 and above ── intermediate

HTTP/1.1, HTTP/2, HTTP/3

HTTP/1.1 is a text-based protocol with keep-alive. HTTP/2 is binary with multiplexing over a single TCP connection. HTTP/3 carries HTTP/2 semantics over QUIC/UDP without TCP head-of-line blocking.

view as markdownaka: http, http-versions, http1

Why three versions

HTTP is an application-layer protocol on top of [[tcp-handshake|TCP]] (or [[udp-basics|UDP]] in HTTP/3). It has been revised twice to address accumulated performance problems. The versions are negotiated at connection time through [[tls-handshake|TLS]] ALPN: client and server agree on a version during the handshake.

HTTP/1.1 (1997)

Text-based request/response. Each exchange is a single request and response separated by CRLF delimiters:

GET /api/users HTTP/1.1
Host: example.com
User-Agent: curl/8.0
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 42
{"users":[{"id":1,"name":"alice"}]}

Key features:

  • Host header - one IP, many virtual hosts
  • Keep-alive - reuse a TCP connection for multiple requests (on by default)
  • Chunked transfer encoding - stream a response without knowing Content-Length in advance
  • Pipelining - send requests without waiting for responses (disabled in practice due to HoL blocking, see below)

Main pain point with HTTP/1.1:

  • One request at a time per connection (L7 head-of-line blocking)
  • Browsers open 6+ TCP connections to the same host to download in parallel
  • Headers repeat in every request (cookies, user-agent, ...)

HTTP/2 (2015): binary multiplexing

The same GET /api/users request works, but the format is binary:

  • One TCP connection carries many streams (logical channels)
  • Streams are multiplexed: frames from different requests interleave
  • HPACK compresses headers; repeated cookies and tokens are sent as an index, not a full string
  • Server Push lets the server send resources before the client requests them (deprecated in practice, rarely useful)
  • Stream priority lets you tell the server "this CSS matters more than that image"

In practice: one TCP socket per host instead of six, headers compressed, parallel requests do not block each other at L7.

However, if a TCP packet is lost, all streams on that connection stall until retransmission completes. That is TCP head-of-line blocking. HTTP/2 does not solve it; it only makes it more visible.

HTTP/3 (2022): QUIC replaces TCP

Same binary semantics as HTTP/2, but the transport is QUIC over UDP:

  • Each stream is independent: a lost packet in one stream does not block the others (no TCP HoL)
  • Handshake takes 1 RTT (or 0 RTT for resumed connections) because TLS is built into QUIC
  • Connection migration: switching networks (Wi-Fi to 4G) does not break the connection; QUIC binds to a Connection ID, not to the 5-tuple
  • Encryption is mandatory

Drawbacks of HTTP/3:

  • UDP is often rate-limited by firewalls and load balancers
  • Harder to observe (no native netstat equivalent for QUIC until recently)
  • Requires ALPN h3 over TLS 1.3

Comparison

PropertyHTTP/1.1HTTP/2HTTP/3
TransportTCPTCPQUIC/UDP
Formattextbinarybinary
Multiplexingnoyesyes
Head-of-line blockingL4 + L7L4 (TCP)none
Header compressionnoHPACKQPACK
TLSoptionaloptionalrequired
Server Pushnoyes*yes*

*deprecated, not used in practice

What you see in tcpdump

bash
# HTTP/1.1: plaintext visible
tcpdump -i any -nn -A 'tcp port 80'
# HTTP/2: binary, but ALPN marker 'h2' is visible in ClientHello
tcpdump -i any -nn 'tcp port 443' -X
# HTTP/3: UDP on port 443
tcpdump -i any -nn 'udp port 443'

Which version to use in 2026

  • CDN / edge - HTTP/3 for users on Wi-Fi, HTTP/2 as fallback
  • Internal API - HTTP/2 (one long-lived connection, gRPC runs over it)
  • Legacy / simplicity - HTTP/1.1, parseable from any language in two lines of code

When things go wrong

  • HTTP/2 RST_STREAM rapid reset - DDoS vector from 2023; patched in nginx/envoy
  • QUIC blocked by firewall - falls back to HTTP/2 via Alt-Svc
  • HPACK bomb - malicious Huffman-encoded headers via compression; keep your server up to date
  • Header size limit - HTTP/2 defaults to 16 KB of headers; a large request will fail unless you raise the limit

§ команды

bash
curl -v --http1.1 https://example.com/

Force HTTP/1.1 and see the request/response in plain text.

bash
curl -v --http2 https://example.com/

Use HTTP/2 and look for 'using HTTP2' in the output along with stream IDs.

bash
curl -v --http3 https://example.com/

Use HTTP/3 (requires curl built with QUIC support via --with-quic).

bash
openssl s_client -alpn h2,http/1.1 -connect example.com:443 < /dev/null 2>&1 | grep -i alpn

Show which ALPN protocol the server selected (h2 vs http/1.1).

bash
ss -tnH state established '( sport = :443 )' | head

List active TLS connections. Does not distinguish HTTP versions, but shows how many connections are open.

§ см. также

  • tcp-handshakeTCP three-way handshakeTCP connection opens with three packets: SYN from the client, SYN-ACK from the server, ACK from the client. After that the connection is Established and data transfer can begin.
  • tls-handshakeTLS HandshakeTLS is the encryption layer above TCP. Before data flows, both sides run a handshake: they exchange keys, verify the certificate, and agree on a cipher.
  • websocketWebSocket: Bidirectional Channel over HTTPWebSocket is a bidirectional channel over a single TCP connection. The upgrade from HTTP/1.1 uses the Upgrade header; after that, both sides exchange binary frames. Typical use cases: real-time UI, chats, dashboards, live updates.
  • http2-internalsHTTP/2: Binary Framing, HPACK, Stream MultiplexingHTTP/2 is binary multiplexing over a single TCP connection. HPACK compresses headers through an indexed dictionary. Streams are independent. Server push is deprecated. On a loss-prone link, HoL blocking is a real problem, solved by QUIC.
  • cmd-curlcurl: HTTP client from the terminal`curl` is a CLI for HTTP, HTTPS, FTP, and more. Send requests, inspect headers, certificates, and timing. The primary tool for REST API debugging.
  • quic-http3QUIC: Modern Transport over UDPQUIC is a transport over UDP. TLS 1.3 is built in (1 RTT, 0-RTT for resume). Multiplexing without head-of-line blocking. Connection migration (Wi-Fi to 4G without drop). HTTP/3 = HTTP semantics over QUIC.
Footer
linuxlab-
Copyright © 2026 LinuxLab. All rights reserved.
Tutorials
Pricing
About
Privacy & cookies