I. Why Does the HTTP Protocol Need to Keep Evolving?
HTTP (Hypertext Transfer Protocol) is one of the core application-layer protocols in Web systems.
Browsers accessing websites, mobile apps calling APIs, and microservices exchanging data all rely on HTTP.
As internet services have evolved, the problems HTTP faces have also kept changing:
- There are more and more web resources, and a single page may contain hundreds of requests.
- Page content is becoming increasingly complex, with images, scripts, stylesheets, and API requests needing to be loaded concurrently.
- Mobile and wireless network environments are unstable, and network latency and packet loss affect user experience.
- There are a large number of short HTTP requests between microservices.
- Video, real-time communication, and large applications place higher demands on transmission efficiency.
The design of early HTTP could no longer fully meet these demands, so HTTP has evolved through several important versions.
1. HTTP Version Evolution
| Version | Standard release time | Key features |
|---|---|---|
| HTTP/0.9 | Early Web era | Only supports simple GET requests |
| HTTP/1.0 | 1996 | Introduced request headers, response headers, and status codes |
| HTTP/1.1 | 1997 | Persistent connections, Host, chunked transfer, etc. |
| HTTP/2 | 2015 | Binary framing, multiplexing, HPACK |
| HTTP/3 | 2022 | Based on QUIC, QPACK, stream-level isolation |
Among them, HTTP/1.1, HTTP/2, and HTTP/3 are the three versions most worth focusing on in the modern Web.
2. Core Problems Solved by the Three Versions
Their evolution can be summarized in three stages:
flowchart TD
A["HTTP/1.1: Persistent Connections"] --> B["Reduce the cost of repeatedly establishing TCP connections"]
B --> C["HTTP/2: Binary Framing and Multiplexing"]
C --> D["Improve concurrent transmission efficiency over a single connection"]
D --> E["HTTP/3: QUIC Transport"]
E --> F["Improve TCP-level head-of-line blocking and network switching experience"]
style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style B fill:#F6FAF7,stroke:#DCE9E0,color:#334155
style C fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style D fill:#F6FAF7,stroke:#DCE9E0,color:#334155
style E fill:#EAE4F8,stroke:#B7A7D8,color:#51416F
style F fill:#FFF2CC,stroke:#E5C978,color:#765B19
Note that this does not mean HTTP/1.1 cannot handle concurrency at all, nor does it mean HTTP/2 has completely solved all head-of-line blocking problems.
The main difference between the three versions lies in how they manage connections, organize data, and handle transport-layer issues.
II. HTTP/1.1: Persistent Connections and Request Reuse
HTTP/1.1 is an HTTP protocol version that has been widely used for a long time.
Building on HTTP/1.0, it introduced mechanisms such as persistent connections, reducing the performance overhead caused by repeatedly establishing TCP connections.
1. HTTP/1.1 Communication Structure
HTTP/1.1 usually runs on top of TCP.
When HTTPS is used, the protocol stack is as follows:
HTTP/1.1
|
TLS
|
TCP
|
IP
When plain HTTP is used, the TLS layer is not needed:
HTTP/1.1
|
TCP
|
IP
TCP provides reliable byte-stream transmission, and HTTP/1.1 defines the request and response formats on top of it.
2. HTTP/1.1 Text Message Format
HTTP/1.1 expresses the request line, status line, and header fields in text form.
Request example:
GET /api/users HTTP/1.1
Host: example.com
Accept: application/json
User-Agent: Mozilla/5.0
Connection: keep-alive
Response example:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 36
Connection: keep-alive
{"id":1,"name":"Alice","active":true}
A request message mainly contains:
- Request line: request method, target path, and protocol version.
- Request headers: metadata describing the request.
- Blank line: separates the request headers from the request body.
- Request body: optional; carries the actual data.
A response message mainly contains:
- Status line: protocol version, status code, and reason phrase.
- Response headers: describe response metadata.
- Blank line: separates response headers from response body.
- Response body: optional, carries the returned content.
3. The Short Connection Problem
In typical early HTTP/1.0 usage, the TCP connection was usually closed after a request completed.
For example, when a browser visits a page, it needs to load:
- HTML files.
- CSS files.
- JavaScript files.
- Images.
- Font files.
If a separate TCP connection is established for each resource, it incurs significant connection setup and teardown overhead.
Establishing a TCP connection requires a three-way handshake, and closing a connection may also involve multiple packet exchanges.
If HTTPS is used, the cost of the TLS handshake must also be considered.
Therefore, frequently establishing connections increases latency and server resource consumption.
4. Persistent Connections: Keep-Alive
HTTP/1.1 supports persistent connections by default.
Unless the connection is explicitly closed, the client and server can send multiple HTTP requests and responses consecutively over the same TCP connection.
For example:
sequenceDiagram
participant C as Client
participant S as Server
C->>S: Request A
S-->>C: Response A
C->>S: Request B
S-->>C: Response B
C->>S: Request C
S-->>C: Response C
Note over C,S: Multiple requests reuse the same TCP connection
C->>S: Connection: close
S-->>C: Close connection
rect rgb(224,240,254)
Note over C,S: Persistent connections reduce repeated handshakes
end
In HTTP/1.1, persistent connections are usually the default behavior.
If you want to close the connection, you can use:
Connection: close
Note that a persistent connection in HTTP/1.1 does not mean the TCP connection will never be disconnected.
The server can still close the connection based on policies such as idle timeout and resource limits.
5. HTTP/1.1 Request Pipelining
HTTP/1.1 also defines Pipelining, that is, the request pipelining mechanism.
The client can send multiple requests consecutively while waiting for the previous response.
For example:
sequenceDiagram
participant C as Client
participant S as Server
C->>S: Request A
C->>S: Request B
C->>S: Request C
Note over S: Process and organize responses in request order
S-->>C: Response A
S-->>C: Response B
S-->>C: Response C
Its goal is to reduce waiting time between requests.
But HTTP/1.1 pipelining has an important limitation:
The server must return responses in the order in which requests are received.
If the first request takes a long time to process, later requests may have to wait until the earlier response has been sent, even if they have already been processed.
This is the application-layer head-of-line blocking problem in HTTP/1.1.
In addition, browser and server support for pipelining has historically been limited, and in practice multiple TCP connections with concurrent requests are usually used to improve performance.
6. Why Do Browsers Need Multiple TCP Connections?
Because of the response ordering limitation in HTTP/1.1, browsers usually establish multiple TCP connections for the same origin.
For example:
flowchart TD
A["Browser"] --> B["TCP connection 1: Request A"]
A --> C["TCP connection 2: Request B"]
A --> D["TCP connection 3: Request C"]
A --> E["TCP connection 4: Request D"]
B --> F["Server"]
C --> F
D --> F
E --> F
style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style B fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style C fill:#EAE4F8,stroke:#B7A7D8,color:#51416F
style D fill:#FFF2CC,stroke:#E5C978,color:#765B19
style E fill:#F6FAF7,stroke:#DCE9E0,color:#334155
style F fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
Multiple connections can process requests in parallel, reducing queuing waits on a single connection.
But this approach also has costs:
- It uses more TCP connections.
- It consumes server connection resources.
- It increases TCP handshake overhead.
- In HTTPS scenarios, it may increase TLS handshake overhead.
- It may incur additional congestion control overhead across multiple connections.
HTTP/2 was designed specifically to further improve this connection utilization efficiency.
7. Other Important Features of HTTP/1.1
Host Request Header
Supports distinguishing multiple websites on the same IP address via the Host header.
GET / HTTP/1.1
Host: www.example.com
Chunked Transfer Encoding
When the server cannot determine the length of the response body in advance, it can use:
Transfer-Encoding: chunked
The response body is sent in multiple data chunks.
Content negotiation
The client can express its preferences for content format and compression method through request headers such as Accept and Accept-Encoding.
Caching mechanisms
HTTP/1.1 supports cache control mechanisms such as Cache-Control, ETag, and Last-Modified.
Range requests
Using the Range request header, a client can request part of a resource.
For example:
GET /video.mp4 HTTP/1.1
Host: example.com
Range: bytes=0-1023
The server might return:
HTTP/1.1 206 Partial Content
Content-Range: bytes 0-1023/1000000
8. Main limitations of HTTP/1.1
| Problem | How it manifests |
|---|---|
| Text-based protocol | Message parsing must handle text structures |
| Request queuing | Requests and responses on a single connection are subject to ordering constraints |
| Head-of-line blocking | A slow earlier request can block later responses |
| Multi-connection overhead | Browsers need multiple TCP connections to increase concurrency |
| Header duplication | Each request may resend a large number of header fields |
| Complex connection management | Requires handling connection pools, timeouts, and connection reuse |
HTTP/1.1 reduces the overhead of establishing connections through Keep-Alive, but it does not fundamentally solve the problem of inefficient concurrent transmission on a single connection.
III. HTTP/2: Binary Framing and Multiplexing
The core goal of HTTP/2 is to improve the efficiency of HTTP communication.
It preserves HTTP semantics, for example:
- Request methods such as GET and POST.
- HTTP status codes.
- Request headers and response headers.
- Cookies.
- Cache-Control.
- Content-Type.
What changes is how HTTP messages are organized and transmitted over a connection.
The most important change in HTTP/2 is:
Splitting HTTP messages into binary frames and allowing multiple streams to be interleaved over the same connection.
1. The communication structure of HTTP/2
HTTP/2 typically runs on top of TCP.
The structure of HTTPS HTTP/2 communication in a browser:
HTTP/2
|
TLS
|
TCP
|
IP
The protocol identifier for HTTP/2 is usually h2.
Browsers typically negotiate whether to use HTTP/2 via ALPN during the TLS handshake.
2. Why does HTTP/2 use binary framing?
HTTP/1.1 organizes requests and responses in a text format.
HTTP/2, by contrast, organizes data using binary frames.
HTTP/2 divides a message into multiple Frames, each of which contains:
- Frame length.
- Frame type.
- Flags.
- Stream identifier.
- Frame payload.
Common frame types:
| Frame type | Purpose |
|---|---|
| DATA | Transmits the message body |
| HEADERS | Transmits request headers or response headers |
| PRIORITY | Legacy stream priority mechanism, deprecated |
| RST_STREAM | Resets a stream |
| SETTINGS | Exchanges connection-level settings |
| PUSH_PROMISE | Server push related information |
| PING | Checks connection status and round-trip time |
| GOAWAY | Notifies that the connection is about to close |
| WINDOW_UPDATE | Updates the flow-control window |
| CONTINUATION | Continues a long header block |
Binary framing makes the protocol more suitable for machine parsing and also provides the foundation for multiplexing.
3. The core concept of HTTP/2: Stream
HTTP/2 introduces the Stream, that is, a stream.
A Stream represents one independent HTTP request or response exchange.
For example:
flowchart TD
A["HTTP/2 Connection"] --> B["Stream 1: Request A"]
A --> C["Stream 3: Request B"]
A --> D["Stream 5: Request C"]
A --> E["Stream 7: Request D"]
style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style B fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style C fill:#EAE4F8,stroke:#B7A7D8,color:#51416F
style D fill:#FFF2CC,stroke:#E5C978,color:#765B19
style E fill:#F6FAF7,stroke:#DCE9E0,color:#334155
Each stream has its own stream identifier.
Streams initiated by the client usually use odd numbers, and streams initiated by the server usually use even numbers.
The relationship between streams and connections:
- A connection can contain multiple streams.
- A stream consists of multiple frames.
- Frames from different streams can be sent interleaved.
- The receiver reassigns frames to the corresponding stream based on the stream identifier.
4. HTTP/2 Multiplexing
Multiplexing is one of the most important features of HTTP/2.
In HTTP/1.1, responses on the same connection usually need to be processed in the order of requests.
HTTP/2, by contrast, allows data frames from different streams to be transmitted interleaved.
For example:
sequenceDiagram
participant C as Client
participant S as Server
C->>S: Stream 1 Request A
C->>S: Stream 3 Request B
C->>S: Stream 5 Request C
par Multiple streams transmit concurrently
S-->>C: Stream 3 DATA
and
S-->>C: Stream 1 DATA
and
S-->>C: Stream 5 DATA
end
S-->>C: Stream 1 subsequent DATA
Note over C,S: Frames from different streams can be interleaved
Even if the data for Stream 1 has not been fully transmitted, the server can send the data for Stream 3 first.
This avoids the problem in HTTP/1.1 where responses must be returned strictly in request order at the application layer.
5. Comparison of Request Transmission Between HTTP/1.1 and HTTP/2
HTTP/1.1:
sequenceDiagram
participant C as Client
participant S as Server
C->>S: Request A
C->>S: Request B
C->>S: Request C
S-->>C: Response A
S-->>C: Response B
S-->>C: Response C
Note over C,S: Response order is constrained by request order
HTTP/2:
sequenceDiagram
participant C as Client
participant S as Server
C->>S: Stream 1 Request A
C->>S: Stream 3 Request B
C->>S: Stream 5 Request C
par Interleaved responses
S-->>C: Stream 3 DATA
and
S-->>C: Stream 1 DATA
and
S-->>C: Stream 5 DATA
end
Note over C,S: Assign and reassemble data by Stream ID
In this way, HTTP/2 improves the concurrency capability of a single connection.
6. HTTP/2 Header Compression: HPACK
HTTP requests contain a large number of header fields.
For example:
GET /api/users HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0
Accept: application/json
Accept-Encoding: gzip, br
Cookie: session_id=abcdef
If the same headers are sent repeatedly with every request, a considerable amount of redundant data is produced.
HTTP/2 uses HPACK to compress headers.
HPACK mainly uses:
- Static table.
- Dynamic table.
- Huffman encoding.
The static table predefines common header fields and some common values.
The dynamic table stores header fields and values that have already appeared in the connection.
Subsequent requests can reference existing entries, reducing duplicate transmission.
flowchart TD
A["First request"] --> B["Encode header fields"]
B --> C["Create dynamic table entries"]
C --> D["Subsequent request"]
D --> E["Reference existing entries"]
E --> F["Reduce transmitted header data"]
style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style B fill:#EAE4F8,stroke:#B7A7D8,color:#51416F
style C fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style D fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style E fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style F fill:#FFF2CC,stroke:#E5C978,color:#765B19
HPACK is HTTP/2's header compression mechanism.
It does not compress the entire HTTP request body.
Whether the request body is compressed is still determined by the application-layer content encoding mechanism.
7. HTTP/2 Flow Control
HTTP/2 has a flow control mechanism to prevent the sender from sending too much data and causing the receiver to be unable to process it in time.
HTTP/2 uses a window mechanism to control the amount of data sent.
It is mainly divided into:
- Connection-level flow control.
- Stream-level flow control.
The connection-level window controls the data flow of the entire connection.
The stream-level window controls the data flow of a single stream.
After the receiver has processed some of the data, it can increase the sendable window through a WINDOW_UPDATE frame.
flowchart TD
A["Sender prepares to send DATA"] --> B["Check connection-level window"]
B --> C{"Is the connection window sufficient?"}
C -->|No| D["Wait for connection-level WINDOW_UPDATE"]
C -->|Yes| E["Check stream-level window"]
E --> F{"Is the stream window sufficient?"}
F -->|No| G["Wait for stream-level WINDOW_UPDATE"]
F -->|Yes| H["Send DATA frame"]
H --> I["Receiver processes data"]
I --> J["Update connection or stream-level window"]
J --> B
style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style B fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style C fill:#FFF2CC,stroke:#E5C978,color:#765B19
style D fill:#EAE4F8,stroke:#B7A7D8,color:#51416F
style E fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style F fill:#FFF2CC,stroke:#E5C978,color:#765B19
style G fill:#EAE4F8,stroke:#B7A7D8,color:#51416F
style H fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style I fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style J fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
HTTP/2 flow control is a receiver-side protection mechanism; it is not at the same layer as TCP's own flow control.
8. HTTP/2 Priority
Requests in a page are not necessarily equally important.
For example:
- The main HTML document usually has higher priority.
- Above-the-fold CSS may affect page rendering.
- Above-the-fold JavaScript may affect interaction.
- Images below the fold can be loaded later.
HTTP/2 originally defined a stream priority dependency and weight mechanism.
However, the traditional PRIORITY frame mechanism has been deprecated; modern HTTP/2 priority schemes mainly refer to the extensible prioritization mechanism defined in RFC 9218.
It allows the client to express to the server how important a resource is, and the server schedules data transmission according to its actual implementation.
Note: priority is a scheduling hint; it does not mean the server must strictly send data in a fixed order.
9. HTTP/2 Server Push
HTTP/2 once supported Server Push.
The server can proactively push resources to the client before the client explicitly requests them.
For example:
When the browser requests HTML, the server may proactively push CSS files.
sequenceDiagram
participant C as Browser
participant S as Server
C->>S: Request HTML
S-->>C: Return HTML
S-->>C: Push CSS resource
Note over C: Browser receives pushed resource
This can reduce the waiting time for the client to discover the resource and request it again.
But Server Push has some problems:
- The browser may already have cached the resource.
- The pushed resource may not be needed.
- The server may waste bandwidth.
- Push scheduling and cache determination are relatively complex.
Mainstream browsers no longer support the practical use cases of traditional HTTP/2 Server Push.
Therefore, modern web performance optimization usually favors resource preloading, preconnect, and caching strategies.
10. HTTP/2 Still Has Head-of-Line Blocking
HTTP/2 solves the application-layer request queuing problem of HTTP/1.1, but it still runs on top of TCP.
TCP provides an ordered, reliable byte stream.
If a TCP segment is lost, subsequent data that has already arrived may need to wait for the missing data to be retransmitted and delivered in order.
Because multiple HTTP/2 Streams share the same TCP connection, this transport-layer blocking can affect multiple streams.
This is why HTTP/2 still has TCP-layer head-of-line blocking.
flowchart TD
A["HTTP/2 multiple Streams"] --> B["Share a single TCP connection"]
B --> C["A TCP segment is lost"]
C --> D["TCP waits for retransmission of missing data"]
D --> E["Subsequent bytes cannot be delivered in order for now"]
E --> F["Data processing for multiple Streams is affected"]
style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style B fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style C fill:#FCE8E6,stroke:#E5A6A0,color:#8B3A35
style D fill:#FFF2CC,stroke:#E5C978,color:#765B19
style E fill:#EAE4F8,stroke:#B7A7D8,color:#51416F
style F fill:#FCE8E6,stroke:#E5A6A0,color:#8B3A35
This is also an important reason why HTTP/3 adopts QUIC.
4. HTTP/3: A New Generation of HTTP Based on QUIC
HTTP/3 is an important evolutionary version of the HTTP protocol.
Its biggest change is:
It no longer uses TCP as the transport-layer foundation, but instead uses QUIC based on UDP.
HTTP/3 retains the basic semantics of HTTP while redesigning connection management, data transmission, and encrypted handshake methods.
1. Communication Structure of HTTP/3
The protocol stack of HTTP/3:
HTTP/3
|
QUIC
|
UDP
|
IP
HTTP/3 no longer uses the traditional:
HTTP/3
|
TLS
|
TCP
QUIC is based on UDP, but it does not simply place HTTP data directly into UDP datagrams.
QUIC implements a complete set of transport-layer capabilities on top of UDP.
This includes:
- Reliable transmission.
- Congestion control.
- Flow control.
- Multiplexing.
- Packet loss detection.
- Data retransmission.
- Connection management.
- Connection migration.
- TLS 1.3 integration.
Therefore, QUIC should not be simply understood as unreliable UDP communication.
2. Why Does HTTP/3 Use QUIC?
HTTP/2 solves the application-layer request queuing problem.
However, HTTP/2 is still limited by TCP's ordered byte stream.
If a TCP segment is lost, subsequent data in the entire connection may not be delivered promptly.
HTTP/3 mitigates this problem through QUIC's stream-level independent delivery mechanism.
QUIC divides a connection into multiple independent Streams.
Each Stream can perform data transmission and delivery independently.
When data in one Stream is lost, data already fully received in other Streams can continue to be delivered.
3. How Does QUIC Solve TCP-Layer Head-of-Line Blocking?
Assume there are three data streams:
- Stream A.
- Stream B.
- Stream C.
In HTTP/2:
flowchart TD
A["Multiple HTTP/2 Streams"] --> B["Share a single TCP connection"]
B --> C["A TCP segment is lost"]
C --> D["Subsequent data waits for in-order delivery"]
D --> E["Multiple Streams may be affected"]
style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style B fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style C fill:#FCE8E6,stroke:#E5A6A0,color:#8B3A35
style D fill:#FFF2CC,stroke:#E5C978,color:#765B19
style E fill:#EAE4F8,stroke:#B7A7D8,color:#51416F
In HTTP/3:
```mermaid flowchart TD A["Multiple HTTP/3 Streams"] --> B["Multiple independent QUIC Streams"] B --> C{"Is Stream A's data lost"} C -->|Yes| D["Stream A waits for retransmission"] C -->|No| E["Stream A is delivered normally"] D --> F["Stream B continues to be delivered"] D --> G["Stream C continues to be delivered"] E --> F E --> G style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976 style B fill:#DCEFE5,stroke:#8EBFA5,color:#24563F style C fill:#FFF2CC,stroke:#E5C978,color:#765B19 style D fill:#FCE8E6,stroke:#E5A6A0,color:#8B3A35 style E fill:#DCEFE5,stroke:#8EBFA5,color:#24563F style F fill:#EAE4F8,stroke:#B7A7D8,color:#51416F style G fill:#EAE4F8,stroke:#B7A7D8,color:#51416F ``` This is QUIC's ability to isolate head-of-line blocking at the stream level. It needs to be understood precisely: QUIC does not eliminate all blocking entirely. - Data within the same QUIC Stream still has to be delivered in order. - Connection-level congestion control still affects the sending rate of the entire connection. - Packet loss can affect the sending schedule of multiple streams. - Connection-level flow control can also limit multiple streams. What it solves is the cross-stream head-of-line blocking problem caused by TCP's single ordered byte stream. ### 4. QUIC Multiplexing in HTTP/3 Each HTTP request in HTTP/3 is usually mapped to one or more QUIC Streams. The client and the server can transmit multiple requests concurrently over the same QUIC connection. ```mermaid flowchart TD A["QUIC Connection"] --> B["Stream 0: HTTP Request A"] A --> C["Stream 4: HTTP Request B"] A --> D["Stream 8: HTTP Request C"] A --> E["Stream 12: HTTP Request D"] style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976 style B fill:#DCEFE5,stroke:#8EBFA5,color:#24563F style C fill:#EAE4F8,stroke:#B7A7D8,color:#51416F style D fill:#FFF2CC,stroke:#E5C978,color:#765B19 style E fill:#F6FAF7,stroke:#DCE9E0,color:#334155 ``` Unlike HTTP/2, QUIC provides stream-level independent data delivery at the transport layer. HTTP/3 multiplexing relies on QUIC rather than TCP. ### 5. QPACK Header Compression in HTTP/3 HTTP/3 uses QPACK for header compression. HTTP/2 uses HPACK. Both aim to reduce the transmission overhead of repeated header fields, but they are designed differently. | Comparison Dimension | HPACK | QPACK | | --- | --- | --- | | Version used | HTTP/2 | HTTP/3 | | Design goal | Compress header fields | Compress header fields | | Dynamic table | Supported | Supported | | Static table | Supported | Supported | | Huffman encoding | Supported | Supported | | Relationship with the transport layer | TCP byte stream | QUIC multiple streams | Why does HTTP/3 need QPACK instead of using HPACK directly? Because QUIC supports multiple independent Streams. If HPACK's dynamic table synchronization approach were adopted directly, it could introduce unnecessary inter-stream dependencies. QPACK manages dynamic table updates and reference relationships through dedicated encoder and decoder streams, reducing the risk of cross-stream blocking introduced by header compression. The core components of QPACK include: - Static table. - Dynamic table. - Encoder stream. - Decoder stream. - Field representation. ### 6. How Does QUIC Integrate TLS 1.3? QUIC uses TLS 1.3 for authentication and key negotiation. But QUIC does not simply wrap a complete TLS record protocol on top of UDP. It reuses TLS 1.3's handshake messages and key derivation mechanisms, carrying the handshake messages in QUIC CRYPTO frames. QUIC itself is responsible for transport-layer data protection and connection management. The simplified sequence is as follows:sequenceDiagram
participant C as Client
participant S as Server
C->>S: QUIC Initial carries ClientHello
S-->>C: QUIC Initial and Handshake
Note over C,S: Exchange TLS 1.3 handshake messages
C->>S: Subsequent handshake messages
S-->>C: Handshake complete
Note over C,S: Both sides derive transport keys
C->>S: Encrypted QUIC data
S-->>C: Encrypted QUIC data
rect rgb(220,239,229)
Note over C,S: HTTP/3 communicates over the QUIC connection
end
QUIC uses TLS 1.3-derived keys to protect QUIC packets.
Therefore, HTTP/3 does not need an additional traditional TLS record protocol layer on top of QUIC.
7. QUIC Connection Migration
A TCP connection is usually identified by information such as source IP, source port, destination IP, and destination port.
When the client's network changes, for example:
- Wi-Fi switches to a mobile network.
- A mobile network switches to Wi-Fi.
- The network interface changes.
- The client IP address changes.
A traditional TCP connection may need to be re-established.
QUIC uses a Connection ID to identify a connection and can support connection migration when conditions such as path validation are met.
sequenceDiagram
participant C as Mobile client
participant S as Server
C->>S: Establish a QUIC connection over Wi-Fi
S-->>C: Return a connection response
Note over C,S: Both sides use a Connection ID to identify the connection
C->>S: Network switches to a mobile network
Note over C: Client IP address changes
C->>S: Send data using the original Connection ID
S-->>C: Perform path validation
C->>S: PATH_RESPONSE
S-->>C: Validation passes
Note over C,S: Continue using the original connection once conditions are met
This is very valuable for mobile devices and scenarios with frequent network switching.
However, connection migration cannot succeed unconditionally in every case; it is still affected by factors such as the network environment, firewalls, NAT, and server policies.
8. QUIC Congestion Control
QUIC implements congestion control itself.
It needs to dynamically adjust the sending rate according to network conditions to avoid sending too much data and causing network congestion.
Common congestion control algorithms include:
- NewReno.
- CUBIC.
- BBR.
QUIC congestion control needs to handle:
- Packet loss detection.
- Round-trip time estimation.
- Retransmission timeout.
- Congestion window adjustment.
- Probing and recovery.
Note that:
QUIC congestion control is a connection-level mechanism. Although individual streams can deliver data independently, they still share connection-level congestion control resources.
9. HTTP/3 0-RTT
QUIC supports session resumption and 0-RTT data transmission.
If the client has previously established a connection with the server and has saved valid session resumption information, the client may send application data early during the handshake of a new connection.
This can reduce the wait time for some requests.
Simplified process:
sequenceDiagram
participant C as Client
participant S as Server
Note over C,S: Both sides have previously established a QUIC connection
C->>S: Initial carries session resumption information and 0-RTT data
S-->>C: Handshake response
C->>S: Complete the handshake
S-->>C: Confirm that the connection is established
However, 0-RTT has a replay risk.
An attacker may replay early data under certain conditions, so:
- 0-RTT should not be used for operations that are not replay-safe.
- The server needs to decide whether to accept early data based on business semantics.
- For operations such as transfers and order creation, idempotent design and business-level duplicate-prevention mechanisms should be used.
0-RTT is a performance optimization mechanism; it does not mean that all HTTP requests can be safely sent early.
10. Main Advantages of HTTP/3
| Advantage | Description |
|---|---|
| Reduced handshake latency | QUIC is integrated with TLS 1.3 |
| Stream-level isolation | Packet loss on one stream does not have to block data delivery on other streams |
| Connection migration | Can attempt to maintain the connection during network switches |
| Encryption by design | QUIC requires encrypted protection by default |
| Multiplexing | A single connection carries multiple independent streams |
| Header compression | Uses QPACK to reduce redundant data |
| 0-RTT | Sends application data early when conditions are met |
V. Core Differences Between HTTP/1.1, HTTP/2, and HTTP/3
To understand the three versions, you cannot just remember that HTTP/1.1 is a text protocol, HTTP/2 is a binary protocol, and HTTP/3 uses UDP.
What really matters is how they differ in connections, concurrency, transport layer, and security mechanisms.
1. Core Comparison Table
| Comparison aspect | HTTP/1.1 | HTTP/2 | HTTP/3 |
|---|---|---|---|
| Transport foundation | TCP | TCP | QUIC |
| QUIC underlying transport | Not used | Not used | UDP |
| HTTPS | Optional | Usually uses TLS in browsers | Integrates TLS 1.3 |
| Data organization | Text-based messages | Binary frames | Binary frames |
| Multiplexing | Depends on multiple connections | Multiple streams over a single connection | Multiple streams over a single connection |
| Header compression | No dedicated mechanism | HPACK | QPACK |
| Flow control | Provided by TCP | TCP and HTTP/2 flow control | QUIC flow control |
| Application-layer head-of-line blocking | Request pipelining order restrictions exist | Mitigated by multiplexing | Mitigated by multiplexing |
| TCP-layer head-of-line blocking | Present | Present | Does not use TCP |
| Connection migration | No protocol-level support | No QUIC-style migration | Supported |
| Handshake mechanism | TCP; HTTPS additionally uses TLS | TCP; HTTPS additionally uses TLS | QUIC integrates TLS 1.3 |
| Header compression algorithm | None | HPACK | QPACK |
2. Comparison of Data Transmission Methods
HTTP/1.1:
flowchart TD
A["TCP connection"] --> B["HTTP text requests and responses"]
B --> C["Parsed in protocol order"]
style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style B fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style C fill:#F6FAF7,stroke:#DCE9E0,color:#334155
HTTP/2:
flowchart TD
A["TCP connection"] --> B["Binary frames"]
B --> C["Multiple Streams transmitted interleaved"]
C --> D["Reassembled based on Stream ID"]
style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style B fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style C fill:#EAE4F8,stroke:#B7A7D8,color:#51416F
style D fill:#F6FAF7,stroke:#DCE9E0,color:#334155
HTTP/3:
flowchart TD
A["UDP datagrams"] --> B["QUIC connection"]
B --> C["Multiple independent QUIC Streams"]
C --> D["HTTP/3 frames"]
D --> E["HTTP message reassembly"]
style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style B fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
style C fill:#EAE4F8,stroke:#B7A7D8,color:#51416F
style D fill:#FFF2CC,stroke:#E5C978,color:#765B19
style E fill:#F6FAF7,stroke:#DCE9E0,color:#334155
3. Comparison of Head-of-Line Blocking
Head-of-line blocking is key to understanding the differences between the three versions.
| Version | Application-layer head-of-line blocking | Transport-layer head-of-line blocking |
|---|---|---|
| HTTP/1.1 | Request pipelining order restrictions exist | TCP in-order delivery |
| HTTP/2 | Mitigated by multiplexing | TCP packet loss may block multiple streams |
| HTTP/3 | Mitigated by multiplexing | QUIC provides independent stream-level delivery |
HTTP/3 does not eliminate all blocking.
It primarily eliminates cross-stream head-of-line blocking caused by TCP's single byte stream.
4. Comparison of Handshake Processes
HTTP/1.1 + HTTPS: