Ok, still with my problem...sorry it's gonna be a little long mail.

Bjørnar wrote:
> It would be interesting to se if the lost requests is happening on
> newly created connections, or maybe only on connections that are used
> a second time (many requests on same connection, http1.1 and
> keepalive).
I checked this and I am pretty sure it happens only on second time connections. When I first do a GET or POST, it always works.

This brings me to this:
I tried to find a reproductible case, and it seems I found one, with a solution that works (but it is not nice I think). Anyway, here it is:

I have a page called login.htm, that contain a form (action="Login") with a text input, a password input, and a submit button. A page loginfailed.htm exists and is displayed when the user didn't input the correct login/password. In this loginfailed.htm there is a link to go back to login.htm so the user can retry.
When I do the following operations, the bug always happens:
- get login.htm >always OK
- leave username and login blank (or input wrong username/password)
- click Submit, post the data >always OK
- get loginfailed.htm >always OK
- click retry, get login.htm >always OK
- repost some data (any username/password) >ALWAYS BUG: no communication until timeout. The PostDocument or PostedData functions never execute.

The functions for GetDocument, PostDocument and PostedData are similar to the ones of the WebServ example. The password checking (called from PostedData, when all the data has been received) does a simple test (using AnsiSameText) and:
  if Allowed then
  begin
    Body := //a string
    Header := //another string
    Stream.Write(Header[1], Length(Header));
    Stream.Write(Body[1],   Length(Body));
    Stream.Seek(0, 0);
    Client.DocStream := Stream;
    Client.SendStream;
  end
  else
  begin
    Client.Document:=HttpServer.DocDir+'\loginfailed.htm';
    Client.SendDocument(httpSendDoc);
  end;

Now, as I said, I found a solution, that is to do a Client.TriggerSessionClosed(0) after the POST command is handled and the answer sent to the client.
For now, it seems to works in 100% of the time, but:
1-Does it sounds you normal to have to use TriggerSessionClosed ?
2-What are the consequences of using TriggerSessionClosed ?
3-Is there something "softer" than closing the session ? I tried TriggerHttpRequestDone but it doesn't work.

Thanks for all your help !
Christophe

Francois Piette wrote:
Does it occurs with the sample "WebServ" delivered with ICS ?


Well it seems it doesn't (at least I didn't experienced the problem
yet), which is surprising because my program is quite identical to the
demo (I mean, I implemented some functions but nothing that directly
change the way THttpServer works).


It is likely that you introduced something wrong. Or failed to follow some 
programming rule.

One important thing: never call the message pump, directly or indirectly from 
one of the ICS
component event. You would get all kind of strange results. Be aware that some 
VCL internally call
the message pump, like ShowMessage.

--
[EMAIL PROTECTED]
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