About bug 486 - wget - Can't reproduce

Tito farmatito at tiscali.it
Sun Dec 18 11:44:35 UTC 2005


Original bug report:
 0000486: busybox wget prepends a '/' to ftp URL's pathname, unlike GNU wget
Description 	busybox 1.01 "wget ftp://host/path/file" [^] sends the string "RETR /path/file" to the FTP server.
 But the regular GNU wget(1) it is imitating would send "RETR path/file", a relative path to the home directory. 
The URL must be "ftp://host//path/file" [^] for GNU wget to fetch the absolute filepath.

Mozilla, and even IE do as GNU wget.

Looking at the source, the leading '/' is hard coded into wget.

patch attached.

However fixing this will break any busybox users dependant on the current behavior.
(then again, not fixing it means busybox wget is not behaving like GNU wget and cannot support relative paths)

END

Hi,
to all,
I cannot reproduce this as stated for the original GNU Wget 1.10, in fact:

wget ftp://ftp.f-prot.com/pub/linux/fp-linux-ws_4.6.3-1_i386.deb
--12:19:44--  ftp://ftp.f-prot.com/pub/linux/fp-linux-ws_4.6.3-1_i386.deb
           => `fp-linux-ws_4.6.3-1_i386.deb'
Resolving ftp.f-prot.com... 213.220.100.10
Connecting to ftp.f-prot.com|213.220.100.10|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD /pub/linux ... done.
==> PASV ... done.    ==> RETR fp-linux-ws_4.6.3-1_i386.deb ... done.
Length: 3,976,408 (3.8M) (unauthoritative)

 0% [                                     ] 7,300          1.11K/s    ETA 58:15

wget ftp://ftp.f-prot.com//pub/linux/fp-linux-ws_4.6.3-1_i386.deb
--12:21:03--  ftp://ftp.f-prot.com//pub/linux/fp-linux-ws_4.6.3-1_i386.deb
           => `fp-linux-ws_4.6.3-1_i386.deb.1'
Resolving ftp.f-prot.com... 213.220.100.10
Connecting to ftp.f-prot.com|213.220.100.10|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD /pub/linux ... done.
==> PASV ... done.    ==> RETR fp-linux-ws_4.6.3-1_i386.deb ... done.
Length: 3,976,408 (3.8M) (unauthoritative)

 0% [                                     ] 0             --.--K/s

with or without the additional / , wget seems to do the exactly same thing:

CWD to the last directory and RETR file.

Also for busybox wget it seems not to matter if we put one more / in the path:

./busybox wget ftp://ftp.f-prot.com/pub/linux/fp-linux-ws_4.6.3-1_i386.deb
Connecting to ftp.f-prot.com[213.220.100.10]:21
USER anonymous
PASS busybox@
CDUP
TYPE I
SIZE /pub/linux/fp-linux-ws_4.6.3-1_i386.deb
PASV
RETR /pub/linux/fp-linux-ws_4.6.3-1_i386.deb
fp-linux-ws_4.6.3-1_   0% |                             |  2560       52:47 ETA

./busybox wget ftp://ftp.f-prot.com//pub/linux/fp-linux-ws_4.6.3-1_i386.deb
Connecting to ftp.f-prot.com[213.220.100.10]:21
USER anonymous
PASS busybox@
CDUP
TYPE I
SIZE //pub/linux/fp-linux-ws_4.6.3-1_i386.deb
PASV
RETR //pub/linux/fp-linux-ws_4.6.3-1_i386.deb
fp-linux-ws_4.6.3-1_   0% |                             |  2560     2:09:28 ETA

as it uses another procedure:
no CWD and RETR full_path.

So or I did not understand the bug report or at least I can't reproduce it on this ftp server.

BTW it would be easy to add verbose output (which is default in GNU wget) to busybox wget, just one more printf in ftpcmd(),
and turn it off with the -q flag.
if there is some interest I can do this for 1.2 or 1.1

static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf)
{
	if (s1) {
		if (!s2) s2="";
		fprintf(fp, "%s%s\r\n", s1, s2);
		fflush(fp);
	}

static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf, int quiet)
{
	if (s1) {
		if (!s2) s2="";
		fprintf(fp, "%s%s\r\n", s1, s2);
		if(!quiet)
		    printf("%s%s\n", s1, s2);
		fflush(fp);
	}


Hints?

Ciao,
Tito



More information about the busybox mailing list