Re: IdFtp questions

Giganews Newsgroups
Subject: Re: IdFtp questions
Posted by:  Pascal (pcoen…@telenetdotbe)
Date: Thu, 4 Jun 2009

Remy Lebeau (Indy Team) wrote:

> "Pascal" <pcoenen@telenetdotbe> wrote in message
> news:5ECC95840784E340pcoenen@telenetdotbe...
> > //Note that for LIST, it might be best to put the connection in
> <snip>
> > Why is this only done for List and not for 'ExtListDir(ADest)'?

> Because it is not supposed to.  ExtListDir() uses the MLSD command.
> According to RFC 3659 Section 7.2 "Format of MLSx Response":
>  The data connection opened for a MLSD response shall be a connection
>  as if the "TYPE L 8", "MODE S", and "STRU F" commands had been
> given,  whatever FTP transfer type, mode and structure had actually
> been set,  and without causing those settings to be altered for
> future commands.    That is, this transfer type shall be set for the
> duration of the data  connection established for this command only.
> While the content of  the data sent can be viewed as a series of
> lines, implementations  should note that there is no maximum line
> length defined.    Implementations should be prepared to deal with
> arbitrarily long  lines.

Ok, so the FTP server (Version wu-2.6.1-20) is not doing this

> > Q2: TIdFTP.SendTransferType
> <snip>
> > Why Case TransferType instead of Case FTransferType.
> It does not really matter, since the TransferType property does not
> use a getter method, it just it reads FTransferType directly.  The
> compiler will omit the same machine code either way.

Sorry, it was late. Not enough sleep the last days. Really stupid of me.

> > If you dyn create this IdFtp component at runtime and you don't
> > explicitly set the TransferType property then the SendTransferType
> > at connect and login won't do anything because TransferType is
> > empty.
> FTransferType is initialized in InitComponent(), which is called
> during construction:
> const
> Id_TIdFTP_TransferType = {ftBinary} ftASCII; // RLebeau 1/22/08: per
> RFC 959  ...
> procedure TIdFTP.InitComponent;
> begin
>  inherited InitComponent;
>  ...
>  FTransferType := Id_TIdFTP_TransferType;
>  ...
> end;
> Per FTP specs, the default transfer type for an FTP session is ASCII.
> Make sure you are using an up-to-date copy of Indy's 10 source code,
> if you are not already.

Using an up-to-date version.

> > Q3: procedure TIdFTP.SetTransferType
> <snip>
> >Isn't it better to remove the 'if AValue <> FTransferType' part.
> > This way we could resend the Type command (even if it's the same).
> There is no reason to do that.  Once the Transfer Type has been set
> for a session, it remains active for the rest of the session, unless
> explicitally changed again with a new TYPE command.


> > The reason: Some FTP servers do ASCII for the LIST command
> > (using the ExtListDir(ADest) procedure) but stay in ASCII even
> > if I requested Binary at connection (and login).
> Then those servers are buggy.  ExtListDir() uses the MLSD command,
> not the LIST command.  Refer to the above RFC quote for how MLSD
> works.

I understand this now. Thank you for helping me.




In response to

Re: IdFtp questions posted by Remy Lebeau \(Indy Team\) on Thu, 4 Jun 2009