开发者

What response should If-Modified-Since HTTP Header return if request is HEAD?

If you send a GET request with an If-Modified-Since header, the server suports it and the file hasn't changed, the server will return a 304 response.

If you sent a HEAD request in the same circumstances,开发者_开发问答 should the server send a 304 response or send back the full headers you would have sent had the file changed?

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


As per 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.

Based on the above, the HEAD request in the same circumstances should return 304.

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

Again, based on what the RFC has to say, both GET and HEAD should be equivalent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