Response body length
The HTTP body response length can be determined a few different ways. The simplest is if the HTTP server includes a Content-Length header line in its response. In that case, the server simply states the body length directly.
If the server would like to begin sending data before the body's length is known, then it can't use the Content-Length header line. In this case, the server can send a Transfer-Encoding: chunked header line. This header line indicates to the client that the response body will be sent in separate chunks. Each chunk begins with its chunk length, encoded in base-16 (hexadecimal), followed by a newline, and then the chunk data. The entire HTTP body ends with a zero-length chunk.
Let's consider an HTTP ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access