I think this would help the port "yt" to not crash on such urls, and I think it uses ftp to collect the youtube movies. For some reason, I paste starting spaces a lot, and since youtube urls contain & and other non-shelly args, I have to paste into a pair of ""'s, and if there is a space to begin with, ftp acts up and "yt" bombs. Sure, yt could do similar whitespace removals (and perhaps should wash better?), but I don't see protocol specs beginning with spaces a lot...
2013/11/5 Alexander Hall <[email protected]> > 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. >> */ >> >> > -- May the most significant bit of your life be positive.
