Subject: Re: [1.4beta/i386 boot floppy] ftp url parsing
To: Luke Mewburn <lukem@goanna.cs.rmit.edu.au>
From: Alan Barrett <apb@iafrica.com>
List: current-users
Date: 04/27/1999 19:34:57
Luke Mewburn wrote:
> Again, this is *NOT A BUG IN FTP*.
> 
> If you use the URL syntax to retreive files, then you get the
> `benefit' of ftp parsing the URL as per RFC 1738.
> 
> RTFM. RTFRFC.

Actually, there are problems in both sysinst and ftp.

If you call ftp with an URL like "ftp://u:p@h/%2Fexport4/home/file.tgz"
then it should do this:

	USER u
	PASS p
	CWD /export4
	CWD home
	RETR file.tgz

but it actually does this:

	USER u
	PASS p
	CWD /export4/home
	RETR file.tgz

According to RFC 1738, if you want the latter behaviour then you should use
the URL "ftp://u:p@h/%2Fexport4%2Fhome/file.tgz".

This is a bug that's unlikely to catch many people, but it's a bug
in NetBSD's ftp nonetheless.  I sent a fix earlier today, in PR 7484.

If you tell sysinst "fetch stuff from an ftp server using the
following parameters: host h, user u, password p, directory
/export4/home" then sysinst calls currently calls ftp with
URLs like "ftp://u:p@h/export4/home/file.tgz" with URLs like
"ftp://u:p@h/export4/home/file.tgz", whereas it seems reasonable
to argue that sysinst should rather call ftp with URLs like
"ftp://u:p@h/%2Fexport4/home/file.tgz" (changing a leading "/" to "%2F",
but leaving other slashes alone).  It might also be reasonable to argue
that sysinst should change all slashes in the user-supplied directory
name to "%2F", or to argue that the user should be able to choose which
are kept as slashes and which are changed to %2F, or to argue that the
user should type the %2F stuff explicitly if they want it.  If it were my
call, I think I'd say "if there's a leading '/' in the user-supplied
directory name, change it to %2F, but leave all other slashes alone".

--apb (Alan Barrett)