History log of /freebsd-10.0-release/usr.bin/fetch/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


253805 30-Jul-2013 des

Include an Accept header in requests.

PR: kern/180917
MFC after: 1 week


253804 30-Jul-2013 des

Add Michael Gmelin's name to the copyright statement.


253736 28-Jul-2013 joel

Remove EOL whitespace.


253680 26-Jul-2013 des

Implement certificate verification, and many other SSL-related
imrovements; complete details in the PR.

PR: kern/175514
Submitted by: Michael Gmelin <freebsd@grem.de>
MFC after: 1 week


253515 21-Jul-2013 des

mdoc nit


251262 02-Jun-2013 eadler

Correct check to see if file changes.

Reported by: swildner@DragonFlyBSD.org
Reviewed by: des


244058 09-Dec-2012 andre

Fix bandwidth reporting when doing a restarted download with "-r".
The offset is already accounted for in xs->lastrcvd and doesn't
have to be subtracted again.

Reported by: Florian Smeets <flo@smeets.im>
Submitted by: Mateusz Guzik <mjguzik@gmail.com>
Tested by: Florian Smeets <flo@smeets.im>
MFC after: 1 week


244037 08-Dec-2012 eadler

Add check for failure of mkstemp and setenv.

Reviewed by: des
Approved by: cperciva (implicit)
Obtained from: DragonFlyBSD
MFC after: 1 week


243147 16-Nov-2012 andre

Change fetch(1) to:

o Report the instantaneous bandwidth instead of an average since the
beginning of the download.

o At the finish of the download report the average bandwidth and also
the total time it took instead of 00m00s.

Reviewed by: des
MFC after: 1 week


241737 19-Oct-2012 ed

More -Wmissing-variable-declarations fixes.

