Scrive Maurizio Lotauro <[EMAIL PROTECTED]>:

> Scrive Arno Garrels <[EMAIL PROTECTED]>:
> 
> > Maurizio Lotauro wrote:

[...]

> > Looking into THttpCli.SocketDataAvailable, OnDataPush seems to be 
> > triggered in this case. LastResponse should the contain 401/407,
> > possibly you handle this case from that event?
> 
> Unfortunately no because FState is httpWaitingHeader. Now I'm trying 
> to catch when the status code is set to 401, but I need at least the whole
> header.
> Then I should "emulate" what happen when the 401 is received after the whole
> send. It doesn't seem easy...

This is what I tried. In the THttpCli.TriggerHeaderEnd procedure I added on top:

    if ((FStatusCode = 401) or (FStatusCode = 407)) and Assigned(FSendStream)
then begin
      Inc(FSentCount, FSendStream.Size - FSendStream.Position);
      FSendStream.Seek(0, soFromEnd);
    end;

but it still doesn't work. Looking with WireShark this is what happen:
- the client send a chunk of 8193 byte (the size of the send buffer)
- the server answer with 401
- the client send a second chunk of 8193 byte (from the first post)
- the client send a new post containing the authentication credential
- the server answer with 414 before the client ends the transmission and close
the connection.

I think that the problem lies on the transmission of the second chunk. In the
TriggerHeaderEnd the FSendStream.Position is 16386, so the second chunk is
already "on the way".
How I can avoid the second chunk or tell the server that I'm starting a new 
send?


Bye, Maurizio.

----------------------------------------------------
This mail has been sent using Alpikom webmail system
http://www.alpikom.it

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