http - 带有 HEAD 请求的 Content-Length header ?

标签 http rest http-headers

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/

相关文章:

asp.net-mvc - 请求来自 iframe 吗?

c# - ASP.NET MVC C# PayPal Rest API - UNAUTHORIZED_PAYMENT

rest - 如何在 XPages 中使用休息服务(扩展库)更新文档

java - 使用 SAML 的 REST API 身份验证

node.js - 在Cloud9 IDE中获取用户的真实IP地址

java - 不使用过滤器设置响应头 - RESTeasy

wordpress - 在wordpress网站中将http更改为https,激活ssl证书

java - 如何使用 Java 通过 HTTP 下载附件?

http - AWS Load Balancer 是否可以配置为过滤掉请求?

java - HTTP 未返回 304