Skip to main content

Problems in FTP-1 and the Virtues of RFC 640

Well, to sum up, I am pretty happy with the success I've had transferring files around the network the way things are. When I do run into trouble it's generally because some particular host hasn't implemented some particular feature of FTP-1, and there's no reason to suppose they'll do it any faster if they also have to convert to FTP-2 at the same time. The main thing about FTP-2, as I said at the beginning, is that its existence is an excuse for not solving problems in FTP-1. Some such problems are quite trivial except for the fact that people are reluctant to go against anything in the protocol document, as if the latter were the Holy writ. A few actually require some coordinated effort. Here is my problem list:

  1. It is almost true that an FTP user program can understand reply codes by the following simple algorithm:

    • a. Replies starting with 0 or 1 should be typed out and otherwise ignored.

    • b. Replies starting with 2 indicate success (of this step or of the whole operation, depending on the command).

    • c. Replies starting with 4 or 5 indicate failure of the command.

    • d. Replies starting with 3 are only recognized in three cases: the initial 300 message, the 330 password request, and the 350 MAIL response. (Note that the user program need not distinguish which 300 message it got, merely whether or not it is expecting one right now.)

    The only real problem with this, aside from bugs in a few servers whose maintainers tell me they're working on it, is the HELP command, which is not in the original protocol and which returns 0xx, 1xx, or 2xx depending on the server. (Sometimes more than one message is returned.) The word from one network protocol expert at BBN is that (a) 050 or 030 is the correct response to HELP, and (b) there is a perfectly good mechanism in the protocol for multi-line responses. Unfortunately this does not do much good in dealing with reality. There seems to be a uniform, albeit contra-protocol, procedure for handling the STAT command:

    151 information
    151 information
    151 ...
    151 information
    200 END OF STATUS

    which fits right in with the above algorithm. This is despite the fact that 1xx is supposed to constitute a positive response to a command like STAT, so that according to the protocol it ought to be

    151-information
    information
    ...
    151 information

    instead. (It seems to me, by the way, that 050 and 030 aren't good enough as response to HELP since they "constitute neither a positive nor a negative acknowledgment" of the HELP command and thus don't tell the user program when it ought to ask the human user what to do next.) I suggest that despite the protocol, a 200 response be given by all servers at the end of whatever other HELP it gives as of, let's say, June 1. The alternatives are either to let the current rather chaotic situation continue forever while waiting for FTP-2, or to try to standardize everyone on a multi-line 1xx for both HELP and STAT. I'm against changing STAT, which works perfectly for everyone as far as I can tell, and it should be clear that I'm against waiting for FTP-2. Unfortunately there is no real mechanism for "officially" adopting my plan, but I bet if TENEX does it on June 1 the rest of the world will come along.

  2. Another reply code problem is the use of 9xx for "experimental" replies not in the protocol. This includes the BBN mail-forwarding message and one other that I know of. This procedure is sanctioned by RFC 385, but it seems like a bad idea to me. For one thing, the user program has no way of knowing whether the reply is positive, negative, or irrelevant. The examples I've been burned by all should have been 0xx messages. I propose that all such messages be given codes in the 000-599 range, chosen to fit the scheme given above for interpreting reply codes. x9x or xx9 could be used to indicate experiments.

  3. One more on reply: RFC 630 (the one about the TENEX mod to the reply codes for MAIL and MLFL) raises the issue of "temporary" versus "permanent" failures within the 4xx category. RFC 640 deals with this question in the FTP-2 context by changing the meaning of 4xx and 5xx so that the former are for temporary errors and the latter are for permanent errors. I like this idea, and I think it could easily be adapted for FTP-1 use in a way which would allow people to ignore the change and still win. At present, I believe that the only program which attempts to distinguish between temporary and permanent errors is the TENEX mailer. For other programs, no distinction is currently made between 4xx and 5xx responses; both indicate failure, and any retrials are done by the human user based on the text part of the message. A specific set of changes to the reply codes codes is proposed below.

    Perhaps I should make a few more points about RFC 640, since it's the best thing about FTP-2 and the only argument for it I find at all convincing. Let me try to pick out the virtues of 640 and indicate how they might be achieved in FTP-1.

    • a. The 3xx category is used uniformly for "positive intermediate replies" where further negotiation in the Telnet connection is required, as for RNFR. I'm afraid this one can't be changed without affecting existing user programs. (One of my goals here is to enable exiting user programs to work while some servers continue as now and others adopt the suggestions I make below.) However, although this 3xx idea is logically pleasing, it is not really necessary for a simple-minded user program to be able to interpret replies. The only really new 3xx in RFC 640 is the 350 code for RNFR. But this would only be a real improvement for the user program if there were also a 2xx code which might be returned after RNFR, which is not the case. 640 also abolishes the 300 initial connection message with 220, but again there is clearly no conflict here.

    • b. The use of 1xx is expanded to include what is now the 250 code for the beginning of a file transfer. The idea is that a 1xx message doesn't affect the state of the user process, but this is not really true. Consider the file transfer commands. The state diagram on page 13 of RFC 640 is slightly misleading. It appears as if 1xx replies are simply ignored by the user program. In reality, that little loop hides a lot of work: the file transfer itself! If the server replied to the file transfer command immediately with a 2xx message, it would be a bug in the server, not a successful transfer. The real state diagram is more like

      B --> cmd --> W --> 1 --> W --> 2 --> S

      (with branches out from the "W"s for bad replies). It should be clear from this diagram that the user program, if it trusts the server to know what it's doing, can expect a 2xx instead of the 1xx without getting confused, since it knows which of the W states it's in. In fact, the use of 1xx in file transfer is very different from its other uses, which are indeed more like the 0xx and 1xx replies in FTP-1. I'd call this particular point a bug in RFC 640.

    • c. Automatic programs which use FTP (like mailers) can decide whether to queue or abandon an unsuccessful transfer based on the distinction between 4xx and 5xx codes. I like this idea, although those temporary errors virtually never happen in real life. This could be accomplished in FTP-1 by moving many of the 4xx replies to 5xx. Mailers would be modified to use the first digit to decide whether or not to retry. This scheme does not cause any catastrophes; if some server is slow in converting it merely leads to unnecessary retries. A few CPU cycles would be wasted in the month following the official switch. Thus, this feature is very different from (a) and (b), which could lead to catastrophic failures if not implemented all at once. (Yes, I know that FTP-2 is supposed to be done on a different ICP socket. I am not discussing FTP-2 but whether its virtues can be transferred to FTP-1.) The specific codes involved are listed below.

    • d. The use of the second digit to indicate the type of message. (The proposed division is not totally clean; for example, why is 150 ("file status okay; about to open data connection") considered to be more about the file system than about data connection?) This can easily be done, since the second digit is not currently important to any user process-- the TENEX mailer is, in this plan, already due for modification because of (c). Since this is mostly an aesthetic point, I'm hesitant to do it if it would be difficult for anyone. In particular, I would want to leave the 25x messages alone, in case some user programs distinguish these. This is especially likely for the ones which are entirely meant for the program: 251 and 255. Therefore I propose that if this idea is adopted in FTP-1 the meanings of x2x and x5x be interchanged. This proposal is reflected in the specific list below.

  4. The print file thing again. Let's get it made "official" that it is the recipient, not the server, who is responsible for any reformatting which is to be done on these files. After all, the recipient knows what his own print programs want.