summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch/fetch.c
Commit message (Collapse)AuthorAgeFilesLines
* Document the fact that passive mode is now the default.des2011-09-271-1/+1
| | | | Update copyright dates and strip my middle name.
* Use fseeko() instead of fseek(). The rest of the code is off_t-aware,des2011-09-271-2/+2
| | | | | | | | but the use of fseek() means fetch(1) can't correctly resume a transfer that was interrupted past the 2 GB mark. Pointed out by: ache@ MFC after: 3 weeks
* Followup to r225599: the fseek() was a no-op since the file was openeddes2011-09-271-8/+8
| | | | | | | | | in append mode. Open it in read-write mode instead. Also move the fseek up one level to cover the (unlikely but not impossible) case where the server accepts ranges but does not send a Content-Size header. PR: bin/117277 MFC after: 3 weeks
* When resuming an HTTP download, we failed to verify that the rangedes2011-09-151-0/+14
| | | | | | | | | | | | | | | | returned by the server matched what we requested, and blindly appended what we received to what we already had. This could go two ways: if the delivered offset was higher than expected, the local file would contain duplicate data, while if it was lower than expected, there would be data missing from the middle of the file. Furthermore, if the transfer was interrupted again, each subsequent attempt would compound the error. Fix the first problem by restarting the transfer from scratch if there is a gap, and the second by explicitly seeking to the correct location in the local file so as to overwrite any duplicated data. PR: bin/117277 Approved by: re (kib) MFC after: 3 weeks
* Treat an empty argument as an error, instead of fetching theru2009-12-301-0/+5
| | | | | | contents of the root directory. MFC after: 1 week
* Revert most part of 200420 as requested, as more review and polish isdelphij2009-12-131-0/+1
| | | | needed.
* Remove unneeded header includes from usr.bin/ except contributed code.delphij2009-12-111-1/+0
| | | | Tested with: make universe
* The FTP_TIMEOUT and HTTP_TIMEOUT environment variables were ignored becausedes2009-01-171-3/+4
| | | | | | | | T_secs already had a non-zero default. Unbreak by moving the default to ftp_timeout / http_timeout. Submitted by: Christoph Mallon <christoph.mallon@gmx.de> MFC after: 2 weeks
* 1. Update fetch to consistently return 1 on error, as the man page states,murray2008-12-171-6/+5
| | | | | | | | | | | | | | | | | | | | | | rather than usually returning 1 but in a few instances using a sysexits(3) return value. 2. Remove a few unused variables from libfetch. PR: docs/122470 (1, only) Reviewed by: des > Description of fields to fill in above: 76 columns --| > PR: If a GNATS PR is affected by the change. > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > Security: Vulnerability reference (one per line) or description. > Empty fields above will be automatically removed. M usr.bin/fetch/fetch.c M lib/libfetch/fetch.c
* Add support for HTTP 1.1 If-Modified-Since behavior.murray2008-12-151-4/+25
| | | | | | | | | | | | | | fetch(1) accepts a new argument -i <file> that if specified will cause the file to be downloaded only if it is more recent than the mtime of <file>. libfetch(3) accepts the mtime in the url structure and a flag to indicate when this behavior is desired. PR: bin/87841 Submitted by: Jukka A. Ukkonen <jau@iki.fi> (partially) Reviewed by: des, ru MFC after: 3 weeks
* Improve usage and sync SYNOPSIS with usage.ru2008-12-131-4/+5
|
* Apply the same defaults to https as to http.des2008-12-111-2/+3
| | | | | Submitted by: Mike Tancsa <mike@sentex.net> MFC after: 1 week
* Use the SCHEME_ knobs rather than knowing what they expand to.obrien2008-08-211-2/+2
| | | | Reviewed by: des
* Try to preserve ownership and permissions when replacing an existing file.des2006-11-101-0/+2
| | | | | | PR: bin/104702 Submitted by: Kevin Day <toasty@dragondata.com> MFC after: 1 week
* Only clear sb.st_size if it is clearly wrong or meaningless. This fixesdes2005-12-301-5/+5
| | | | | | | mirror mode. PR: bin/86940 MFC after: 2 weeks
* Reflect progress in process title.des2005-12-301-0/+4
| | | | | Submitted by: flz MFC after: 2 weeks
* Fix buffer overflow. This is FreeBSD-SA-04:16.fetch.cperciva2004-11-181-1/+2
| | | | Approved by: des
* Update copyright years.des2004-09-211-1/+1
|
* The check for r_flag was accidentally removed in the previous commit.des2004-08-261-1/+1
| | | | | Submitted by: SANETO Takanori <sanewo@ba2.so-net.ne.jp> MFC after: 3 days
* Fix a couple of edge cases in which sb.st_size may be incorrect ordes2004-08-151-5/+16
| | | | | | | | meaningless. In particular, don't assume that it is left untouched if stat(2) fails; that assumption happens to fail at high optimization levels on some platforms. MFC after: 1 week
* Don't strip trailing linear whitespace from passwords.des2004-07-271-5/+5
| | | | MFC after: 2 weeks
* Style nits.des2004-07-271-5/+4
|
* Truncate long file names in stat_display(), as was originally intended.des2004-07-051-1/+1
| | | | MFC after: 1 week
* The description of the -S option in the man page says we won't fail if thedes2004-06-241-1/+0
| | | | | | | remote size is unknown, but we do. Resolve this in the man page's favor. Requested by: Andre Albsmeier <andre.albsmeier@siemens.com> MFC after: 1 week
* Fix integer overflow in the file size output when dealing withle2004-05-191-3/+3
| | | | | | large files (i.e. DVD images). Reviewed by: des@
* Workaround for servers that ignore byte ranges when using chunkeddes2004-04-061-1/+1
| | | | | | encoding. MFC after: 3 days
* Use %zu for size_t, like God intended.des2004-02-181-1/+1
|
* Fix printf() format bug in previous commit (size_t != int).des2004-02-181-17/+19
| | | | | | | Use %ju and an (uintmax_t) cast to print size_t values. Use %jd and an (intmax_t) cast to print off_t values. Use off_t variables to hold the difference between two off_t values. Don't bother with unsigned char where char will do nicely.
* Revamp the statistics code, and switch to a much more compact displaydes2004-02-181-48/+56
| | | | | format. The old code tried to produce the exact same output as the pre-libfetch implementation, but I no longer see any value in this.
* Use floating point arithmetic to compute the ETA to avoid integer overflowdes2003-03-111-1/+1
| | | | during slow transfers of large files.
* Clean up the ETA logic a bit and make sure it works for restarted transfers.des2003-03-111-7/+8
|
* Slight cleanup of the ETA / BPS code. Avoid a division by zero.des2003-01-231-14/+12
|
* Add -N option to specify a netrc file.des2003-01-221-29/+66
| | | | | | | Fix handling of -v option. Don't treat negative offsets as valid positive ones. Clean up the ETA and transfer rate code. Show transfer rate along with ETA if the verbose level is higher than 1.
* Use the URL instead of the output file name when reporting errors relatingdes2002-11-271-6/+6
| | | | | | | | to the remote document. PR: 33856 MFC after: 1 week Approved by: re
* Don't set atime / mtime if we don't have an output file, which can happendes2002-11-131-2/+2
| | | | in certain failure scenarii (mostly DNS trouble).
* Don't divide by zero to calculate the ETA, even if we haven't gottenfenner2002-11-121-1/+1
| | | | any data in 30 seconds.
* Don't exit with success after timeout during authentication.fenner2002-11-071-0/+4
|
* Don't complain about not knowing the remote file size when working indes2002-10-271-1/+1
| | | | | | | quiet mode. PR: bin/37079 Submitted by: Nicolas Rachinsky <list@rachinsky.de>
* Whitespace and indentation cleanup.des2002-10-271-12/+12
|
* Forgot to disable alarms after fetchXGet() in previous commit.des2002-10-271-0/+2
|
* Add an ETA timer that kicks in after 30 seconds.des2002-10-271-16/+45
| | | | | | | | | | | | | | | | Re-add alarm(2) calls around the calls to fetchStat(3) and fetchXGet(3), since these calls can still time out on DNS lookups or TCP connect(2). Remove the alarm(2) calls in the main loop, since all methods properly handle transfer timeouts (as opposed to connection timeouts). Set the sigalrm flag if a timeout occurs in the main loop. Move the signal: label up a little so we still set the atime and mtime when the transfer times out or is interrupted, so that restarted transfers will work as expected (as long as the file still exists). MFC after: 2 weeks
* s/optarg/s/ (cut'n'paste braino)des2002-08-271-6/+4
| | | | Spotted by: kris
* Use strtol(3) instead of a home-grown version, and fix a "possiblydes2002-07-281-36/+24
| | | | unitialized variable" warning.
* Usage style sweep: spell "usage" with a small 'u'.des2002-04-221-1/+1
| | | | | Also change one case of blatant __progname abuse (several more remain) This commit does not touch anything in src/{contrib,crypto,gnu}/.
* Restored the part of 1.45 that was clobbered in rev.1.46:bde2002-03-271-0/+1
| | | | | #include <sys/time.h> instead of depending on namespace pollution in <sys/stat.h> for the declaration of struct timeval.
* Add FBSDID. Remove unused include. Getopt returns -1 not EOF.charnier2002-03-261-5/+5
|
* #include <sys/time.h> instead of depending on namespace pollution inbde2002-02-251-2/+2
| | | | | | | | | <sys/stat.h> for the declaration of struct timeval. Removed unused includes (<time.h> doesn't declare anything of interest; only <sys/time.h> does). Sorted includes a bit.
* If downloading to a temporary file, set the timestamp on the temp file, notdes2002-02-161-2/+2
| | | | | | | | on the file we're replacing. PR: bin/34992 Submitted by: Shunichiro Ariura <syun1rou@blackshell.org> MFC after: 1 week
* Set fetchDebug if v_level is 3 or more.des2001-12-091-0/+2
| | | | | PR: bin/32615 MFC after: 1 week
* Remove an extraneous argument to fprintf that -Wformat noticed.iedowse2001-11-101-1/+1
| | | | Reviewed by: des
OpenPOWER on IntegriCloud