One last note for now: we always first call HEAD before GET for the cache. GET is called in onrequestdone of HEAD. I am sure my code is ok. As I did not override thttpcli-well mostly but those parts overriding are not called much.
Regards, SZ On Wed, May 28, 2008 at 4:06 PM, Fastream Technologies <[EMAIL PROTECTED]> wrote: > AFAI can see, you mean that the existing code in socketavailable should be > working and killing those extra bytes, right? I am asking this confirmation > because it is not doing what you intend it to do! > > Here is some more information about the bug: The onheaderend (which is not > demoed in the demo) is called twice: once with LastResponse = "0" and the > second time with the correct data. The onheaderdata's are called after the > first onheaderend. The bug is in there! > > Regards, > SZ > On Wed, May 28, 2008 at 3:46 PM, Arno Garrels <[EMAIL PROTECTED]> > wrote: > >> Fastream Technologies wrote: >> > Hello, >> > >> > But this gets very annoying--with keep-alive, users of >> > the proxy cannot browse more than 1 or 2 chunked encoded pages. They >> > see empty page since onheaderend is called after "0 \r\n". >> > I know in >> > HEAD this body part must not be sent yet this is Apache and we need >> > to tolerate it. >> >> The line "FReceiveLen := 0;" should 'eat' anything that's in the >> receive buffer yet including the "0 \r\n". However if those junk bytes >> are received afterwards the connection should be aborted in >> SocketDataAvailable() later on, see below. >> >> > I understand all except this line: >> > StateChange(httpWaitingBody); //AG 05/27/08 >> > since this is HEAD, why do we wait for body? >> >> It's because of this: >> procedure THttpCli.SocketDataAvailable(Sender: TObject; ErrCode: Word); >> if FState = httpWaitingBody then begin >> if FReceiveLen > 0 then begin >> if FRequestType = httpHEAD then begin { 23/07/04 } >> { We are processing a HEAD command. We don't expect a >> document } >> { but some server send one anyway. We just throw it away >> and } >> { abort the connection >> } >> FReceiveLen := 0; >> FCtrlSocket.Abort; >> Exit; >> end; >> >> So I guess it should work, if not, I've currently no better idea :( >> >> -- >> Arno Garrels >> >> > >> > Francois, can you take a look at the problem please? >> > Best Regards, >> > >> > SZ >> > On Wed, May 28, 2008 at 10:35 AM, Fastream Technologies >> > <[EMAIL PROTECTED]> wrote: >> > >> >> I tested Arno's lastest code. It SEEMED to work in the first tries. >> >> YET, when you click first HEAD and then GET, (very fast), it gets >> >> LastResponse as "0 \r\n". After this, Onheaderend is called which >> >> spoils everything. That is the BIG problem. >> >> >> >> Regards, >> >> >> >> SZ >> >> >> >> On Wed, May 28, 2008 at 10:09 AM, Fastream Technologies < >> >> [EMAIL PROTECTED]> wrote: >> >> >> >>> Hi, >> >>> >> >>> I understand all except this line: >> >>> >> >>> StateChange(httpWaitingBody); >> >>> //AG 05/27/08 >> >>> since this is HEAD, why do we wait for body? >> >>> Best Regards, >> >>> >> >>> SZ >> >>> On Tue, May 27, 2008 at 11:03 PM, Arno Garrels >> >>> <[EMAIL PROTECTED]> wrote: >> >>> >> >>>> Arno Garrels wrote: >> >>>>> From a brief test, the server sends body data even though it got a >> >>>>> HEAD-request, the following modification may help? >> >>>> >> >>>> This one may work better, if not, Francois or someone with more >> >>>> HttpCli-experience should look at it: >> >>>> >> >>>> { FContentLength = -1 when server doesn't send a value } >> >>>> if ((FContentLength = -1) and { Added 12/03/2004 >> >>>> } (FTransferEncoding <> 'chunked') and { Added >> >>>> 09/10/2006 by FP } >> >>>> ((FStatusCode < 200) or { Added 12/03/2004 >> >>>> } (FStatusCode = 204) or { Added >> >>>> 12/03/2004 } (FStatusCode = 301) or { >> >>>> Added 06/10/2004 } (FStatusCode = 302) or >> >>>> { Added 06/10/2004 } (FStatusCode = 304) or >> >>>> { Added 12/03/2004 } (FStatusCode = 401) or >> >>>> { Added 12/28/2005 } //AG 12/28/05 >> >>>> (FStatusCode = 407))) { Added 12/28/2005 >> >>>> } //AG 12/28/05 >> >>>> or >> >>>> (FContentLength = 0) >> >>>> or >> >>>> (FRequestType = httpHEAD) then begin >> >>>> { TriggerHeaderEnd; }{ Removed 10/01/2004 } >> >>>> if {(FResponseVer = '1.0') or (FRequestVer = '1.0') >> >>>> or} { [rawbite 31.08.2004 Connection controll] } >> >>>> FCloseReq then begin >> >>>> if FLocationFlag then { Added >> >>>> 16/02/2004 } StartRelocation { >> >>>> Added 16/02/2004 } else begin >> >>>> { Added 16/02/2004 } if FRequestType = >> >>>> httpHEAD then begin { Added 23/07/04 } >> >>>> { With HEAD command, we don't expect a >> >>>> document } >> >>>> { but some server send one ! >> >>>> } >> >>>> FReceiveLen := 0; { Cancel >> >>>> received data } >> >>>> StateChange(httpWaitingBody); >> >>>> FNext := nil; >> >>>> end; >> >>>> FCtrlSocket.CloseDelayed; { Added >> >>>> 10/01/2004 } end; >> >>>> end >> >>>> else if FRequestType = httpHEAD then begin >> >>>> //AG 05/27/08 >> >>>> { With HEAD command, we don't expect a document >> >>>> } //AG 05/27/08 >> >>>> { but some server send one ! >> >>>> } //AG 05/27/08 >> >>>> FReceiveLen := 0; { Cancel received data >> >>>> } //AG 05/27/08 >> >>>> StateChange(httpWaitingBody); >> >>>> //AG 05/27/08 >> >>>> FNext := nil; >> >>>> //AG 05/27/08 >> >>>> SetReady; >> >>>> end; >> >>>> //AG 05/27/08 >> >>>> Exit; >> >>>> end; >> >>>> DocExt := LowerCase(ExtractFileExt(FDocName)); >> >>>> >> >>>> -- >> >>>> 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 >> -- >> 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 >> > > > -- 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