twsoc...@kglt.net wrote:
> I'll start by saying that I am using the daily snapshot of 12/18/2011,
> Delphi 7.1, Win XP SP3 all patches as of 12/18/2011.
> 
> using
> TFtpCli I get a 500 error on a Quit even though the server returns a
> 221 response to the quit.   I've tracked it down to
> TCustomFtpCli.ControlSocketSessionClosed
> 
> I changed:
> 
> if FRequestType  ftpRqAbort then begin
> 
> To:
> 
> if
> (FRequestType  ftpRqAbort) and (FRequestType  ftpQuitAsync) then begin
> 
> and the problem is resolved.
> 
> Please note that the
> machine the program runs on is a 3.4g P4 with Gigabit networking to a
> DS3 backbone.  And this is a timing related problem.  I can not
> reproduce the error on my development machine.

Seems the same problem I noticed on OSX recently, please try the 
following fix as in the IPv6 branch for Windows as well, does it work
for you?  

{code}
procedure TCustomFtpCli.ControlSocketSessionClosed(
    Sender  : TObject;
    ErrCode : Word);
var
    LClosedState : TFtpState;
begin
    LClosedState := FState;
  {.$IFDEF POSIX}
    if ((FRequestType = ftpQuitAsync) or (FFctPrv = ftpFctQuit)) and
       (FState = ftpInternalReady) and (ErrCode <> 0) then
        ErrCode := 0;
    { Sometimes ErrCode ECONNRESET for unknown reason when TFtpServer and client
      are running on the same host. Seen on MacOS, however when QUIT response
      has been received we may safely ignore all possible errors. }
  {.$ENDIF}
    if FConnected then begin
        FConnected := FALSE;
        if FState <> ftpAbort then
            StateChange(ftpNotConnected);
        if Assigned(FOnSessionClosed) then
            FOnSessionClosed(Self, ErrCode);
    end;
    if FState <> ftpAbort then
        StateChange(ftpInternalReady);
    if FRequestType <> ftpRqAbort then begin
        if (ErrCode <> 0) or ((FRequestType <> ftpQuitAsync) and
           (LClosedState in [ftpWaitingBanner, ftpWaitingResponse])) then begin
            FLastResponse  := '500 Control connection closed - ' +
                               WSocketGetErrorMsgFromErrorCode(ErrCode);
            FStatusCode    := 500;
            FRequestResult := FStatusCode;    { 06 apr 2002 }
            SetErrorMessage;
        end;
        TriggerRequestDone(FRequestResult);
    end;
end;
{code}

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