There is a chunked way of transferring data in HTTP, also known as “chunked transfer”. It is represented by the header field Transfer-Encoding: chunked in the response message. It means that the body part of the message is not sent at one time, but is divided into many chunks and sent one by one. And the HTTP2.0 protocol, as an upgrade of the HTTP protocol, naturally supports the chunked mode? otherwise!
HTTP2 is not chunked!
Chunked transmission can also be used for “streaming data”, such as form pages dynamically generated by the database. In this case, the length of the body data is unknown, and the exact length cannot be given in the header field “Content-Length”. Therefore, it can only be sent in chunks in chunked mode.
chunked encoding rules
- Each block contains two parts, the length header and the data block;
- The length header is a line of plaintext ending with CRLF (carriage return and line feed, or rn), and the length is represented by a hexadecimal number;
- The data block follows the length header and ends with CRLF, but the data does not contain CRLF;
- Finally, end with a block of length 0, that is, “0rnrn”
Chunked transfer under HTTP2
Let’s start with the conclusion, HTTP2 is not supported
…
The post Transfer-Encoding under HTTP2: chunked first appeared on Lenix Blog .
This article is reprinted from https://blog.p2hp.com/archives/9747
This site is for inclusion only, and the copyright belongs to the original author.