Re: /bzr/squid3/trunk/ r9386: Bug 2395: FTP auth errors not displayed

From: Henrik Nordstrom <henrik_at_henriknordstrom.net>
Date: Tue, 02 Dec 2008 09:44:40 +0100

tis 2008-12-02 klockan 13:55 +1300 skrev Amos Jeffries:
> > Isn't the real question who called FwdState::complete()? It's only meant
> > to be called when all data has been placed into the entry, not before..
> >
>
> I started with that idea, but the code proved to be very convoluted.
>
> On an error the FTP engine calls ftpFail(), which syncs down to
> FtpSate::failed() and generates a 407 error object in the state member for
> holding errors, and closes the server links properly and then calls
> serverComplete().
> Once serverComplete is called the FwdState jumble kicks off.

before that fwdFailed should have been called with the error state.. or
at least in the Squid-2 code.

> There are two functions there complete() and completed()
>
> The code in complete() appears to handle two distinct cases, (1) when the
> connection is done with and everything is okay. And (2) when an error has
> occured as seen by *_INCOMPLETE.
>
> On the failure case (2) is active, it tries to store any partial object
> received (the 4xx or 5xx message from server???) then calls completed(),
> then repeats the storage for squid outgoing error.

Why?

In Squid-2 the flow is:

when the protocol detects an error it creates the error state and
registers this with forward using fwdFailed(). The protocol handler then
goes on cleaning up whatever it was doing and closes the server
connection. It does not signal complete on the failed object.

If the object is empty when the server connection is closed, or if it's
"blocked/delayed" (FWD_HDR_WAIT or what it's called) the object is reset
and the error state is rendered to the object, replacing whavever was in
there. If the object is not empty or could not be reset it's aborted.

> By trying to store the partial object before completed() even if it's
> empty we actually cause the zero-length-reply state to be triggered by
> store and unset the real error message member variable.

An empty object (without headers) can never be complete. Only empty or aborted.

Regards
Henrik

Received on Tue Dec 02 2008 - 08:44:49 MST

This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 12:00:03 MST