- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们使用 HttpHead 从客户的网站获取信息,但由于某种原因,我们也在响应中获取 cookie。是预期的吗?有没有办法设置不返回cookie?
下面是我们的代码
HttpClient httpclient = new DefaultHttpClient();
// the time it takes to open TCP connection.
httpclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, this.timeout);
// timeout when server does not send data.
httpclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, this.timeout);
// the head method
HttpHead httphead = new HttpHead(url);
HttpResponse response = httpclient.execute(httphead);
我们收到以下警告,表明响应中也返回了 cookie。
[警告] ResponseProcessCookies - Cookie 被拒绝:“[版本:0][名称:DXFXFSG][值:AUR][域:...省略...][路径:/][过期:null]”。非法域属性“...省略...”。来源域:“...省略...”
最佳答案
是的,这是预期的;您应该得到与等效的 GET
相同的响应,只是没有正文。如果 GET
包含 cookie,您应该会看到它。
顺便说一句,我相信您从您提供的经过编辑的消息中看到的警告是,服务器正在尝试为不同的域设置 cookie。
关于java - 为什么要为 HttpHead 方法取回 cookie?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13715339/
我们使用 HttpHead 从客户的网站获取信息,但由于某种原因,我们也在响应中获取 cookie。是预期的吗?有没有办法设置不返回cookie? 下面是我们的代码 HttpClien
在我的 ASP.NET 核心 Controller 中,我有以下 HttpGet 函数: [HttpGet("[action]")] [HttpHead("[action]")] [ResponseC
我遇到一个问题,我正在触发 http 请求来获取这样的 header 。我的目标是检查当我触发请求时是否会得到响应。 try { HttpHead headReq = new
我们有以下代码,后来用 HttpHead 方法替换,因为我们只需要拉回网页的 header 信息。更改后,我们注意到,平均而言,对于同一组网页,HttpHead 的返回时间比 HttpGet 的返回时
我必须获取某些短网址的重定向网址,以检查是否可以下载最终页面。HttpHead 用于获取最终目标 url(参见下面的代码)。 HttpClient client = HttpClientBuilder
使用下面的测试类,/////1///// 处的行抛出一个 NoHttpResponseException(请参阅末尾的日志记录异常跟踪问题)。执行任何其他行 /////2-to-8///// 可以很好
我是一名优秀的程序员,十分优秀!