http spec说到 HEAD
请求:
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request.
HEAD
请求的响应是否应该包含 Content-Length
header ?它是否应该是在 GET
请求中返回的值,即使没有响应主体?还是 Content-Length 应该为 0?
最佳答案
对我来说它看起来像 HTTP 1.1 RFC非常具体:
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
关于http - 带有 HEAD 请求的 Content-Length header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3854842/