In addition to adding `static' where possible:

- bin/date: Move `retval' into extern.h to make it visible to date.c.
- bin/ed: Move globally used variables into ed.h.
- sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings.
- usr.bin/calendar: Remove unneeded variables.
- usr.bin/chat: Make `line' local instead of global.
- usr.bin/elfdump: Comment out unneeded function.
- usr.bin/rlogin: Use _Noreturn instead of __dead2.
- usr.bin/tset: Pull `Ospeed' into extern.h.
- usr.sbin/mfiutil: Put global variables in mfiutil.h.
- usr.sbin/pkg: Remove unused `os_corres'.
- usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.


240496 14-Sep-2012 des

Use libmd if and only if OpenSSL is not available.

PR: bin/171402
MFC after: 3 days


236110 26-May-2012 des

Revert r232274 - unauthorized, unnecessary and incorrect.


235211 10-May-2012 gjb

General mdoc(7) and typo fixes.

PR: 167696
Submitted by: Nobuyuki Koganemaru (kogane!jp.freebsd.org)
MFC after: 3 days


232274 28-Feb-2012 obrien

Document the 'URL' argument.


230307 18-Jan-2012 des

Fix two issues related to the use of SIGINFO in fetch(1) to display
progress information. The first is that fetch_read() (used in the HTTP
code but not the FTP code) can enter an infinite loop if it has previously
been interrupted by a signal. The second is that when it is interrupted,
fetch_read() will discard any data it may have read up to that point.
Luckily, both bugs are extremely timing-sensitive and therefore difficult
to trigger.

PR: bin/153240
Submitted by: Mark <markjdb@gmail.com>
MFC after: 3 weeks


225982 04-Oct-2011 des

latin1 -> utf8


225815 27-Sep-2011 des

Document the fact that passive mode is now the default.
Update copyright dates and strip my middle name.


225805 27-Sep-2011 des

Use fseeko() instead of fseek(). The rest of the code is off_t-aware,
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


225800 27-Sep-2011 des

Followup to r225599: the fseek() was a no-op since the file was opened
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


225599 15-Sep-2011 des

When resuming an HTTP download, we failed to verify that the range
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


204352 26-Feb-2010 ru

Fixed static linkage.


201386 02-Jan-2010 ed

Build usr.bin/ with WARNS=6 by default.

Also add some missing $FreeBSD$ to keep svn happy.


201290 30-Dec-2009 ru

Treat an empty argument as an error, instead of fetching the
contents of the root directory.

MFC after: 1 week


200462 13-Dec-2009 delphij

Revert most part of 200420 as requested, as more review and polish is
needed.


200420 11-Dec-2009 delphij

Remove unneeded header includes from usr.bin/ except contributed code.

Tested with: make universe


187361 17-Jan-2009 des

The FTP_TIMEOUT and HTTP_TIMEOUT environment variables were ignored because
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


186241 17-Dec-2008 murray

1. Update fetch to consistently return 1 on error, as the man page states,
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


186124 15-Dec-2008 murray

Add support for HTTP 1.1 If-Modified-Since behavior.

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


186043 13-Dec-2008 ru

Improve usage and sync SYNOPSIS with usage.


185912 11-Dec-2008 des

Apply the same defaults to https as to http.

Submitted by: Mike Tancsa <mike@sentex.net>
MFC after: 1 week


181962 21-Aug-2008 obrien

Use the SCHEME_ knobs rather than knowing what they expand to.

Reviewed by: des


174960 28-Dec-2007 des

List all environment variables supported by libfetch, along with a reference
to the fetch(3) man page.

MFC after: 1 week


164152 10-Nov-2006 des

Try to preserve ownership and permissions when replacing an existing file.

PR: bin/104702
Submitted by: Kevin Day <toasty@dragondata.com>
MFC after: 1 week


157953 22-Apr-2006 jkoshy

Fix a typo.

Submitted by: Pawel Worach <pawel.worach at gmail dot com>
MFC after: 1 week


156813 17-Mar-2006 ru

Reimplementation of world/kernel build options. For details, see:

http://lists.freebsd.org/pipermail/freebsd-current/2006-March/061725.html

The src.conf(5) manpage is to follow in a few days.

Brought to you by: imp, jhb, kris, phk, ru (all bugs are mine)


153919 30-Dec-2005 des

Only clear sb.st_size if it is clearly wrong or meaningless. This fixes
mirror mode.

PR: bin/86940
MFC after: 2 weeks


153894 30-Dec-2005 des

Reflect progress in process title.

Submitted by: flz
MFC after: 2 weeks


141846 13-Feb-2005 ru

Expand *n't contractions.


140420 18-Jan-2005 ru

Sort sections.


140368 17-Jan-2005 ru

Added the EXIT STATUS section where appropriate.


139113 21-Dec-2004 ru

NOCRYPT -> NO_CRYPT


137854 18-Nov-2004 cperciva

Fix buffer overflow. This is FreeBSD-SA-04:16.fetch.

Approved by: des


135546 21-Sep-2004 des

Update copyright years.


134350 26-Aug-2004 des

The check for r_flag was accidentally removed in the previous commit.

Submitted by: SANETO Takanori <sanewo@ba2.so-net.ne.jp>
MFC after: 3 days


133779 15-Aug-2004 des

Fix a couple of edge cases in which sb.st_size may be incorrect or
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


133196 06-Aug-2004 cperciva

Join the 21st century: Cryptography is no longer an optional component
of releases. The -DNOCRYPT build option still exists for anyone who
really wants to build non-cryptographic binaries, but the "crypto"
release distribution is now part of "base", and anyone installing from a
release will get cryptographic binaries.

Approved by: re (scottl), markm
Discussed on: freebsd-current, in late April 2004


132879 30-Jul-2004 cperciva

Document the behaviour of the "-o file" option when "file" is a directory
(downloaded file(s) are created inside the directory).

MFC after: 3 days


132696 27-Jul-2004 des

Don't strip trailing linear whitespace from passwords.

MFC after: 2 weeks


132695 27-Jul-2004 des

Style nits.


131615 05-Jul-2004 des

Truncate long file names in stat_display(), as was originally intended.

MFC after: 1 week


131052 24-Jun-2004 des

The description of the -S option in the man page says we won't fail if the
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


129440 19-May-2004 le

Fix integer overflow in the file size output when dealing with
large files (i.e. DVD images).

Reviewed by: des@


129427 19-May-2004 ru

Restore part of the word that got (accidentally) removed.
Removed whitespace at EOL.


127941 06-Apr-2004 des

Workaround for servers that ignore byte ranges when using chunked
encoding.

MFC after: 3 days


126307 27-Feb-2004 des

Remove EXAMPLES section which duplicates text in fetch(3).


125977 18-Feb-2004 des

Use %zu for size_t, like God intended.


125976 18-Feb-2004 des

Fix printf() format bug in previous commit (size_t != int).
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.


125965 18-Feb-2004 des

Revamp the statistics code, and switch to a much more compact display
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.


125154 28-Jan-2004 wes

Remove the inadvertant HTML additions to this man page.
These appear to have been inserted in the PR text by gnatsweb.

Noticed by: des (maintainer)


125005 26-Jan-2004 wes

Revert changes of rev 1.55; replace with strong encouragement to
read fetch(3) as well.

Requested by: des (maintainer)


125001 26-Jan-2004 des

Previous commit did the reverse of what the log message said (and of
what I intended to do). Really remove my middle name.


124963 25-Jan-2004 des

I don't normally use my middle name, so remove it from attributions in
man pages (though not from copyright notices). While I'm here, add email
addresses where appropriate.


124852 23-Jan-2004 wes

Document fetch(1) environment variables in fetch(1) man page, instead of
taking lazy users on the arduous journey through SEE ALSO to fetch(3).

PR: docs/61759
Submitted by: Christian S.J. Peron <maneo@bsdpro.com>


119892 08-Sep-2003 ru

Finish the reversion of rev. 1.52.


117890 22-Jul-2003 ru

Make sure the crypto versions of libfetch and fetch(1) appear in
the "crypto" distribution.

Approved by: des


116168 10-Jun-2003 trhodes

Revert 1.52. This should have been added to fetch.3.

Discussed with: des, ru


115157 19-May-2003 des

Retire the useless NOSECURE knob.

Approved by: re (scottl)


115099 17-May-2003 trhodes

Add an EXAMPLES section.
Xref sh(1) as we use environment variables.

PR: 43899
Reviewed by: des


114422 01-May-2003 des

Mark fetch(1) as c99- and WARNS6-clean.


112114 11-Mar-2003 des

Use floating point arithmetic to compute the ETA to avoid integer overflow
during slow transfers of large files.


112083 11-Mar-2003 des

Clean up the ETA logic a bit and make sure it works for restarted transfers.


112082 11-Mar-2003 des

Clarify that -r implies -R.


111447 24-Feb-2003 ru

mdoc(7) police: Scheduled sweep.


109735 23-Jan-2003 des

Slight cleanup of the ETA / BPS code. Avoid a division by zero.


109703 22-Jan-2003 des

Document netrc support.


109702 22-Jan-2003 des

Add -N option to specify a netrc file.
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.


107353 27-Nov-2002 des

Use the URL instead of the output file name when reporting errors relating
to the remote document.

PR: 33856
MFC after: 1 week
Approved by: re


106857 13-Nov-2002 des

Don't set atime / mtime if we don't have an output file, which can happen
in certain failure scenarii (mostly DNS trouble).


106796 12-Nov-2002 fenner

Don't divide by zero to calculate the ETA, even if we haven't gotten
any data in 30 seconds.


106586 07-Nov-2002 fenner

Don't exit with success after timeout during authentication.


106187 30-Oct-2002 des

Clarify my feelings towards fetch / libfetch.


106051 27-Oct-2002 des

Don't complain about not knowing the remote file size when working in
quiet mode.

PR: bin/37079
Submitted by: Nicolas Rachinsky <list@rachinsky.de>


106043 27-Oct-2002 des

Whitespace and indentation cleanup.


106042 27-Oct-2002 des

Forgot to disable alarms after fetchXGet() in previous commit.


106041 27-Oct-2002 des

Add an ETA timer that kicks in after 30 seconds.

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


102478 27-Aug-2002 des

s/optarg/s/ (cut'n'paste braino)

Spotted by: kris


100835 28-Jul-2002 des

fetch(1) is WARNS-5 clean (tested on i386 and Alpha)


100834 28-Jul-2002 des

Use strtol(3) instead of a home-grown version, and fix a "possibly
unitialized variable" warning.


98144 12-Jun-2002 des

Reorder LDADD to fix static linking.


97930 06-Jun-2002 ru

libfetch now depends on libcrypto and libssl.


97889 05-Jun-2002 des

Figures they had to call it NOCRYPT instead of NOCRYPTO.


97888 05-Jun-2002 des

During buildworld, "regular" libraries are built before crypto stuff, so
libfetch can't depend on lib{crypto,ssl}. Move the dependency to fetch
until we can figure out how to fix this.


95258 22-Apr-2002 des

Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.


95083 19-Apr-2002 charnier

Use `The .Nm utility'


