环境: win2003+delphi7+indy9
idhttp已经指定了protocolversion为1.1,为什么用sniffer发现数据包还是1.0? 
indy9和indy10都试过, 同样的故障. 
?POST /test.asp HTTP/1.0?POST /test.asp HTTP/1.0 
... 
还有, 我指定了cookie为: 
        Idhttp1.Request.CustomHeaders.Text:='Cookie: '+ 
                'Temp=False; userid=username; '+SCookie; 
其中SCookie是sessionid部分. 
可是为什么sniffer抓到的cookie没有'Temp=False; 
userid=username; '这部分呢, 而只有SCookie, 如下: 
... 
Cache-control: no-cache 
Cookie: ASPSESSIONIDCASSDAQQ=NNOJMHMALDEOHJHEKOCDNGJG 
... 
望高手指点. 谢谢

解决方案 »

  1.   

    呵呵,看看unit IdHTTP中的注释..........procedure TIdCustomHTTP.Post(AURL: string; const ASource, AResponseContent: TStream);
    var
      OldProtocol: TIdHTTPProtocolVersion;
    begin
      // PLEASE READ CAREFULLY  // Currently when issuing a POST, IdHTTP will automatically set the protocol
      // to version 1.0 independently of the value it had initially. This is because
      // there are some servers that don't respect the RFC to the full extent. In
      // particular, they don't respect sending/not sending the Expect: 100-Continue
      // header. Until we find an optimum solution that does NOT break the RFC, we
      // will restrict POSTS to version 1.0.
      if Connected then
      begin
        Disconnect;
      end;
      OldProtocol := FProtocolVersion;
      // If hoKeepOrigProtocol is SET, is possible to assume that the developer
      // is sure in operations of the server
      if not (hoKeepOrigProtocol in FOptions) then
        FProtocolVersion := pv1_0;
      DoRequest(hmPost, AURL, ASource, AResponseContent);
      FProtocolVersion := OldProtocol;
    end;