Hey guys, I got no answer/help from the list but 

another friend help me to fix it and I want to share the solution.

======================================================

Dear Francois Piette,

I need to accept cookies, and my old code that I got from your forum was:


(my old code)

with HttpCli do
  begin
  Agent := 'Mozilla/3.0 (compatible)';
  Accept := 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*';
  OnCookie := AcceptCookie;
  NoCache := True;
  ContentTypePost := 'application/x-www-form-urlencoded';
  MultiThreaded := False;
  RequestVer := '1.0';
  FollowRelocation := True;
  SocksLevel := '5';
  end;


procedure Tform1.AcceptCookie(Sender: TObject; const Data: String;  var Accept: 
Boolean);
begin
accept:=true;
(Sender as THttpCli).Cookie:=Data;
end;

(and the fixed code, now "works fine" again)
procedure Tform1..AcceptCookie(Sender: TObject; const Data: String;  var 
Accept: Boolean);
begin
//accept:=true;
(Sender as THttpCli).Cookie:=Data;
end;


but another point was suggested that could be more implemented.

code change suggestion in unit (OverbyteIcsHttpProt.pas)


on procedure THttpCli.GetHeaderLineNext; 

(old code)
=============================================
  else if Field = 'set-cookie' then begin
            bAccept := TRUE;
            TriggerCookie(Data, bAccept);
        end  

(new code)
=============================================
 else if Field = 'set-cookie' then begin
     bAccept := TRUE;
     TriggerCookie(Data, bAccept);
     if bAccept then FCookie:=Data;  //<==== new line
   end  

 

Best Regards
MCastro





________________________________
De: MCastro
Para: "twsocket@elists.org" <twsocket@elists.org>
Enviadas: Quarta-feira, 29 de Junho de 2011 19:00
Assunto: problem with httpcli to download the html from a specific website





 I use DELPHI 7 with this code for a long time with 
ICS7 without any problems... My code download a page using httpcli and 
save in my local disk.
but now ,after a fews months, the main site was updated and uses "
gzip-deflate" and I think that this is the problem, I don't know how to
handle this, and my code stop working. please, need help.

download ICS7 package:
ICS7 package => http://www.overbyte.be/arch/OverbyteIcsV7.zip

download my full code (with sources and compiled exe).
http://www.fileden.com/files/2010/4/9/2822525/load-page-using-ICS7.zip 

thanks for the help
MCastro
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to