How to determine content-data length from chunked encoding if HTTP header not sent
12,965
With chunked encoding there will be no Content-Length header. So after you've read the headers and the pair of CRLFs that mark the end of the headers, you're ready to read the first chunk. Each chunk payload is preceded by its own mini-header - the length in hex followed by CRLF. And there's another CRLF after the payload, before the next chunk's mini-header. A chunk can also be followed by some optional trailers. The end of the message is indicated by a zero-length chunk.
You can find the definitive details in the HTTP RFC, RFC2616.
![Mohamad Elmasri](https://i.stack.imgur.com/O6eSl.jpg?s=256&g=1)
Author by
Mohamad Elmasri
Updated on June 07, 2022Comments
-
Mohamad Elmasri about 2 years
How to determine the content-data length if the header is not sent and instead you receive
Transfer-Encoding: chunked
header? -
Whome about 11 yearsOld topic but here is my answer giving an example with RequestHeaders+ChunkedBody+AfterHeaders and optional extension keypair within a chunk size. stackoverflow.com/a/16460234/185565