93257 27-Mar-2002 bde

Restored the part of 1.45 that was clobbered in rev.1.46:
#include <sys/time.h> instead of depending on namespace pollution in
<sys/stat.h> for the declaration of struct timeval.


93213 26-Mar-2002 charnier

Add FBSDID. Remove unused include. Getopt returns -1 not EOF.


91225 25-Feb-2002 bde

#include <sys/time.h> instead of depending on namespace pollution in
<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.


90729 16-Feb-2002 des

If downloading to a temporary file, set the timestamp on the temp file, not
on the file we're replacing.

PR: bin/34992
Submitted by: Shunichiro Ariura <syun1rou@blackshell.org>
MFC after: 1 week


90415 08-Feb-2002 markm

Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.


89429 16-Jan-2002 ru

Document fetch(1) reaction to SIGINFO.

PR: docs/33640
Submitted by: Maxim Konovalov <maxim@macomnet.ru>
Approved by: des


87563 09-Dec-2001 des

Set fetchDebug if v_level is 3 or more.

PR: bin/32615
MFC after: 1 week


86242 10-Nov-2001 iedowse

Remove an extraneous argument to fprintf that -Wformat noticed.

Reviewed by: des


85933 03-Nov-2001 des

Remove a debugging warnx() that got committed by mistake.


83863 23-Sep-2001 des

Don't print running stats unless we're the foreground process.

PR: 30764


83307 10-Sep-2001 mike

Add a cast to silence a warning (error because of WARNS=2) on Alpha.

Discussed with: des


83217 08-Sep-2001 des

