HEAD响应比GET更快吗? [英] Is the HEAD response faster than the GET?

查看:268
本文介绍了HEAD响应比GET更快吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用GET获取有关文件的信息,如果我使用HEAD请求重写它会更快吗?原因是我在第一个响应后关闭了连接.

I'm currently getting the info about the files with GET, will it be faster if I rewrite it using HEAD request? Cause I close the connection after the first response.

推荐答案

HEAD响应仅包含HTTP标头,但不包含正文-如果您不使用正文中的任何信息,通常仅使用HEAD会更快通常已经传递到GET响应中-如果没有任何开头,应该没有什么不同.

A HEAD response only includes the HTTP headers but no body - it is generally faster to just use a HEAD if you do not use any information in the body that would have normally transferred in a GET response - if there was no body to begin with it should not make a difference.

也来自此处:

HEAD方法与GET相同,不同之处在于服务器不得 返回响应中的消息正文.包含的元信息 HTTP标头中对HEAD请求的响应应该相同 响应于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. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.

这篇关于HEAD响应比GET更快吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