summaryrefslogtreecommitdiff
path: root/usr.bin/ftp/fetch.c
AgeCommit message (Collapse)Author
2010-08-25don't free proxyurl and cookie twice in the location code; with halex@Martynas Venckus
2010-07-23Handle redirection to relative url's in the Location: header of httpAlexander Hall
responses. Yes, they are violating the rfc's. Yes they do exist anyway. Also fix a memory leak when url_encode fails to malloc, by simply err'ing out if so. feedback and ok phessler@
2010-07-03make lint happyAlexander Hall
ok phessler@
2010-06-29fix output handling:Alexander Hall
- if a remote file by the name '-' is retrieved, that does not imply it should go to standard output... - make -o '' reset any previous -o action - properly handle multiple -o 's ok phessler@
2010-06-03HTTP/1.1 requests must send a "Connection: close" header. Fixes the issue whereAlexander Hall
a download would stall at the end of the file for no apparent reason. ok sthen@, phessler@
2010-06-03When attempting to resume a download, against an HTTP server thatPeter Hessler
doesn't support resume, we restart the download from the beginning, like all other browsers. Diagnosed by sthen and halex, comment from sthen OK sthen@, halex@
2009-10-16factor psummary code of ftp.c to be generic, for all types ofMartynas Venckus
transfers. makes output between all transfers consistent; handles SIGINFO for non-ftp transfers too; shows statistics at the end: 7303400 bytes received in 96.00 seconds (74.29 KB/s) tweak / ok halex@, sthen@.
2009-08-26In "auto-fetch" mode without -o, the filename to save under is derivedStuart Henderson
from the URL. In cases where the URL supplied on the command-line returned an HTTP redirection, ftp(1) was changing the filename to one derived from the redirected URL. Change this to always use a name derived from the command-line URL. Avoids unexpected behaviour with URI-encoded redirection URLs as seen by matecocido on misc@, and avoids surprises when the redirection is to an unexpected filename. No change when -o is used. ok martynas@ deraadt@ "I totally approve" halex@
2009-08-06encode special or unsafe characters defined by rfc1738. as a result,Martynas Venckus
- urls passed to ftp containing special characters or unsafe characters (like, spaces, <>"#{}|\^~[]`%) work - redirects containing special characters or unsafe characters (like, spaces, <>"#{}|\^~[]`%) work reported & tested by ian@ (can fetch a distfile from sourceforge now) feedback + ok tedu@ & sthen@
2009-08-03tweak error message. url is valid per rfc1738 and can now beMartynas Venckus
fetchable with -o. so point to it too. requested by chris@ ok sthen@. better halex@
2009-07-27- make urls such as http://foo, http://foo/, or http://foo/bar/Martynas Venckus
fetchable, if -o outfile is passed. outfile will be used as a local filename - fix a bug where 'no file after host' code path never got entered; consider no file after dir invalid; as code intended proxy help&ok halex@; testing(including proxies,pkg_add)&ok sthen@; looks good to millert@
2009-07-18Don't assign NULL to an integer type, use 0 instead.Jonathan Gray
No binary change.
2009-06-29Fix the range of a #ifndef SMALL ... #endif not to include the "break;"Alexander Hall
needed not to make a status of 200 (OK) fall through to the redirect handling. This was not noticed since the later code would ignore the isredirect flag unless it also received a "Location: " header. ok martynas@
2009-06-13- stat is not fatal, since we want resume not to fail for non-existentMartynas Venckus
file transfers in all cases - do it a bit earlier and use HTTP/1.0 if we won't send the range header - change resume -> restart_point where it is intended ok halex@, millert@
2009-06-04silently ignore -a if a username is supplied in the urlAlexander Hall
"looks sensible" deraadt@, "fine by me" martynas@ also removed an indeed misplaced/outdated comment per martynas@ request
2009-06-04set anonftp a little later; in autofetcher itself. after weMartynas Venckus
actually know that that login is not provided in url; and we should guess it. fixes a bug reported by halex@ where it tried to login as 'ftp' after unsuccessful logins; ok theo, halex@, krw@
2009-05-10couple of fixes for fetch:Martynas Venckus
- don't spam ftp server with four anonftp logins; if ftp_login has already failed in setpeer we give up. also makes install script nicer; req'd by theo - fix autologin = no case which never really worked in fetch since it did not check for autologin before logging in... part 1: ok theo, krw@ part 2: "looks right" millert@, ok sthen@
2009-05-05make it clean removing the ifdef SMALL maze. separate cmds andMartynas Venckus
small stuff. make it a fetcher. shrinks quite a bit agreed by millert@, krw@ ok theo, sthen@
2009-04-27toast the rcsid strings which just get in the wayTheo de Raadt
2009-04-26figure out titles automatically by using remote file name. removeMartynas Venckus
-T and just show titles by default for non-verbose transfers; discussed with, ok theo, sthen@
2008-10-16- resume http transfers [-C], if local file does not existMartynas Venckus
- resume ftp transfers [-C, reget, mget], if local file does not exist ok theo
2008-10-16use O_CREAT in -C mode too, for in case it is not there the first timeTheo de Raadt
from frantisek holop, ok millert
2008-09-26support proxies with password.Marc Espie
adapted from a patch by nikns, with tweaks by millert. took forever to test for real... okay miod@, henning@, millert@
2008-07-08- add support for recursive transfers (but not for floppies), e.g.Martynas Venckus
'mget -cr 4.*' would recursively fetch (-r), and resume the previous transfers (-c) of 4.X release directories uses local matching (fnmatch), but only for recursive transfers. current behavior is not changed in any way. - while here, ifndef SMALL debugging stuff, this saves some space, for floppies - some debugging code was enabled for non-debugging mode, checks assume debug is set to zero, but it's not initially set - all "Confirm with" prompts are forced, remove redundant argument - fix usage: -C and -c are not available for SMALL discussed a year ago w/ pyr@ looks good to millert@ previous version looked good to pyr@ man page tweaks & ok jmc@
2008-06-26First pass at removing clauses 3 and 4 from NetBSD licenses.Ray Lai
Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
2008-06-25in resume mode, pass -c to mget when {dir,file}hasglob, so that i'mMartynas Venckus
able to continue multiple transfers with -C; ok millert@ while here fix some comments (!SMALL vs. SMALL stuff), and add missing
2008-06-15accept empty password, since that's exactly what rfc1738 tells usMartynas Venckus
to do; theo agrees, millert oks
2008-06-15in debug mode (-d), hide password in the same way as command() does;Martynas Venckus
ok millert@
2007-11-26implement -C for continuing ftp, http(s), and file transfersMartynas Venckus
ok millert@, pyr@
2007-06-13Enable cookie support. This allows parsing of netscape-like cookie jarsPierre-Yves Ritschard
and sending of appropriate cookies. No retrieval of new cookies is done. Careful review and lots of input by millert and ray. ok millert@, ray@
2007-04-17Support proxies which require a password just like ftp servers accept passwordsDale Rahn
based on code from Florent Thoumie, ok millert@
2007-02-08Remove double semicolons.Ray Lai
From Pierre Riteau <pierre dot riteau at free dot fr>. OK jaredy@ and moritz@.
2007-02-03Plug memory leak.Ray Lai
OK otto@.
2006-09-25You forgot about -DSMALL and broke all the install mediaTheo de Raadt
2006-09-25Support some additional HTTP redirect codes.Jonathan Gray
"looks good" pedro, fgsch, ok otto
2006-07-07Remove extraneous code:Ray Lai
- Instead of generating the same string twice using printf, generate once and reuse. - Use err instead of errx with strerror. OK otto@
2006-06-23free and sl_free already check against NULL, remove a few unneeded ifs.Steven Mestdagh
ok otto
2006-06-01Remove two unnecessary strlen() calls. Also, check if asprintfRay Lai
returns -1 instead of checking if connstr == NULL. OK beck@, moritz@
2006-05-25No matter how big the buffer size is, always limit to INT_MAX forRay Lai
SSL connections, due to SSL_read()'s prototype. This allows us to change ftp_read to return size_t and have it return (0) on error, just like fread(). OK otto@, beck@
2006-05-25Don't recalculate string length, just use return value from vasprintf.Ray Lai
While here, remove pointless void pointer cast. OK otto@, beck@
2006-05-25Minor type correction.Ray Lai
OK otto@
2006-05-16Remove shadowing variables and properly use /* FALLTHROUGH */Ray Lai
comments. No binary change. Found by lint. OK beck@, deraadt@
2006-05-16https URL support; rototilled by a few people including me; originallyTheo de Raadt
from Rainer_Giedat@genua.de
2006-04-25two strtol calls that were begging to be converted to strtonumTed Unangst
2006-04-03Ignore http_proxy for file urls; ok millert deraadtUwe Stuehler
2006-03-29fix fetching zero-length files via proxy. while there, also fix progress-meterAlexander von Gernler
for files >2GB via proxy. help and discussion otto@, ok otto@ mickey@
2006-02-01save errno, from Ray Lai in PR 4999.Otto Moerbeek
2005-08-05when i did the cleanup and switched to http 1.1, i forgot to add chunkedFederico G. Schwindt
support. while it's being tested switch to 1.0. noticed and tested by nick@.
2005-07-18some cleanup and on non-proxy operation switch to HTTP 1.1 since we'veFederico G. Schwindt
using some sort of it for a long time now; shrinks ~200 bytes. ok by millert@ and sturm@.
2005-04-21avoid infinite recursion on redirects; From NetBSD but limit set to 10.Federico G. Schwindt
deraadt@ ok.