If the local file does not exist, or is a regular file, and we're not trying
to resume a transfer, download the requested document into a temporary file
which we later rename. This avoids leaving half-completed files around in
case of a crash (it'll still leave a half-completed file, but with a hope-
fully non-conflicting name), and should reduce the need for human inter-
vention on ports-building machines.

The temporary file name for "foo/bar" is constructed by invoking mkstemps()
with the pattern "foo/.fetch.XXXXXX.bar"

Requested by: obrien


81884 18-Aug-2001 des

Remove a blank line that snuck in with the previous commit.
Set the default timeout to 120 seconds instead of 0 (no timeout).


81863 17-Aug-2001 des

Add some comments.


80521 28-Jul-2001 se

Include value of command line argument that causes an error message or
warning in said message, since fetch may be run from a makefile or script
which does not print the command line.

Approved by: des


79838 17-Jul-2001 des

If we're writing to stdout, we don't care about the size.

Submitted by: wollman


79837 17-Jul-2001 des

WARNS cleanup + remove an unused macro and an unused function argument.


79755 15-Jul-2001 dd

Remove whitespace at EOL.


79422 08-Jul-2001 des

Fix an embarassing if-test-reversal bug that broke scheme guessing.


77576 01-Jun-2001 des

Don't try to print a completion percentage for zero-size files.

PR: 27780
Submitted by: Craig Leres <leres@ee.lbl.gov>


77260 27-May-2001 des

Damn. Fix typo in previous commit.


77241 26-May-2001 des

When running on a tty, install an authentication callback.


74957 28-Mar-2001 des

Bring the usage message in synch with reality.

PR: bin/26160


74717 24-Mar-2001 des

Now that libfetch uses the high port range by default, add a -U option to
make it use the low (default) port range instead.


73937 07-Mar-2001 des

If SIGINFO is received during the transfer, print a status line similar
to the summary shown at the end of the transfer.

Some days, I really hate Unix...

Suggested by: cracauer


73924 07-Mar-2001 des

Fix a formatting bug (MFC candidate)


71895 01-Feb-2001 ru

mdoc(7) police: split punctuation characters + misc fixes.


70275 22-Dec-2000 des

Warn if the size of the remote file isn't known.
If the -R option was specified, don't truncate the local file even if its
mtime is incorrect.

PR: bin/23719


69976 13-Dec-2000 des

If the URL did not specify a scheme, try to guess it from the host name.


69383 30-Nov-2000 des

If the transfer timed out, but we don't know how large the file is supposed
to be, assume it was truncated.


69256 27-Nov-2000 kris

Format string auditing


69027 22-Nov-2000 ru

mdoc(7) police: do not split author names in the AUTHORS section.


68718 14-Nov-2000 ru

Spell the des's name correctly.


67326 19-Oct-2000 des

Understand the difference between an empty file and a non-existent file.
This has been sitting in my tree for ages...


65362 02-Sep-2000 des

Don't try to set the mtime of the output file if it's not a regular file.

Pointed out by: cwt


65277 31-Aug-2000 des

Don't unlink the target file if it's not a regular file.


63877 26-Jul-2000 des

Restore the old semantics of deleting the output file when interrupted.
Some people liked this and some didn't, so POLA won.


63720 21-Jul-2000 des

Don't print summary in quiet mode.


63717 21-Jul-2000 des

Don't display a running count in quiet mode.
Don't add the offset to the size; it's libfetch's job to report the correct
size of the requested file.


63568 19-Jul-2000 des

Fix two bugs related to resumed transfers:

- if the dates didn't match, fetch would append the received file to the
existing file instead of replacing it.

- if the local file was complete and up-to-date, fetch would miscalculate
the expected size and report a failure instead of a success, because it
had no way of knowing that the server was actually resending the entire
file since the requested offset was invalid.


63501 19-Jul-2000 des

Braino: don't use passive mode unless the user requests it.

PR: bin/20025
Submitted by: HIYAMA Takeshi <th@cis.ibaraki.ac.jp>


63465 18-Jul-2000 ben

* Remove description of obsolete -t option.
* Insert newline before "and" in ".Fl c and".

Approved by: des


63354 17-Jul-2000 des

The description of the semantics of -v and -q has long since been OBE.


63353 17-Jul-2000 des

While I'm at it, break a line that was too long, remove a pointless diagnostic
and adjust the verbosity level of another.


63346 17-Jul-2000 des

Document the fact that -r and -m are mutually exclusive.


63345 17-Jul-2000 des

Rearrange / rewrite large portions of fetch() to take advantage of new
libfetch features (fetchRestartCalls, fetchXGet()).

Since it doesn't make much sense to have m_flag and r_flag set at the same
time, and it can actually cause trouble in some cases, die if they're both
set.

Set the SA_RESETHAND flag for SIGINT so that when we've caught one, we can
kill ourselves with a second SIGINT (thus notifying our parent of our tragic
fate) instead of just exiting.

