Reputation: 34300
A web application under test behaves in an odd way. A HEAD
request returns the header Content-Length
, but the consequent GET
returns Transfer-Encoding: chunked
. I expected the headers to be equal, and RFC says SHOULD, so my question is: how legit and how common is this behaviour?
UPDATE It turns out, that the root cause of the problem is HAProxy's behaviour. If that's a HEAD
request, the response is propagated as is from the application underneath. But for GET
it applies the compression and sets the chunked transfer. I'll close this question as an off-topic and perhaps will ask at ServerFault.
Upvotes: 1
Views: 525
Reputation: 42065
If the server use chunked encoding for GET, but returns Content-Length for HEAD this is IMHO an indication that the information returned for HEAD is unlikely to be correct.
Upvotes: 1
Reputation: 10544
The HEAD
method response does not return entity-body but GET
responds with an entity-body, if the HTTP server has the "Chunked transfer encoding"
enabled does not send the "Content-Length"
in the response because is not used, the server does not need to know the length of the content before it starts transmitting a response to the client. The server can begin transmitting dynamically-generated content to the client before knowing the total size of that content. Perhaps this is the most likely explanation.
Upvotes: 0