Re: a better ftp URL

John C Klensin (KLENSIN@INFOODS.MIT.EDU)
Sun, 05 Dec 1993 18:29:20 -0500 (EST)

Date: Sun, 05 Dec 1993 18:29:20 -0500 (EST)
From: John C Klensin <KLENSIN@INFOODS.MIT.EDU>
Subject: Re: a better ftp URL
In-Reply-To: <199311292327.SAA03378@wilma.cs.utk.edu>
To: moore@CS.UTK.EDU
Message-Id: <755134160.372089.KLENSIN@INFOODS.UNU.EDU>

>Best idea I have had (to retain backward compatibility) is to assume that '/'
>is a directory separator...you have to do a separate CWD for each one. so if
>the filename portion is a/b/c/d/e you have to do
>
>CWD a
>CWD b
>CWD c
>CWD d
>RETR e

Keith,
In the general case, this won't work. It depends, modulo the option
you identified (correctly, IMHO) as "yeech!", on the assumptions that
(i) file systems are hierarchical and (ii) unqualified CWD is
interpreted as relative to the current directory. E.g., the above will
cause the same impact as:
CWD a CWD a CWD a
CWD ./b CWD [.b] CWD .\b
etc., for UNIX, VMS, and MSDOS, respectively. But nothing in the FTP
protocol requires that interpretation. A server could implement the
"CWD b" as
CWD /b CWD [b] CWD \b
without violating the spec (even with the "should" in Appendix II of
RFC959 considered), although that behavior would be surprising given
tradition.

More important, since there is no canonical way for a client to
determine if a server supports a hierarchical file system, and no rule
that "/" cannot appear in a local file name,
a/b/c/d/e
could be correctly construed as
CWD a
RETR b/c/d/e (an atomic name)
while the sequence you suggest above would cause
CWD d
RETR e
after a certain amount of useless thrashing around.

If one takes the FTP protocol seriously, there is, I think, only one
rational model, which is that the client has to know the difference, in
a system-independent way, between (i) what is to be used as an argument
to CWD and (ii) what is to be used as an argument to RETR. The first
can obviously be null.

And, as Marshall points out, that is exactly what we have in the MIME
external reference form: distinct tokens for "dir" and "name".
Independent of MIME, and using various syntax conventions, working with
that breakdown has 20+ years of successful operational experience behind
it.

john