These changes fix several problems that would show up when fetching ports,
as well as speeding up HTTP transfers quite a bit (at least for relatively
small files).

Most of these changes were prompted by an interaction problem with an HTTP
server called SWS-1.0, which exhibited two bugs, the first of which prevented
fetch from working around the second (the first was not sending content-type
in reply to HEAD requests, the second was sending garbage after the end of
the requested file).


63235 16-Jul-2000 des

Better signal handling.

Submitted by: green


63067 13-Jul-2000 des

Fix a bug in the stats display that showed up when resuming aborted transfers.

Submitted by: green


63046 12-Jul-2000 des

Rework the stats code for the nth time. Much cleaner now.
Always display the completion percentage if stderr is a tty.
Drop the char-by-char transfer mode, it was based on an incorrect assumption
regarding the semantics of fread().
Finally (I hope) straighten out the business of setting the mtime, as well as
when to remove the output file and when not to.
Thanks are owed to the many who have provided nearly instantaneous and
highly constructive feedback and suggestions about these matters.


63015 12-Jul-2000 des

Now that the HTTP code supports timeouts, we don't need to use alarm()
around the call to fetchStat().
Catch SIGINT, and rework the signal handling so it doesn't skimp on the
cleanup after a timeout or interrupt. Also, don't just bail out after a
timeout; there may be more files to fetch.


63005 12-Jul-2000 des

Rework the stats code to avoid code duplication.
Fix a bug where the stats code would print the expected size instead of the
number of bytes received.
Fix the reading code so it'll support partial reads.


62837 09-Jul-2000 des

Don't segfault if given an invalid URL (doh!)

Submitted by: green


62816 08-Jul-2000 des

Clarify the meaning of -m and -n (thanks to bde).


62815 08-Jul-2000 des

Straighten out the behvaiour of -m and -n (thanks to bde).
Check that stderr, not stdout, is a tty (thanks to green).


62639 05-Jul-2000 des

Add MIT copyright


62255 29-Jun-2000 des

Note that the -h, -c and -f options are deprecated, and remove note that
incorrectly stated that they were not implemented.
Document the -d option.


62254 29-Jun-2000 des

Implement the -c option


62245 29-Jun-2000 des

Don't forget to delete the output file if the request fails.
Don't delete the output file if -r was specified.


62216 28-Jun-2000 des

New libfetch-based fetch.


60938 26-May-2000 jake

Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by: msmith and others


60833 23-May-2000 jake

Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by: phk
Reviewed by: phk
Approved by: mdodd


57824 08-Mar-2000 cracauer

Print a warning and exit with != 0 when at least one downloaded file
is shorter than previously announced by the server.

Tested by asami.

Approved by: jkh


57670 01-Mar-2000 sheldonh

Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.


52444 23-Oct-1999 green

Add the -F option. This is for forcing restarts with -r by inhibiting
transmission of the If-Range HTTP header field.


50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


48457 02-Jul-1999 green

"transfered" -> "transferred"

Reviewed by: dict(1)


48060 21-Jun-1999 green

This fixes the problem of cancelling an FTP transfer resulting in
a bogus error ("parsing URI".) I also fixed an inconsistency in
another fs_status.


47303 18-May-1999 jmg

make md5 checksums actually work instead of simply calculating the length
of an empty buffer... the output file wasn't readable... also warn that
we can't checksum on stdout and print out the base64 encoded version of the
md5 checksum...

Site to actually return md5 digest: web.golux.com
Verified that fetch was broken: Ken Coar <Ken.Coar@Golux.Com>


44576 08-Mar-1999 wollman

Restore \n at end of usage message.

Complained-about-by: charnier


44392 02-Mar-1999 alex

Improve error message wording when attempting to link to a non-existent
file on the local host.

PR: 10042
Submitted by: Chris Costello <phoenix@calldei.com>


44240 23-Feb-1999 wollman

Deal with broken Web sites which return 302 responses rather than 404
and an error document when the requested resource does not exist. Grrr.

Requested by: asami


43627 05-Feb-1999 fenner

Remove the FTP_PASSIVE_MODE "fix"; libftpio handles this.


43569 03-Feb-1999 fenner

Warn about collapsing multiple slashes into 1 in ftp URL's.
Look at the FTP_PASSIVE_MODE environment variable like the man page says.

PR: bin/9464
Submitted by: John A. Shue <John.Shue@symmetron.com>

Add references to RFC's 1790, 959, 850.

PR: doc/6564


43568 03-Feb-1999 fenner

