關於用IDhttp發送網站http頭的問題
近來發現在一個怪問題,第一次發送http頭反回數據都正常,但第二次就不正常了,因為第一次請求時返回了一個cookie 。第二次發送時就連這個cookie 也發過去了。本來也沒錯,但就是這個cookIE 的位置不對,倒置發送的http頭錯誤。
看下面的的第一次請求正常:
GET http://www.paymesurf.com:80/surf3.PHP?usrid=879 HTTP/1.1
Content-Type: text/Html
Proxy-Connection: Keep-Alive
Host: www.paymesurf.com
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-PowerPoint, application/vnd.ms-Excel, application/msWord, application/x-shockwave-Flash, */*
Accept-Language: zh-cn
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; MyIE2; CustomExchangeBrowser; .Net CLR 1.1.4322)
返回數據:
HTTP/1.0 200 OK
Date: Fri, 20 May 2005 06:29:55 GMT
Server: apache/1.3.33 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.10 FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7a
X-Powered-By: PHP/4.3.10
Set-CookIE: PHPSESSID=66b3ae6788a076324ad5c62e8fcaedbe; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Type: text/Html
X-Cache: MISS from KShIEld
X-Cache-Lookup: MISS from KShIEld:8080
Proxy-Connection: close
第二次請求就變成這樣了:
GET http://www.paymesurf.com:80/bar3.php?usrid=879&PHPSESSID=66b3ae6788a076324ad5c62e8fcaedbe HTTP/1.1
Content-Type: text/Html
PHPSESSID=66b3ae6788a076324ad5c62e8fcaedbe //在這裡就多了這一句,所以出錯了。
Proxy-Connection: Keep-Alive
Host: www.paymesurf.com
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-PowerPoint, application/vnd.ms-Excel, application/msWord, application/x-shockwave-Flash, */*
Accept-Language: zh-cn
Referer: http://www.paymesurf.com/surf3.PHP?usrid=879
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; MyIE2; CustomExchangeBrowser; .Net CLR 1.1.4322)
CookIE: PHPSESSID=66b3ae6788a076324ad5c62e8fcaedbe
令人奇怪的是,在我的電腦裡運行正常,而發給別人用就不正常,是不是因為我的電腦裡有indy的組件呢。還是什麼原因,郁悶呀,哪位大哥可以幫我解答呀。QQ:402391462 ,注明:idhttp。謝謝
代碼如下:
第一次請求:
idsearch.Request.Accept:='image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-PowerPoint, application/vnd.ms-Excel, application/msWord, application/x-shockwave-Flash, */*';
idsearch.Request.AcceptLanguage:='zh-cn';
idsearch.Request.UserAgent:='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; MyIE2; CustomExchangeBrowser; .Net CLR 1.1.4322)';
idsearch.Request.ProxyConnection:='Keep-Alive' ;
idsearch.Request.ContentType:='text/Html';
SurfUrl:='http://www.paymesurf.com:80/surf3.PHP?usrid=879 '
tmpstr:=idsearch.Get(SurfUrl);
if tmpstr='' then
writeLog('連接網站失敗..')
else
writeLog('連接網站成功..');
:第二次請求:
cookiestr:='cookIE :asdfjiwerfksldafjiweflkasdjfiw'
idsearch.Request.CustomHeaders.Text:=cookIEstr;
surfurl1:='http://www.paymesurf.com:80/bar3.PHP?usrid=879 '
idsearch.request.Referer:=SurfUrl;
try
tmpstr:=idsearch.get(surfurl1);
except
writeLog('失敗..');
end;
就是這裡返回數據出錯了。
如何解決呀。