Hello

I'm obviously doing it wrong: After authenticating to a web server 
with POST and receiving some cookies, I'm getting an Access Violation 
while I'm copying the response into a memo:

===========
procedure TForm1.Button1Click(Sender: TObject);
var
   Data : String;
begin
   Data := 'login=jdoe&password=test';

   With HttpCli1 do begin
     SendStream := TMemoryStream.Create;
     SendStream.Write(Data[1], Length(Data));
     SendStream.Seek(0, soBeginning);

     RcvdStream := TMemoryStream.Create;
     Connection      := 'Keep-Alive';
     URL             := MyURL;

     try
       Post;
     except
         ShowMessage('POST failed');
         SendStream.Free;
         RcvdStream.Free;
         Exit;
     end;

     ShowMessage('1');
     SendStream.Free;
     RcvdStream.Seek(0,0);

     ShowMessage('2');
     Memo1.Lines.LoadFromStream(RcvdStream);

     ShowMessage('3');
     RcvdStream.Free;

     ShowMessage('4');

     //Close;
     ShowMessage('5');

     //EAccessViolation with message 'Access violation at address
0047DA12 in module 'Project1.exe'. Read of address 00000000'.
        //Occurs in procedure THttpCli.CleanupRcvdStream;
   end;
end;
===========

Any idea why this error occurs? Timing issue maybe?

Thank you.

-- 
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