Subject: [1.4beta/i386 boot floppy] ftp url parsing
To: None <current-users@netbsd.org>
From: Jun-ichiro itojun Hagino <itojun@itojun.org>
List: current-users
Date: 04/23/1999 11:33:25
	Hello, I may be confused...

	Last night I performed fresh installation of 1.4beta/i386, using the
	following boot floppy images:
MD5(boot1.fs.gz)= 0a2e24e85e0097d025e700a20d23965e
MD5(boot2.fs.gz)= 16ce8b529be49b941b18f7eea980ac27

	I used non-anonymous ftp from sysinst, like:
		user: itojun
		password: secret
		host: myhost.itojun.org
		path: /export4/home/itojun/NetBSD-1.4beta
	Then, sysinst shows a URL on the console, like:
		ftp://itojun:secret@myhost.itojun.org/export4/home/itojun/NetBSD-1.4beta
	But, it actually tries to grab:
		~itojun/export4/home/itojun/NetBSD-1.4beta
	not:
		/export4/home/itojun/NetBSD-1.4beta

	"ftp:" URL parsing rule strips off the slashes at the head (see
	attached).

	I specified the pathname
		../../../export4/home/itojun/NetBSD-1.4beta
	as workaround.

	I would like to know the reason for this behavior.  The behavior
	can easily be fixed to conform to RFC, by sending "CWD /" just after
	the ftp login (just give me a pointer...).

	If it is too late to fix it, I think this should be documented
	somewhere, maybe INSTALL.txt.  This confused me a bit.

	Thanks,

itojun
PS: http://www.itojun.org/diary/19990422/ contains kernel config file diff
and a kernel image for Sony vaio 505EX (called 505FX in US), based on
sys.tar.gz dated 4/21.




---
src/usr.bin/ftp/fetch.c:

/*
 * Parse URL of form:
 *	<type>://[<user>[:<password>@]]<host>[:<port>]/<url-path>
 * Returns -1 if a parse error occurred, otherwise 0.
 * Only permit [<user>[:<password>@]] for ftp:// URLs
 * It's the caller's responsibility to url_decode() the returned
 * user, pass and path.
 * Sets type to url_t, each of the given char ** pointers to a
 * malloc(3)ed strings of the relevant section, and port to
 * the number given, or ftpport if ftp://, or httpport if http://.
 *
 * XXX: this is not totally RFC1738 compliant; path will have the
 * leading `/' unless it's an ftp:// URL; this makes things easier
 * for file:// and http:// URLs. ftp:// URLs have all leading `/'s
 * removed.
 */