Senior
In HTTP/1.1, binary data can be transmitted in the request body — so what is the fundamental difference with HTTP/2?
sobes.tech AI
Answer from AI
Although in HTTP/1.1 binary data can be transmitted in the request body, the fundamental difference in HTTP/2 lies in the way data is transmitted and the organization of the connection:
- HTTP/2 uses a binary protocol instead of the text-based HTTP/1.1. This allows for more efficient encoding and parsing of messages.
- In HTTP/2, data is broken into frames, which are multiplexed over a single TCP connection. This eliminates the head-of-line blocking problem at the HTTP level.
- Headers in HTTP/2 are compressed using HPACK, reducing the amount of data transmitted.
Example: in HTTP/1.1, each request opens a separate connection or uses pipelining with limitations, whereas in HTTP/2, multiple requests and responses are transmitted in parallel over a single connection, improving performance and reducing latency.