gpt4 book ai didi

http - 如果请求是 HEAD,If-Modified-Since HTTP Header 应该返回什么响应?

转载 作者:可可西里 更新时间:2023-11-01 15:27:10 25 4
gpt4 key购买 nike

如果您发送带有 If-Modified-Since header 的 GET 请求,服务器支持它并且文件没有更改,服务器将返回 304 响应。

如果您在相同情况下发送 HEAD 请求,服务器应该发送 304 响应还是发回您在文件更改时发送的完整 header ?

简而言之:请求未更改的文件时 GET/HEAD 是否等效?

最佳答案

根据 RFC

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请求应该返回304。

In short: is GET / HEAD equivalent when requesting a file that has not changed?

同样,根据 RFC 的规定,GET 和 HEAD 应该是等价的。

关于http - 如果请求是 HEAD,If-Modified-Since HTTP Header 应该返回什么响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5400180/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com