Don't try to parse a colon in a URL as a port
(e.g. http://www.host.name/foo:bar)

PR: bin/5072
Submitted by: Takeshi WATANABE <watanabe@komadori.planet.kobe-u.ac.jp>


42703 15-Jan-1999 wollman

Fix logic error in RFC 850 kluge.


42702 15-Jan-1999 wollman

For RFC 850 dates received in HTTP responses, implement the century pivot
described in RFC 2068. Include a reference to same in the manual page.


41600 08-Dec-1998 cracauer

Add -s option, just report size of file that would be fetched.
Reviewed by: -current list


41021 08-Nov-1998 des

main.c:
Fix usage string. Fix getopt() string. Fix ordering of compatibility options.
fetch.1:
Fix synopsis. Fix ordering of T and t options. Fix minor grammar nit.


40656 26-Oct-1998 fenner

If we know the content-length, only read that number of bytes from
the server. There exists a broken server which sends a few extra
garbage bytes in response to HTTP/1.1 requests.


39497 20-Sep-1998 jkh

Add -S flag; this is benign since fetch's behavior is unchanged if you
don't use it. That's why I'm bringing it in during our "code slush"
Submitted by: Stefan Esser <se@mi.uni-koeln.de>


39391 17-Sep-1998 des

DTRT for file: URLs when output file is "-".

PR: bin/7203


37579 12-Jul-1998 se

Fix proxy authorization code:

- failed to use authorization parameters passed in the environment, if
/dev/tty could not be opened (i.e. if running from cron)
- mixed use of /dev/tty and stdin for prompt and reading of the result


35902 09-May-1998 wollman

Fix my last change: the .Fx macro doesn't do anything useful without an
argument, so use `.Tn FreeBSD' instead.


35900 09-May-1998 wollman

Documentation fix: delete references to T/TCP as they are not relevant
to the case in question. (Said case being quite clearly defined by
the basic TCP specification, RFC 792.)


35862 09-May-1998 des

Arrggghhhh... forgot to strip the / after outputting %2f


35858 09-May-1998 des

Map a leading / in -c argument to %2f instead of dropping it silently.

PR: bin/6558


35854 09-May-1998 fenner

Describe absolute paths in FTP URL's. This patch has been sitting
around uncommitted for 2 months =(


34801 23-Mar-1998 charnier

.Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq.


33654 20-Feb-1998 jb

gcc wants to see long long variables passed to %q printf formats, so
cast to that instead of quad_t.


33653 20-Feb-1998 jb

time() needs a pointer to a time_t, but tv_sec in a timeval is a
long (yuk). So give time() what it wants and let the compiler
promote the variable when it is assigned to tv_sec.


31341 22-Nov-1997 fenner

Suggest using "-b" or "-t" if the connection is reset (typical symptom
of broken TCP stack).


31210 18-Nov-1997 jdp

Add missing arguments detected by "-Wformat".


31130 12-Nov-1997 obrien

style-police got me. :-)
Also fixed some "didn't make the most sense" problems.

Submitted by: bde


31045 08-Nov-1997 obrien

If "-l" is given, make sure the target of the link exist.


30879 01-Nov-1997 ache

Change diags to see what part of url actually parsed, see
previous change about #? parms


30876 31-Oct-1997 ache

Don't search for ':' port in ?# params part
Require to correctly parse http://...cgi?http://...


30237 08-Oct-1997 fenner

Interpret multiple slashes as a single slash in ftp: URL's. This
is contrary to RFC1738, which specifies that empty elements between
slashes really mean to send a CWD command with an empty argument.
Most FTP servers consider this an error, so strict RFC compliance
is advisable in this case.


30135 06-Oct-1997 fenner

Use the RFC1738 interpretation of ftp: URL's, i.e. CWD to each
slash-seperated element of the URL and then RETR the last element.

PR: bin/4670
Reviewed by: wollman


29934 28-Sep-1997 cracauer

fetch(3) doesn't get asctime(3) format, wrong length assumed
PR: bin/4625
Submitted by: "Timo J. Rinne" <tri@pooh.tky.hut.fi>
Obtained from:bin/4625


28396 19-Aug-1997 asami

Be consistent with other utilities in spelling "Kbytes". (Actually,
there even was one of them about ten lines above in the same file.)

Reminded by: joerg's commit to usr.bin/ftp/ftp.c rev 1.9


27921 05-Aug-1997 ache

Add -t option which turns T/TCP off as workaround for some broken servers
Submitted by: Marc Slemko <marcs@znep.com>


27712 26-Jul-1997 wollman

Work around a brokenness in the HTTP spec by generating the Host header
for ftp: URLs as well. This can't possibly be done in the general case,
but since we only claim to support http and ftp, we'll adhere to the
bogus requirement (RFC 2068, s. 14.25) anyway... >sigh<

Submitted by: =?iso-8859-1?Q?=C5ge_R=F8bekk?= <aagero@aage.priv.no>


27709 26-Jul-1997 wollman

Fix the error message for when mirroring and restarting are rejected
due to the output not being a regular file. Also split the error message
in any error case here to be on two lines to lessen the likelihood of it
being too long to fit on just one.


27708 26-Jul-1997 wollman

Implement HTTP 1.1's ``chunked'' Transfer-Encoding (ick). This hasn't
been extensively tested, but I now can successfully retrieve
<http://www.apache.org/index.html>, so I guess that's a victory of some
sort.

Also move the initialization of ``autherror'' to hopefully eliminate
the reported loop involving authentication. Still need to implement
MD5 digest authentication.


27679 25-Jul-1997 wollman

Provide a new `-b' flag to work around some broken HTTP/TCP implementations
that can't deal with a half-closed connection.


27167 02-Jul-1997 charnier

One newline should be enough.


27148 01-Jul-1997 charnier

Do not use argv[0] in usage().


26320 31-May-1997 ache

Now understand password in ftp:// URLs


23712 11-Mar-1997 jmg

fix a bug in processing of FTP_TIMEOUT environment variable.

Closes PR#2947

Submitted-by: Peter Childs <pjchilds@imforei.apana.org.au>


23453 06-Mar-1997 jmg

fix restarting http transfers and understanding response from server.

Slight modification of patch by wollman.

Closes PR#2870

Reviewed by: wollman
Submitted by: Marc Slemko <marcs@znep.com>


23441 06-Mar-1997 jmg

fix a couple problems with fetch:
. don't try to interpet a colon in the pathname as a port number
. don't report an errno message when one don't exist


23414 05-Mar-1997 fenner

Fix FTP_PROXY to use user@host[@port] for FTP proxy and eliminate
undocumented FTP_PROXY_USER
Make FTP file errors contian hostname and path.
Pass the FTP port to libftp.
Partially un-HTMLify error messages returned from server
Handle "HTTP NNN" instead of "HTTP/V.vv NNN" response sent by
pre-HTTP/1.0 servers

Reviewed by: wollman


23029 22-Feb-1997 wosch

These man page will appear in 2.2, not 3.0.


23012 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


22819 17-Feb-1997 jmg

Fix fetch so that all status information is sent to stderr, prevents
corruption of file being recieved to stdout.

Submitted-by: Kent Vander Velden <graphix@iastate.edu>

Closes PR#2739


22720 14-Feb-1997 jmg

Modified the display() function to recognize when the output it going to a
file. When it is don't do the percentage update, but still display the file
size and rate.

Closes PR#2725

Reviewed by: wollman


22573 11-Feb-1997 wollman

Fix remote request for HTTP proxies. Should close PR#2670.


22547 10-Feb-1997 wollman

Fix PR#2700: report correct transmission speed, and restart transfers
from the restart point, not the end of the file (blush!).

Submitted by: John-Mark Gurney <jmg@nike.efn.org>


22404 07-Feb-1997 wollman

Fix off-by-one error in proxy host:port parser.

Submitted by: fenner


22307 05-Feb-1997 wollman

Some bug-fixes, clean-ups, and one new feature:

- Fix the bug with URIs of the form ftp://host/filename.
- Fix some more string-termination bugs in util.c.
- Use safe_malloc() rather than testing the return value of
regular malloc() in 15 places.
- Implement HTTP authentication, for both servers and proxies.
Currently only ``basic'' authentication is supported; This Is A Bug
(but less of one tjhan nmot supporting any authentication).

I think there is only one more feature which is required for full
HTTP/1.1 support, which is Transfer-Encoding: chunked; this should
not be toohard, but it isn't very important, either.


22202 02-Feb-1997 bde

Null-terminate the string in percent_decode() so that we don't depend on
malloc() returning zeroed storage or dump core while starting up.

Found-by: /etc/malloc.conf ->AJ


22167 31-Jan-1997 wollman

Some fixes for HTTP:

1) Implement redirects (or try to, at least).
2) Implement automatic retry after 503 errors when Retry-After is given.
3) Implement a -a flag to enable both of these behaviors.
4) Recognize Transfer-Encoding headers and emit a warning that the file
is likely to be damaged.
5) Bug fix: only write the amount of data we read.
6) Actually document some of these.
7) Fix the usage message to display flags in semi-alphabetical order.


