rfc-3659

Extensions to FTP

P. Hethmon
date2007-03 streamIETF areaapp wgftpext statusPROPOSED STANDARD pages61 canonicalhttps://www.rfc-editor.org/rfc/rfc3659 doi10.17487/RFC3659 errataview
This document specifies new FTP commands to obtain listings of remote directories in a defined format, and to permit restarts of interrupted data transfers in STREAM mode. It allows character sets other than US-ASCII, and also defines an optional virtual file storage structure. [STANDARDS-TRACK]

updates

Extracted elements (30)

design-rationale §7

MLST and MLSD were defined to replace LIST and NLST because the output format of those commands is server-defined and unpredictable, making machine parsing unreliable. MLSx provides a strictly defined, extensible, machine-friendly format.

design-rationale §5.1

STREAM mode restart uses a byte offset rather than embedded markers because the data stream in STREAM mode directly defines the file, so an offset always unambiguously identifies the same position. In Block or Compressed modes the same file can be transmitted as different byte sequences, making offsets non-unique restart points.

interoperability-note §2.2.2

For all commands defined in this specification, pathnames are treated literally with no wildcard or pattern-matching semantics. Clients requiring pattern matching must obtain a directory listing and implement their own selection logic.

interoperability-note §2.2

Pathnames containing the CRLF character pair cannot be transmitted over an FTP data connection (it is indistinguishable from the end-of-line indicator). Files with such names must either encode the sequence or be omitted from directory listings.

normative-requirement §4.2 MUST NOT

A 550 error response to a SIZE command MUST NOT be taken by the client as an indication that the file cannot be transferred in the current MODE and TYPE, as a server may generate this error for other reasons.

normative-requirement §6.3 MUST NOT

A TVFS FEAT response MUST NOT be returned unless the server implements TVFS as defined in section 6. Clients must be prepared to deal with arbitrary text following 'TVFS' in the feature line and ignore unrecognized extensions.

normative-requirement §4 MUST NOT

Estimates of the file transfer size MUST NOT be returned by the SIZE command; only precise information is acceptable.

normative-requirement §7.3 MUST

FTP implementations supporting MLSx MUST be 8-bit clean to transmit UTF-8 encoded file names. Implementations SHOULD use UTF-8 whenever possible. All implementations supporting MLST MUST support RFC 2640 (internationalization of FTP).

normative-requirement §5.3 MUST

If APPE is permitted after a REST command has been set, it MUST act identically to STOR: octets from the data connection are placed into the file at the location indicated by the restart marker value.

normative-requirement §2.3 MUST NOT

Implementations MUST NOT add precision to time-vals where that precision does not exist in the underlying value being transmitted. The '.' separator MUST NOT appear unless at least one following digit also appears.

normative-requirement §7.2 MUST NOT

Implementations MUST NOT vary the MLSx output format by inserting extra spaces, replacing spaces with tabs, including header or title lines, inserting blank lines, or altering it in any other way. The format is intended for machine processing.

normative-requirement §7.5.6 MUST NOT

Server-FTP implementations MUST NOT guess values for the 'lang' fact; language must be determined unambiguously (e.g., via filesystem tagging or user configuration). Similarly, 'media-type' values MUST NOT be guessed.

normative-requirement §7.2 MUST

The data connection opened for an MLSD response SHALL use TYPE L 8, MODE S, and STRU F, regardless of the FTP transfer settings actually in effect, and without altering those settings for future commands.

normative-requirement §5.3 MUST

The REST command must be the last command issued before the data transfer command that is to cause a restarted transfer. A user-PI that issued REST but did not successfully transmit the following data transfer command should send another REST before the next transfer; if no restart is needed, 'REST 0' should be issued.

normative-requirement §2.2 MUST

The Telnet IAC character, if part of a pathname sent over the FTP control connection, MUST be correctly escaped as defined by the Telnet protocol. Telnet option negotiation MUST NOT be attempted over FTP control connections.

normative-requirement §3.1 MUST

When MDTM returns a 213 response (no error), the format MUST be exactly as specified and multi-line responses are not permitted.

normative-requirement §5.4 MUST

Where a server-FTP supports RESTart in STREAM mode, it MUST include 'REST STREAM' in its FEAT response. Where REST is not supported or supported only in block/compressed modes, the REST line MUST NOT be included.

protocol-element §7

MLST returns machine-readable facts about exactly one named object over the control connection; MLSD lists the contents of a named directory over a data connection. Both use the same 'entry = [facts] SP pathname' line format.

protocol-element §7.5

MLSx standard facts are: size (octets), modify (last modification time-val), create (creation time-val), type (file/cdir/pdir/dir/OS-specific), unique (opaque identifier stable for the control connection lifetime), perm (access rights), lang, media-type, and charset. Fact names are case-insensitive.

protocol-element §5.3

REST in STREAM mode takes a decimal octet count parameter specifying how many octets of the immediately-following transfer to skip, effectively restarting at that offset. A value of zero disables restart. The server responds with a 350 reply, and a subsequent RETR or STOR command completes the restart.

protocol-element §3

The MDTM (Modification Time) command queries the last modification time of a named file in the server NVFS. The server responds with a 213 reply containing a time-val, or an error response if the file does not exist or the information is unavailable.

registry

protocol-element §7.5.5

The 'perm' fact is an unordered string of up to 10 case-independent letters indicating FTP permissions for the current user: a=APPE, c=create-in-dir, d=delete, e=CWD-enter, f=rename-from, l=list, m=MKD, p=purge-dir-contents, r=RETR, w=STOR.

protocol-element §4

The SIZE command returns the exact number of octets that would be transmitted over the data connection for a given file, dependent on the current STRU, MODE, and TYPE settings. The response is a 213 reply with a decimal octet count.

protocol-element §7.5.1

The 'type' fact disambiguates listing entries: 'file' is a transferable data file; 'cdir' is the listed directory itself (usable as a heading); 'pdir' is a parent directory; 'dir' is a subdirectory; OS-specific types use the 'OS.osname=kind' format.

protocol-element §6

TVFS (Trivial Virtual File Store) defines a Unix-like hierarchical pathname structure for FTP servers: filenames may not contain '/', pathnames are built by joining names with '/', and a leading '/' denotes a fully qualified path from the unnamed root directory.

registry §10.1

IANA maintains an OS Specific Fact Registry for system-dependent MLSx fact names (prefixed with the IANA OS name, e.g., 'UNIX.mode'). Registrations must follow the procedures in section 10.

registry

registry §10.2

IANA maintains an OS Specific Filetype Registry for OS-specific MLSx type values using the 'OS.osname=kind' naming scheme. Registrations must follow the procedures in section 10.

registry

security-consideration §11

The SIZE, MDTM, and MLSx commands expose detailed file metadata (sizes, timestamps, permissions, and MIME types) to authenticated FTP users. Servers must ensure that access controls on these informational commands are consistent with those on the corresponding data transfer commands, so that metadata is not disclosed to users who lack transfer rights.

security

wire-format §7.2

Each MLSx entry line has the form 'facts SP pathname CRLF', where facts is a series of 'factname=value;' pairs with no embedded spaces, followed by exactly one space, then the pathname. MLST responses are sent over the control connection indented by one space; MLSD data is sent over a data connection.

wire-format §2.3

The time-val format is 14 mandatory digits encoding YYYYMMDDHHMMSS, optionally followed by a period and one or more decimal fraction-of-second digits. All times are always represented in UTC in the Gregorian calendar.