Skip to main content

Application Level: File Transfer Protocol

File Transfer Protocol (FTP)​

  • STATUS: Recommended
  • SPECIFICATION: RFC 765 (in IPTW)

COMMENTS:

The protocol for moving files between Internet hosts. Provides for access control and negotiation of file parameters.

There are a number of minor corrections to be made. A major change is the deletion of the mail commands, and a major clarification is needed in the discussion of the management of the data connection. Also, a suggestion has been made to include some directory manipulation commands (RFC 775).

Even though the MAIL features are defined in this document, they are not to be used. The SMTP protocol is to be used for all mail service in the Internet.

Data Connection Management​

a. Default Data Connection Ports: All FTP implementations must support use of the default data connection ports, and only the User-PI may initiate the use of non-default ports.

b. Negotiating Non-Default Data Ports: The User-PI may specify a non-default user side data port with the PORT command. The User-PI may request the server side to identify a non-default server side data port with the PASV command. Since a connection is defined by the pair of addresses, either of these actions is enough to get a different data connection, still it is permitted to do both commands to use new ports on both ends of the data connection.

c. Reuse of the Data Connection: When using the stream mode of data transfer the end of the file must be indicated by closing the connection. This causes a problem if multiple files are to be transfered in the session, due to need for TCP to hold the connection record for a time out period to guarantee the reliable communication. Thus the connection can not be reopened at once.

There are two solutions to this problem. The first is to negotiate a non-default port (as in (b) above). The second is to use another transfer mode.

A comment on transfer modes. The stream transfer mode is inherently unreliable, since one can not determine if the connection closed prematurely or not. The other transfer modes (Block, Compressed) do not close the connection to indicate the end of file. They have enough FTP encoding that the data connection can be parsed to determine the end of the file. Thus using these modes one can leave the data connection open for multiple file transfers.

Why this was not a problem with the old NCP FTP:

The NCP was designed with only the ARPANET in mind. The ARPANET provides very reliable service, and the NCP counted on it. If any packet of data from an NCP connection were lost or damaged by the network the NCP could not recover. It is a tribute to the ARPANET designers that the NCP FTP worked so well.

The TCP is designed to provide reliable connections over many different types of networks and interconnections of networks. TCP must cope with a set of networks that can not promise to work as well as the ARPANET. TCP must make its own provisions for end-to-end recovery from lost or damaged packets. This leads to the need for the connection phase-down time-out. The NCP never had to deal with acknowledgements or retransmissions or many other things the TCP must do to make connection reliable in a more complex world.

LIST and NLST​

There is some confusion about the LIST an NLST commands, and what is appropriate to return. Some clarification and motivation for these commands should be added to the specification.

Multiple 1xx Replies​

There is some difference of opinion about the use of multiple 1xx responses during command processing. This issue comes up particularly in processing the RETR and STOR commands. The two opinions are summarized below.

For Exactly One 1xx Response:

When a RETR or SEND command is started, the server is supposed to give an "intermediate reply" of 1xx when it is opening the data connection. Currently, some FTP servers give two 1xx messages. This causes problems for single-thread FTP user implementations. After reading the first intermediate reply, they go off to do the transfer. The second 1xx message is not seen until the end of the transfer. The RFC gives a state diagram of the form:

--------->Wait--------->
/ \
^ |
| V
\ /
<-----

This implies any number of 1xx's (including 0). There is a suspicion that this is just sloppy diagraming, and that the intent is clear from other parts of the RFC.

The FTP specification states that the reason for intermediate replies is to allow implementations that can't do any better to know when to stop listening to the control channel and switch their attention to the data channel. Given this intent, it seems clear that there should be exactly one 1xx reply at the start of the transfer.

The FTP specification is ambiguous in this regard. The state diagrams appear to sanction any number of responses. But the charts before them do not. And from the intent, it seems obvious that exactly one is the right thing.

Consider an implementation on a PC. It is fairly hard to do parallel processing there. It should be possible for a PC implementation to stop paying attention to the control channel and start reading the file from the data channel when he sees the 1xx response. The only way this can work is if there is only one 1xx response.

Of course, one could make it a requirement that every FTP implementation must be based on good enough interrupt technology so that it can field extra responses during the transfer. But what would such a constraint buy? Just the ability to have both a 125 and a 150 response. It doesn't seem worth the price. You could just as well combine the information in those responses into a single one.

For Multiple 1xx Responses:

The multiple 1xx messages arose because the new TCP specification omitted the 050 spontaneous reply code. A solution was to change an 050 informational message to a 1xx message, creating both a 125 and a 150.

The state diagrams clearly allow this, and the "Command-Reply Sequences" section does not contradict it. A multiple 1xx implementation is in accord with the formal reply specifications.

A multiple 1xx implementation works with the TOPS-20 FTP's and with a number of different UNIX implementations, and the LOCUS system. So, a lot of implementors must follow state diagrams in preference to prose.

However, the observation is certainly correct that page 34 of the specification suggests that 1xx replies can be used by single-thread user implementations to switch attention to the data connection. This would allow only a single 1xx message, in contradiction to the state diagrams. It seems a bit strong, however, to call the one sentence on page 34 "the intent" of the specification, since it is contradicted by the format specification of replies.

A side discussion favoring more status information:

One view has always assumed a two-thread implementation. In this view, most user implementations are deficient because they do not allow the user to enter a STATUS command during data transfer. A cynic might say that is because the Computer Scientists who did these implementations only do "Toy" file transfers, and often use "Toy" operating systems.

There has been some complaints from the Toy systems crowd recently that FTP is too complicated. Well, it may be too complicated for Toy systems, but in fact it is too simple for many Real file systems. For example, it has no way to encode a "library" (i.e., a named collection of subfiles). It is (barely) adequate for shipping around files of text, but not much more.

With the notable exception of Multics and UNIX, many operating systems support complex file structures of which the user must be aware. One is not doing the user a favor by hiding details that may reach out and bite him. That is the reason some FTPs put out a large informative message at the beginning of the transfer, specifying the file baroqueness that is involved. As a Computer Scientist, you may find that message annoying, but if you had to use MVS very much, you would find it helpful, informative, and maybe even reassuring. Some believe that as DARPA technology moves into the production environment of DDN, there will be user requirements for such informative messages for a variety of vendor operating systems.

To provide important information to the user the specification should either allow multiple 1xx messages, or restore the old spontaneous reply category. In fact, the latter is preferable; this information should be displayed to the user, but a user FTP might swallow 1xx messages without displaying their text.

The Answer:

Following the Robustness Principle (a protocol implementation ought to inflict minimal pain and accept maximal pain) there should be only one 1xx response. That is, those FTP servers that now issue two 1xx responses should combine them.

OTHER REFERENCES:

  • RFC 678 - Document File Format Standards
  • MIL-STD-1780 - File Transfer Protocol

DEPENDENCIES: Transmission Control Protocol

CONTACT: [email protected]