22133 30-Jan-1997 wollman

Here is my long-threatened revamping of fetch. Jean-Marc probably won't
recognize it any more. This makes the following significant changes:

- The main body of the program doesn't know a thing about URIs,
HTTP, or FTP. This makes it possible to easily plug in other
protocols. (The next revision will probably be able to dynamically
add new recognizers.)

- There are no longer arbitrary timeouts for the protocols. If you want
to set one for yourself, use the environment variables.

- FTP proxies are now supported (if I implemented it right).

- The HTTP implementation is much more complete, and can now do restarts,
preserve modtimes, and mrun in mirror mode. It's not yet up to 1.1,
but it's getting there.

- Transaction TCP is now used for sending HTTP requests. The HTTP/1.1 syntax
for requesting that the connection be closed after one request is
implemented.

In all of this, I have doubtless broken somebody. Please test it and tell me
about the bugs.


21798 17-Jan-1997 jkh

Handle timeouts in a slightly less baroque way.


21748 15-Jan-1997 wosch

Sort cross references.


21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


19734 14-Nov-1996 ache

Report net connection error via hstrerror(h_errno) now instead of
simple fact that can't connect


19732 14-Nov-1996 ache

Change to new ftpLogin interface
Now clearly say: Not logged in
instead of old: Broken pipe
(note it was original reason for all my libftpio changes)


