HTTP之HEAD请求
来源:互联网 发布:知止而有得 编辑:程序博客网 时间:2024/05/22 03:40
HEAD请求来源是HTTP1.0。HTTP1.0就定义了三种请求方式GET,POST,HEAD。HTTP1.1则新增了OPTIONS, PUT, DELETE, TRACE 和 CONNECT 方法。
此处主要是讲HEAD请求。
w3.org定义
在w3.org里面是这么说的
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.The response to a HEAD request MAY be cacheable in the sense that the information contained in the response MAY be used to update a previously cached entity from that resource. If the new field values indicate that the cached entity differs from the current entity (as would be indicated by a change in Content-Length, Content-MD5, ETag or Last-Modified), then the cache MUST treat the cache entry as stale.
简单来说就是,HEAD方法与GET类似,但是HEAD并不返回消息体。在一个HEAD请求的消息响应中,HTTP投中包含的元信息应该和一个GET请求的响应消息相同。这种方法可以用来获取请求中隐含的元信息,而无需传输实体本身。这个方法经常用来测试超链接的有效性,可用性和最近修改。
一个HEAD请求响应可以被缓存,也就是说,响应中的信息可能用来更新之前缓存的实体。如果当前实体缓存实体阈值不同(可通过Content_Length、Content-MD5、ETag或Last-Modified的变化来表明),那么这个缓存被视为过期了。
HEAD请求的用法
特别适用在优先的速度和带宽下
1.检查资源的有效性。
2.检查超链接的有效性。
3.检查网页是否被串改。
4.多用于自动搜索机器人获取网页的标志信息,获取rss种子信息,或者传递安全认证信息等。
w3.org对HTTP请求的说明:
https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
0 0
- HTTP之HEAD请求
- HTTP请求方法 之 HEAD
- http head请求
- HTTP请求信息的Head书包
- 理解HEAD请求以及HTTP/204和HTTP/206响应
- 理解HEAD请求以及HTTP/204和HTTP/206响应
- 理解HEAD请求以及HTTP/204和HTTP/206响应
- head请求
- http请求验证的bug,head不让有下划线
- HTTP协议中POST、GET、HEAD、PUT等请求方法
- HTTP的POST,GET,HEAD,PUT等请求方法
- HTTP协议中POST、GET、HEAD、PUT等请求方法
- Head out!http请求重定向和转发的区别
- Http请求之 WebClient
- HTTP协议之请求
- IOS之HTTP请求
- HTTP协议之请求
- webkit之http请求
- 适配器模式(接口隔离)
- 百度地图 android 开发
- UNITY中FMOD音效插件使用
- on('click')与.click()事件的区别
- redis系列(六)客户端和服务器
- HTTP之HEAD请求
- 链表倒置算法题的心得
- require.js 被植入b.js 百度联盟推广js植入. 真坑
- Firefox浏览器多账号登陆方法
- ubuntu中常用的命令
- html中offsetTop、clientTop、scrollTop 各属性介绍
- 数据结构-链表
- Android6.0 混淆
- mysql主从复制