我写了一个c程序来抓取博客。它工作得很好,直到它遇到这个博客: www.ipujia.com。我发送HTTP请求:
GET http://www.ipujia.com/ HTTP/1.0
到该网站,并得到如下响应:
HTTP/1.1 301 Moved Permanently
Date: Sun, 27 Feb 2011 13:15:26 GMT
Server: Apache/2.2.16 (Unix) mod_ssl/2.2.16 OpenSSL/0.9.8e-fips-rhel5
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_perl/2.0.4
Perl/v5.8.8
X-Powered-By: PHP/5.2.14
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Pragma: no-cache
Last-Modified: Sun, 27 Feb 2011 13:15:27 GMT
Location: http://http/www.ipujia.com/
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8这很奇怪,因为我无法获得跟随位置的索引页。有谁有什么想法吗?
发布于 2011-02-27 21:51:38
响应中的位置字段包含格式错误的URI。
位置:http://http/www.ipujia.com/ (注意协议错误)应该是
位置:http://www.ipujia.com/
除非您控制了服务器,否则您在这里几乎无能为力。
为了解决这个问题,您可以不解析"Location“响应并尝试从其中提取一个有效的URI吗?
https://stackoverflow.com/questions/5133530
复制相似问题