I'm teaching myself how to make a rudimentary HTTP server, and I've recently learned about Transfer-Encoding: chunked
. I understand that each chunk reports its own size, but all of the documentation I can find seems to indicate that Content-Length
on the initial response is only useful for a standard response body, and is ignored for chunked content, making it effectively impossible for a client to know the size of a chunked response body until it's finished.
However, nearly every file I've ever downloaded in my time on the internet has somehow reported its size to the browser ahead of time, so it's clearly not only possible, but common, to the point where it's odd not to.
Is this (non-standard?) behavior common HTTP clients implement, reading the Content-Length
(or some other) header as an indicator of total chunked length, or something else entirely?
Asked
Active
Viewed 98 times
0

JMA
- 334
- 1
- 9