Re: FTP DELE command

Giganews Newsgroups
Subject: Re: FTP DELE command
Posted by:  Remy Lebeau \(Indy Team\) (re…
Date: Thu, 9 Dec 2010

"Pascal" <coenenp@gmaildotcom> wrote in message

> Are both allowed


> can I use the IdFtp delete procedure using only the
> filename and/or using path incl filename.

Yes.  TIdFTP.Delete() does not interpret the specified parameter in any way,
it is passed to the server as-is.

> In the FTP RFC they talk about pathname but don't
> really mention what is allowed (I think).

Yes, they do.  The semantics of a pathname are described in RFC 959 Sections
2.2 and 4.1.3:

Pathname is defined to be the character string which must be
input to a file system by a user in order to identify a file.
Pathname normally contains device and/or directory names, and
file name specification.  FTP does not yet specify a standard
pathname convention.  Each user must follow the file naming
conventions of the file systems involved in the transfer.

The FTP service commands define the file transfer or the file
system function requested by the user.  The argument of an FTP
service command will normally be a pathname.  The syntax of
pathnames must conform to server site conventions (with
standard defaults applicable), and the language conventions of
the control connection.

This means a pathname can be anything the server's underlying filesystem can
process, within the confines of the connection's currently assigned language
(RFC 2640 defines a LANG command to set the language dynamically).  That
includes absolute and relative folder paths, and filenames by themselves
(which are interpretted as being relative to the connection's current
working directory).

The actual binary representation of a pathname was originally defined in RFC
959 Section 5.3.2:

<char> ::= any of the 128 ASCII characters except <CR> and <LF>
<string> ::= <char> | <char><string>
<pathname> ::= <string>

RFC 2640 Section 3.1 updates the binary representation to allow <CR>, <LF>,
and bytes above 127, which is needed to support UTF-8 and other non-ASCII
encodings for International characters:

pathname = 1*(%x01..%xFF)

RFC 2640 Section 3.1 also defines a set of additional parsing rules needed
to ensure <SP> and <CR> characters and UTF-8 codeunits are parsed correctly.

Remy Lebeau (TeamB)


In response to

FTP DELE command posted by Pascal on Thu, 9 Dec 2010