带有HEAD请求的Content-Length标头? [英] Content-Length header with HEAD requests?
问题描述
http规范说明 HEAD
请求:
HEAD方法与GET相同,但服务器不能返回响应中的消息正文。响应HEAD请求的HTTP头中包含的元信息应该与响应GET请求时发送的信息相同。
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
标头?它应该是在 GET
请求中返回的值,即使没有响应正文吗?或者Content-Length应该是0?
Should the response to a HEAD
request contain a Content-Length
header? Should it be the value which would be returned on a GET
request, even if there is no response body? Or should the Content-Length be 0?
推荐答案
对我而言,它看起来像 HTTP 1.1 RFC 非常具体:
To me it looks like the HTTP 1.1 RFC is pretty specific:
Content-Length
entity-header字段表示实体主体的大小,以十进制
个数量的OCTET发送给收件人,或者在在HEAD
方法的情况下,本来发送的实体主体的大小为
请求为GET 。
这篇关于带有HEAD请求的Content-Length标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!