The HTTP/1.0 specs state that the server can indicate the length of a response containing an entity body by
- sending a
Content-Length
header, or - closing the connection when the entire response has been sent.
So the Content-Length
header, for normal responses like an image, Html page or Ajax data is optional.
As that header has been provided there are cases in which using it give some benefits.
So the question is: what are those cases and what are the benefits?
(For example: if the response is a file that is being downloaded the browser displays a progress bar if Content-Length
is specified.)