【发布时间】:2010-09-09 06:37:20
【问题描述】:
我正在尝试执行 HEAD 请求以关注 302 链接,但是此链接:http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNGrJk-F7Dmshmtze2yhifxRsv8sRg&url=http://www.mtv.com/news/articles/1647243/20100907/story.jhtml
很麻烦,因为 HEAD 请求返回 200 OK,而 GET 请求返回预期的 302 状态代码。
所以我需要执行一个 GET 请求,但我宁愿不必为获取整个 HTML 文档所带来的额外带宽时间付费。任何人都知道在不返回身体的情况下进行 GET 的黑客攻击吗?
更新:采纳大卫的建议做一个 Range 标头,但他们似乎仍然忽略它
GET /news/url?sa=t&fd=R&usg=AFQjCNGrJk-F7Dmshmtze2yhifxRsv8sRg&url=http://www.mtv.com/news/articles/1647243/20100907/story.jhtml HTTP/1.1
Range: bytes=0-10
x-ms-range: 0-600
Host: news.google.com
Connection: Keep-Alive
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
HTTP/1.1 302 Moved Temporarily
Content-Type: text/html; charset=UTF-8
Location: http://www.mtv.com/news/articles/1647243/20100907/story.jhtml
Content-Length: 258
Date: Wed, 08 Sep 2010 20:28:16 GMT
Expires: Wed, 08 Sep 2010 20:28:16 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Set-Cookie: PREF=ID=ef5f1bc768645c5e:TM=1283977696:LM=1283977696:S=5n26IrEDpcQTJIb1; expires=Fri, 07-Sep-2012 20:28:16 GMT; path=/; domain=.google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.mtv.com/news/articles/1647243/20100907/story.jhtml">here</A>.
</BODY></HTML>
【问题讨论】:
-
看起来网络服务器(在本例中为 Google 新闻)设置为在出现 HEAD 请求时发回 200 状态代码。这不是标准实现,HEAD 请求也应该返回 302 状态代码。由于这是他们的一个错误,我看不出有什么可以解决的
标签: html http protocols network-protocols