19611 10-Nov-1996 peter

Cosmetic bugfix. fetch was modifying it's argv[] strings in place, which
caused ps(1) to show strange things..


19287 31-Oct-1996 phk

bin/1933: don't print negative % for huge files (80Mb)


19140 24-Oct-1996 adam

old host:/filename syntax was broken
implement /filename syntax for completeness


18722 06-Oct-1996 jmz

The -h flag implies ftp = 1.


18480 23-Sep-1996 wosch

add missing comma(s) in .Xr macros


18396 19-Sep-1996 peter

Attempt to untangle the timeout code a bit, also make the default ftp
and http timeouts the same, since when using a http proxy to do ftp
transfers, the http timeout was being used for what is coming in via
ftp.


18395 19-Sep-1996 peter

Make fetch 64-bit safe, corresponding to libftpio changes.

Submitted by: Jason Thorpe <thorpej@nas.nasa.gov>, PR#1641


18226 10-Sep-1996 jkh

Remove the code which has restart looking at the modtime. That's just
moronic! We don't care about the time in restart mode, only the size.
It's *mirror* mode which cares about modtimes.


17979 31-Aug-1996 jkh

Allow proper ftp verbosity with a new -v flag.


17789 23-Aug-1996 jkh

Don't make -l warn when it's not used, so we can potentially set it
all the time if we want to use "link" behavior for file URLs (and not
have fetch whine at us when they're not).


17786 23-Aug-1996 mpp

Use the .Fx macro where appropriate.


17781 22-Aug-1996 jkh

Print the correct thing when interrupted by a signal.


17778 22-Aug-1996 jkh

1. Understand file:/path style URLs.
2. Add a -l flag for symlinking to rather than copying file:/path style URLs.
3. Add a -T flag for setting the timeout interval (overrides FTP_TIMEOUT if set)


17734 21-Aug-1996 jkh

Fix a small potential bogon I noticed here with restarts.


17596 14-Aug-1996 jkh

Add support for HTTP proxies, fix some bugs with http transfers.
Submitted-By: Mikael Hybsch <micke@dynas.se>


17539 12-Aug-1996 jkh

Fix broken modtime preservation code. *Now* it preserves the modtime
correctly!
Noticed-By: knarf@camelot.de (Frank Bartels)


17460 07-Aug-1996 jkh

Defer to fashion.


17413 04-Aug-1996 jmz

Suppress the messages from the server after login (ftpVerbose(ftp,0)). Errors
are already correctly reported.


17407 03-Aug-1996 jkh

Adapt to new libftpio. [jkh]
Better error messages.
Submitted-By: "David E. O'Brien" <obrien@Nuxi.cs.ucdavis.edu>


17206 18-Jul-1996 jkh

Whups - update the usage message too.


17205 18-Jul-1996 jkh

Add -n flag to use the current modtime rather than preserving it.


16967 05-Jul-1996 jkh

New man page for fetch(1).
Submitted by: jmz (with some small tweaks)


16964 05-Jul-1996 jmz

Back out previous commit: do not use read(), but fread (). Change BUFFER_SIZE
to 1K to avoid waiting too long between 2 progress reports in the case of a
slow transfer.
Move the signal()/setitimer() code just before the read loop because the
ftpio library set and reset the timer internally.


16890 02-Jul-1996 jmz

Use read(fileno(fp), ...) instead of fread(..., fp) to avoid buffered input.


16783 26-Jun-1996 gpalmer

Add -Wall to CFLAGS


16740 25-Jun-1996 ache

Make GET request and response parsing HTTP/1.0 compatible


16655 24-Jun-1996 jmz

Do not exit if ftpGetSize() returns a value < 0. You may well try to
fetch a whole <directory>.tar.gz on a server running wu-ftp.


16600 22-Jun-1996 jkh

Adjust the copyright to match reality, remove printing of gratuitous newline.


16598 22-Jun-1996 jkh

Clean up more bogons:
1. Add a copyright at the top.
2. Make passive and binary modes work with new ftpio semantics.
3. Add a `mirror' (-m) flag which only copies the remote file if it's
not the same size or is newer.


16593 22-Jun-1996 jkh

Address Andrey's complaints:

1. Always use file modtime, and if that's not usable then default
to current time.
2. Allow HTTP_TIMEOUT to be set as an environment variable to override
default.
3. Handle SIGTERM.


16505 19-Jun-1996 asami

This commit was generated by cvs2svn to compensate for changes in r16504,
which included commits to RCS files with non-trunk default branches.