Re: ftpget dirs with non-anon account

From: Hrvoje Niksic <hniksic@dont-contact.us>
Date: 01 Nov 1996 18:00:47 +0100

Jonathan Larmour (JLarmour@origin-at.co.uk) wrote:
> When I use a url of the form: ftp://user:pass@ftp.wibble.com/ all the
> directories are relative to the home directory, and not to root. I thought a
> way round this would be to do e.g.
> ftp://user:pass@ftp.wibble.com//home/fred/ i.e. a double slash, which
> appears to work, until I try to get a file, when it comes back with "Not a
> directory".
> So, what was the answer? Is this one for the FAQ perhaps?

The '/' character has special meaning to the URL parser. The correct
way to specify absolute URL-s should be:
ftp://user:pass@ftp.wibble.com/%2Fhome/fred/

The exact code from RFC1738 follows:

   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".

This "null argument" from the last sentence could be the reason for
"not a directory" (assuming that Squid is RFC1738-compliant in this
respect).

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
I'm a Lisp variable -- bind me!
Received on Fri Nov 01 1996 - 09:08:10 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:33:27 MST