|
本帖最后由 2949497060 于 2019-4-25 22:14 编辑
我用fiddler抓包用IE访问“https://detail.1688.com/offer/55 ... 59.4.12192fb10DoiGR”获取的请求头和响应头如下:请求头:https://detail.1688.com/offer/55 ... 59.4.12192fb10DoiGRMethod:GET
Accept:text/html, application/xhtml+xml, */*
Accept-Language:zh-CN
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding:gzip, deflate
Host:detail.1688.com
Connection:Keep-Alive
响应头:HTTP/1.1 200 OK
Date: Thu, 25 Apr 2019 13:34:00 GMT
Content-Type: text/html;charset=GBK
Connection: keep-alive
Vary: Accept-Encoding
ufe-result: A6
S: STATUS_NORMAL
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: max-age=0,s-maxage=0
b2c_auction: 555115915998
page_cache_info: {"create_time":"2019-04-25T21:34:00","is_new":true,"expire_time":3600000}
at_auid: 555115915998
at_autype: 6_yigemina
P3P: CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR'
X-Cache: MISS TCP_MISS dirn:-2:-2
Via: aliswift011015221006.center.na61[1266,200-0,M], aliswift011015202060.center.na61[200]
url-hash: id=555115915998&detail.1688.com
Server: Tengine/Aserver
Strict-Transport-Security: max-age=31536000
Timing-Allow-Origin: *
EagleEye-TraceId: 0b0b9df015561992390271024e2158
Content-Length: 259823
然后我自己写,添加的头信息与抓包的头信息完全一样,但是就是无法获取到响应头里的Content-Length,请问大神是什么原因呢?自己的代码如下:HttpItem hi = new HttpItem() {
URL = "https://detail.1688.com/offer/555115915998.html",
Method = "get",
KeepAlive = true,
};
hi.Header.Add("Accept-Language","zh-CN");
hi.Header.Add("Accept-Encoding","gzip, deflate, br");
HttpResult hr = new HttpHelper().GetHtml(hi);
Console.WriteLine(hr.Header!=null?hr.Header.ToString():"null");
|
|