Commit Graph

20 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav a0c6ec97c9 Understand the difference between an empty file and a non-existent file.
This has been sitting in my tree for ages...
2000-10-19 21:05:59 +00:00
Dag-Erling Smørgrav 74912943bf Don't try to set the mtime of the output file if it's not a regular file.
Pointed out by:	cwt
2000-09-02 09:48:34 +00:00
Dag-Erling Smørgrav e2b41a622b Don't unlink the target file if it's not a regular file. 2000-08-31 11:24:15 +00:00
Dag-Erling Smørgrav 9516ffa7c0 Restore the old semantics of deleting the output file when interrupted.
Some people liked this and some didn't, so POLA won.
2000-07-26 07:28:33 +00:00
Dag-Erling Smørgrav 32190ef51f Don't print summary in quiet mode. 2000-07-21 14:21:29 +00:00
Dag-Erling Smørgrav d939bf77d2 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.
2000-07-21 11:08:03 +00:00
Dag-Erling Smørgrav 10e3b1c738 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.
2000-07-19 23:56:45 +00:00
Dag-Erling Smørgrav a5e3ae21a5 Braino: don't use passive mode unless the user requests it.
PR:		bin/20025
Submitted by:	HIYAMA Takeshi <th@cis.ibaraki.ac.jp>
2000-07-19 09:12:36 +00:00
Dag-Erling Smørgrav 45b22b2a87 While I'm at it, break a line that was too long, remove a pointless diagnostic
and adjust the verbosity level of another.
2000-07-17 22:44:00 +00:00
Dag-Erling Smørgrav e9a039c2cb 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).
2000-07-17 21:49:01 +00:00
Dag-Erling Smørgrav 78394463ee Better signal handling.
Submitted by:   green
2000-07-16 00:47:00 +00:00
Dag-Erling Smørgrav b3c141fd2e Fix a bug in the stats display that showed up when resuming aborted transfers.
Submitted by:	green
2000-07-13 08:37:39 +00:00
Dag-Erling Smørgrav 49e62d8f8e 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.
2000-07-12 20:53:07 +00:00
Dag-Erling Smørgrav ef50a72c92 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.
2000-07-12 11:02:01 +00:00
Dag-Erling Smørgrav aa4b3574a8 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.
2000-07-12 08:29:52 +00:00
Dag-Erling Smørgrav ec850e74c0 Don't segfault if given an invalid URL (doh!)
Submitted by:		green
2000-07-09 10:14:22 +00:00
Dag-Erling Smørgrav bb11a878ea Straighten out the behvaiour of -m and -n (thanks to bde).
Check that stderr, not stdout, is a tty (thanks to green).
2000-07-08 09:34:33 +00:00
Dag-Erling Smørgrav a8369cd91b Implement the -c option 2000-06-29 10:32:56 +00:00
Dag-Erling Smørgrav df6f33d182 Don't forget to delete the output file if the request fails.
Don't delete the output file if -r was specified.
2000-06-29 08:39:29 +00:00
Dag-Erling Smørgrav b39628e763 New libfetch-based fetch. 2000-06-28 16:55:15 +00:00