Let's say I see an HTTP response with its header.
How do I know if it is a response to a HEAD
request?
RFC 2616 states that if 200 OK
is the status of the response, it should contain a message body only if it's not a response to a HEAD
request. So I need to know if it is a response to a HEAD.
Do I have to keep a state and remember whether it is a response to a HEAD
or is it possible to know that only from the response fields?
Thanks.
Best Answer
To allow you to see how the responses differ, you can use telnet:
...but as radius commented, you appear to have answered your own question; if you get code 200 in response, with no body, assume it's a response to a HEAD request.