François:

I tried to close the connection using the event OnRequestDone, this closed
the connection ok, but in some clients, the page wasn't even shown, any hint
on what could be happening?

procedure TWebServForm.CreateVirtualDocument_Time(
    Sender    : TObject;            { HTTP server component                }
    ClientCnx : TMyHttpConnection;  { Client connection issuing command    }
    var Flags : THttpGetFlag);      { Tells what HTTP server has to do next}
var
  Body : String;
  Header : String;
  i: Integer;
begin
  Body := '<HTML>' + '<HEAD>' + '<TITLE>Pagina de teste </TITLE>' +
          '</HEAD>' + #13#10 +  '<BODY>';
  for i := 1 to 5000 do
    Body := Body + '<br>This is line number '+IntToStr(i);
  Body := Body+'</BODY></HTML>';
  Header := 'Pragma: no-cache' + #13#10 +  { No client caching please     }
          'Expires: -1'      + #13#10 +
          'Set-Cookie: Usuario=a; path=/'+ #13#10 +
          'Set-Cookie: Senha=a; path=/'+ #13#10;
  ClientCnx.OnRequestDone := RequestDone;    
  ClientCnx.AnswerString(Flags,'','',Header,Body);
end;

procedure TWebServForm.RequestDone(Sender : TObject);
begin
  TMyHttpConnection(Sender).Close;
end;

Bruno
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Bruno Sonnino
Sent: Thursday, May 19, 2005 3:55 PM
To: twsocket@elists.org
Subject: Re: [twsocket] Connection not closed in WebServer with IE

François:

I replaced your Time function with this one, now when you try the time
function in IE, the progressbar stays there and the client is not
disconnected (you can see the client connected in the server panel). In
FireFox this doesn't happen:

procedure TWebServForm.CreateVirtualDocument_Time(
    Sender    : TObject;            { HTTP server component                }
    ClientCnx : TMyHttpConnection;  { Client connection issuing command    }
    var Flags : THttpGetFlag);      { Tells what HTTP server has to do next}
var
  Body : String;
  Header : String;
  i: Integer;
begin
  Body := '<HTML>' +
          '<HEAD>' +
            '<TITLE>Pagina de teste </TITLE>' +
          '</HEAD>' + #13#10 +
          '<BODY>';
  for i := 1 to 5000 do
    Body := Body + '<br>This is line number '+IntToStr(i);
  Body := Body+'</BODY></HTML>';
  Header := 'Pragma: no-cache' + #13#10 +  { No client caching please     }
          'Expires: -1'      + #13#10 +
          'Set-Cookie: Usuario=a; path=/'+ #13#10 +
          'Set-Cookie: Senha=a; path=/'+ #13#10;
  ClientCnx.AnswerString(Flags,'','',Header,Body);
end;


Bruno
On 19/5/2005 15:02:20, Francois PIETTE ([EMAIL PROTECTED]) wrote:
> I
> don't know the context of this code. I find strange to have a local
> variable "Flags".
> Have you looked at the WebServ delo provided with ICS ?
> See TWebServForm.CreateVirtualDocument_Time as an example of AnswerString
> use.
> Put your code into that sample program.
> --
> [EMAIL PROTECTED]
> http://www.overbyte.be
> 
> 
> ----- Original Message -----
> From: "Bruno Sonnino" <[EMAIL PROTECTED]>
> To: <twsocket@elists.org>
> Sent: Thursday, May 19, 2005 7:02 PM
> Subject: Re: [twsocket] Connection not closed in WebServer with IE
> 
> 
> > Francois:
> >
> > Yes, I am. The full code (it has been cut from my last message) is:
> >
> > var
> >   Flags: THttpGetFlag;
> >   i : Integer;
> >   Body : String;
> >   Header : String;
> > begin
> >   Flags := hgWillSendMySelf;
> >   Body := '<HTML>' +
> >           '<HEAD>' +
> >             '<TITLE>Pagina
> de teste
> </TITLE>' +
> >           '</HEAD>' + #13#10 +
> >           '<BODY>';
> >   for i := 1 to 1000 do
> >     Body := Body +


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



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

Reply via email to