TIdFTP.List Question

Giganews Newsgroups
Subject: TIdFTP.List Question
Posted by:  Pascal (pcoen…@telenetdotbe)
Date: Sat, 6 Jun 2009

Hi,

A question about the TIdFTP.List procedure:

- I'm using TIdLogDebug for debugging.
- ADetails = False so I'm not using ExtListDir(ADest)
- I've been debugging this for a couple of hours and the part were the
transfertype is put into ASCII before the actual list command and
afterwards is restored to ftBinary if the original type wasn't ASCII
isn't working (I think, I'm quite sure).
It's really strange. It only works correct if I force it using
SendTranferType.

procedure TIdFTP.List(ADest: TStrings; const ASpecifier: string = '';
ADetails: Boolean = True);      {do not localize}
var
  LDest: TMemoryStream;
  LTrans : TIdFTPTransferType;
begin
  if ADetails and UseMLIS and FCanUseMLS then begin
    ExtListDir(ADest);
    Exit;
  end;
  //Note that for LIST, it might be best to put the connection in ASCII
  //mode because some old servers such as TOPS20 might require this.  We
  //restore it
  //if the original mode was not ASCII.  It's a good idea to do this
  //anyway
  //because some clients still do this such as WS_FTP Pro and
  //Microsoft's FTP Client.
  LTrans := TransferType;
  if LTrans <> ftASCII then begin
    Self.TransferType := ftASCII;
    --> After this force it using SendTranferType
  end;
  try

  <snip>

  finally
    if LTrans <> ftASCII then begin
      TransferType := LTrans;
      --> After this force it using SendTranferType
    end;
  end;
end;

Regards,
Pascal

--

Replies