FTP url format??

O'NEEL Bruce beoneel at acm.org
Mon Sep 21 13:38:47 UTC 1998


Hi,
  I think the answer to your question can be found in either RFC 1738
or RFC 1630.  I got them from
http://www.pmg.lcs.mit.edu/cgi-bin/rfc/view?1738 and
http://www.pmg.lcs.mit.edu/cgi-bin/rfc/view?1630 

I think the relevent bits of 1738 are:

**********************************************************************

3.2.2. FTP url-path

The url-path of a FTP URL has the following syntax:

        <cwd1>/<cwd2>/.../<cwdN>/<name>;type=<typecode>

Where <cwd1> through <cwdN> and <name> are (possibly encoded) strings
and <typecode> is one of the characters "a", "i", or "d". The part
";type=<typecode>" may be omitted. The <cwdx> and <name> parts may be
empty. The whole url-path may be omitted, including the "/" delimiting
it from the prefix containing user, password, host, and port.

The url-path is interpreted as a series of FTP commands as follows:

Each of the <cwd> elements is to be supplied, sequentially, as the
argument to a CWD (change working directory) command.

If the typecode is "d", perform a NLST (name list) command with <name>
as the argument, and interpret the results as a file directory
listing.

Otherwise, perform a TYPE command with <typecode> as the argument, and
then access the file whose name is <name> (for example, using the RETR
command.)

Within a name or CWD component, the characters "/" and ";" are
reserved and must be encoded. The components are decoded prior to
their use in the FTP protocol. In particular, if the appropriate FTP
sequence to access a particular file requires supplying a string
containing a "/" as an argument to a CWD or RETR command, it is
necessary to encode each "/".

For example, the URL <URL:ftp://myname@host.dom/%2Fetc/motd> is
interpreted by FTP-ing to "host.dom", logging in as "myname"
(prompting for a password if it is asked for), and then executing "CWD
/etc" and then "RETR motd". This has a different meaning from
<URL:ftp://myname@host.dom/etc/motd> which would "CWD etc" and then
"RETR motd"; the initial "CWD" might be executed relative to the
default directory for "myname". On the other hand,
<URL:ftp://myname@host.dom//etc/motd>, would "CWD " with a null
argument, then "CWD etc", and then "RETR motd".

FTP URLs may also be used for other operations; for example, it is
possible to update a file on a remote file server, or infer
information about it from the directory listings. The mechanism for
doing so is not spelled out here.

**********************************************************************

Reading this points out that one of my implimentations of a FTP url is 
slightly wrong...

cheers

bruce


Ted K. writes:
 > Folks,
 > 	I'd like to know the answer to this question.  In Fetch or FTP you can send commands separately to get ready to read files:
 > 
 > host:   shell.webpage.com
 > user ID: kaehler2
 > password: xxxxx
 > directory: public_html/updates
 > 
 > But, suppose you want to encode this in a url (for use in Netscape):
 > 
 > 	ftp://kaehler2@shell.webpage.com/public_html/updates
 > 
 > The problem is whether "public_html/updates" is absolute or not.  It happens to be relative to the directory for kaehler2.
 > 
 > But suppose I want to get a file from a directory and I know the complete path.  How to do I encode this in a url?
 > 
 > 	ftp://kaehler2@shell.webpage.com/drive1/usr/kaehler2/public_html/updates
 > 
 > Is there an existing convention for this?  What goes between the '.com' and the 'drive1' to indicate an absolute path?  The above gives an error, since the directory kaehler2 does not have a subdirectory called drive1.
 > 
 > What do other systems do to indicate an absolute ftp url?
 > 
 > --Ted.
 > 
 > 
 > Ted Kaehler,   Walt Disney Imagineering, R&D
 > (home) 3415 Cork Oak Way, Palo Alto, CA  94303.  voice (650) 424-1070
 > http://www.webPage.com/~kaehler2/
 > Give me your old Macintosh!   I will put it in a first grade classroom.
 > 
 > 





More information about the Squeak-dev mailing list