On 11/05/13 13:56, Stefan Sperling wrote:
Before:
$ ftp ' http://localhost/snap/INSTALL.amd64'
ftp: http: no address associated with name
ftp: Can't connect or login to host ` http'
After:
$ ftp ' http://localhost/snap/INSTALL.amd64'
Trying ::1...
Trying 127.0.0.1...
Requesting http://localhost/snap/INSTALL.amd64
100% |**************************************************| 84357 00:00
84357 bytes received in 0.00 seconds (267.27 MB/s)
Do others think this useful? I hit this because I made copy/paste errors.
Unless you can give a reference saying an URL may start with arbitrary
whitespace, I don't want this to go in. It feels like PHP.
/Alexander
Index: fetch.c
===================================================================
RCS file: /cvs/src/usr.bin/ftp/fetch.c,v
retrieving revision 1.110
diff -u -p -r1.110 fetch.c
--- fetch.c 27 Oct 2013 18:31:24 -0000 1.110
+++ fetch.c 28 Oct 2013 11:57:32 -0000
@@ -1082,6 +1082,9 @@ auto_fetch(int argc, char *argv[], char
if (url == NULL)
errx(1, "Can't allocate memory for auto-fetch.");
+ while (isspace(*url))
+ url++;
+
/*
* Try HTTP URL-style arguments first.
*/