Is the Content-Length
header required for a HTTP/1.0 response? The HTTP spec mentions that it is required for the request, but doesn't mention anything about the response:
http://www.w3.org/Protocols/HTTP/1.0/draft-ietf-http-spec.html#Content-Length
A valid Content-Length field value is required on all HTTP/1.0 request messages containing an entity body.
If it is not required for the response, how does the client read the response when it's larger than 1MB?
Section 10.4 of the spec (which you linked to) doesn't say anything about requirements on responses itself, but instead links to section 7.2.2, which specifies that the server can indicate the length of a response containing an entity body by
Content-Length
header, orSection 7.2 says that responses to
HEAD
requests, and 1xx, 204 or 304 responses, should not include an entity body, and therefore need not include aContent-Length
header; andSo to answer the question: When no
Content-Length
is received, the client keeps reading until the server closes the connection.