[Indy10] Some IdFTPServer bugs fixed

Giganews Newsgroups
Subject: [Indy10] Some IdFTPServer bugs fixed
Posted by:  Riceball LEE (ricebal…@Hotmail.com)
Date: Mon, 14 Mar 2005

* [Bug] IdFTPServer.CommandXXX: it still return 200 code even though
raise exception in command.
  Reason: the IdReplyRFC should always be the code 200.
  Fixed: IdCommandHandlers.pas (L:456)
procedure TIdCommandHandler.DoCommand(
  ....
    try
      DoCommand;
    except
      on E: Exception do begin
        if PerformReply then begin
          // Try from command handler first
          //bug fixed:
          //if Reply.Code = '' then
          if (Reply.Code = '') or (Reply.Code = '200') then begin
//modified by riceball
            Reply.Assign(Self.ExceptionReply);
          end;
          ....

* [Bug] IdFTPServer.CommandSIZE forget check whether the fileSystem
assigned.
procedure TIdFTPServer.CommandSIZE
begin
  if Assigned(Self.FOnGetFileSize) or Assigned(FFTPFileSystem) then
  begin
    ....
  end
  else begin
    CmdSyntaxError(ASender);
  end;

btw: i've add a feature to limits the user can not leave their HomeDir
and recognize FileName from FilePath. If DevTeam wanna merge it into
repository. I'm very glad to post the codes.

Replies