在node中用了一下request.head,发现很少关注过method为HEAD的:
The HEAD method is identical to the GET method 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 allows a client to obtain meta-information about a resource without actually transferring the resource itself.
The head method is often used for testing hyperlinks, accessibility and for determining if a document has been recently modifed.
When your program is implementing caching, it is important to note that if the HEAD response indicates that the cached entity differs from the current entity, such as by a change in the Content-Length, Content-MD5, ETag or Last-Modified, the cache must treat the cached entry as stale.
扩展阅读:
1. http://hc.apache.org/httpclient-3.x/methods/head.html
2. http://condor.depaul.edu/dmumaugh/readings/handouts/SE435/HTTP/node14.html
相关推荐
在web.xml文件中配置下面一段内容 ... <http-method>HEAD</http-method> <http-method>OPTIONS</http-method> <http-method>TRACE</http-method> <auth-method>BASIC</auth-method> </login-config>
通过设置`Method`属性为"HEAD",我们能发起一个Head请求。代码示例如下: ```csharp HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "HEAD"; request.Timeout = 5000; ``` ...
<http-method>HEAD</http-method> <http-method>OPTIONS</http-method> <http-method>TRACE</http-method> <auth-constraint></auth-constraint> <auth-method>BASIC</auth-method> ``` 3. **修改...
《Head First 设计模式》是软件开发领域的一本经典著作,尤其对于Java开发者而言,它提供了深入浅出的讲解,帮助读者理解并掌握设计模式这一核心概念。设计模式是经验丰富的开发者在解决常见问题时总结出的最佳实践...
5. **方法(Method)**:方法是Java中的重头戏,书中会教授如何定义、调用和传递参数,以及理解方法的作用和重要性。 6. **数组**:数组是存储同一类型数据的集合,书中会讲解一维和多维数组的使用方法。 7. **...
<http-method>HEAD</http-method> <http-method>OPTIONS</http-method> <http-method>TRACE</http-method> <transport-guarantee>CONFIDENTIAL ``` 备注:还可以屏蔽其他方法,在 `<http-method>` ...
} else if (method.equals(METHOD_HEAD)) { doGet(request, response); ((HttpServletResponse)response).setContentLength(0); } else if (method.equals(METHOD_POST)) { doPost(request, response); } else...
<http-method>HEAD</http-method> <http-method>OPTIONS</http-method> <http-method>TRACE</http-method> <auth-method>BASIC</auth-method> ``` 总结 在本文中,我们讨论了如何禁止 Tomcat 上...
Receives an HTTP HEAD request from the protected service method and handles the request. doOptions(HttpServletRequest, HttpServletResponse) - Method in class javax.servlet.http.HttpServlet Called by...
这些方法通过调用私有的`send`方法实现,其中参数`method`设置为"GET"。 #### 发送POST请求 同样地,`sendPost`也提供了三种重载方式,用于发送不带参数、带参数、带参数及属性的POST请求。这些方法的实现逻辑与GET...
3. HEAD:类似于GET,但仅返回响应头,不包含任何实体主体,常用于检查资源的元信息。 4. PUT:PUT方法用于替换服务器上指定的资源。在Fetche-HTTP-1.1.0中,它允许用户更新远程资源。 5. DELETE:删除服务器上的...
《Head First 设计模式》是软件开发领域的一本经典著作,尤其在Java编程语言中具有广泛...《Head First 设计模式》这本书通过丰富的图表和幽默的语言,使复杂的概念变得易于理解,是每个Java程序员的必备参考书之一。
http-客户端-流用法使用 http 请求作为流: var http = require ( 'http-client-stream' )var endpoint = http ( 'http://www.google.com' )var stream = endpoint .... createStream ( { method : 'HEAD'} )proc
通过JavaScript来调用服务器端的方法进行数据交互是Ajax技术的核心之一。本文将详细介绍如何使用JavaScript来调用服务器端的Ajax方法,并通过具体的实例加以说明。 #### 二、准备工作 为了能够成功地使用JavaScript...
<http-method>HEAD</http-method> <http-method>PUT</http-method> <http-method>DELETE</http-method> <http-method>TRACE</http-method> ``` 这段配置将限制对所有URL路径(`/*`)的访问,并禁用除了GET...
<http-method>HEAD</http-method> <http-method>OPTIONS</http-method> <http-method>TRACE</http-method> ``` 最后,已解密的登录请求是另一个安全隐患,它可能导致敏感信息在传输过程中被截获。为了...
1. Use HEAD method >>> import requests >>> res = requests.head(http://www.baidu.com/) >>> req.head(https://www.baidu.com/).headers {'Content-Encoding': 'gzip', 'Server': 'bfe/1.0.8.18', 'Last-...