爬https://www.baidu.com/时返回下面这段
{"req":{"method":"GET","url":"https://www.baidu.com/"},"header":{"server":"bfe/1.0.8.5","date":"Sat, 18 Jul 2015 09:46:43 GMT","content-type":"text/html","transfer-encoding":"chunked","connection":"close","last-modified":"Thu, 09 Oct 2014 10:47:57 GMT","set-cookie":["BD_NOT_HTTPS=1; path=/; Max-Age=300","BIDUPSID=DB247156CC8E92FDEF52C96D9CD419DE; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com","PSTM=1437212803; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com","BDSVRTM=0; path=/","__bsi=2456321548234805317_00_66_N_N_1_0303_C02F_N_N_N_0; expires=Sat, 18-Jul-15 09:46:48 GMT; domain=www.baidu.com; path=/"],"p3p":"CP=\" OTI DSP COR IVA OUR IND COM \"","x-ua-compatible":"IE=Edge,chrome=1","pragma":"no-cache","cache-control":"no-cache","bdpagetype":"1","bdqid":"0xf5e2ef8200002fca","bduserid":"0","content-encoding":"gzip"},"status":200,"text":"<html>\r\n<head>\r\n\t<script>\r\n\t\tlocation.replace(location.href.replace(\"https://\",\"http://\"));\r\n\t</script>\r\n</head>\r\n<body>\r\n\t<noscript></noscript>\r\n</body>\r\n</html>"}
location.replace(location.href.replace(\"https://\",\"http://\"));这段不是由https跳回到http?
那为什么url还是https://www.baidu.com/
是因为你的请求 cookie 里有
BD_NOT_HTTPS=1
吧……