Subject: bin/13768: ftp does not handle URLs with no file correctly
To: None <>
From: None <>
List: netbsd-bugs
Date: 08/22/2001 23:01:52
>Number:         13768
>Category:       bin
>Synopsis:       ftp does not handle URLs with no file correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 22 13:58:01 PDT 2001
>Originator:     Anders Dinsen
>Release:        1.5
Anders Dinsen
System: NetBSD kvik 1.5 NetBSD 1.5 (KVIK) #4: Mon Jun 18 10:49:51 CEST 2001 anders@kvik:/amd/box/usr/src/sys/arch/i386/compile/KVIK i386

Specifying an output file with -o disables the check for a file name
part of the URL. Giving an HTTP URL without a file name causes ftp
to produce a bad HTTP GET request.


ftp -o -

produces this nonsense request line:

Apache servers just ignores the request:

ftp -o -
ftp: Improper response from `'

IIS servers are actually more informative:

ftp -o -
ftp: Error retrieving file - `400 Bad Request'
--- fetch.c.orig	Wed Aug 22 22:55:58 2001
+++ fetch.c	Wed Aug 22 22:55:14 2001
@@ -409,7 +409,7 @@
 	if (tport != NULL)
 		*port = xstrdup(tport);
 	if (*path == NULL)
-		*path = xstrdup("");
+		*path = xstrdup("/");
 	if (debug)