关于用IDhttp发送网站http头的问题

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 jinlangal 的 blog

关于用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;
就是这里返回数据出错了。

如何解决呀。

本文关键:关于用IDhttp发送网站http头的问题
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top