Commit Graph

173 Commits

Author SHA1 Message Date
fenner
868ea92b09 Describe absolute paths in FTP URL's. This patch has been sitting
around uncommitted for 2 months =(
1998-05-09 07:33:09 +00:00
charnier
1bf317d31f .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq. 1998-03-23 07:48:45 +00:00
jb
e64aa99822 gcc wants to see long long variables passed to %q printf formats, so
cast to that instead of quad_t.
1998-02-20 05:11:42 +00:00
jb
2d3aee6972 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.
1998-02-20 05:08:53 +00:00
fenner
04902d08a9 Suggest using "-b" or "-t" if the connection is reset (typical symptom
of broken TCP stack).
1997-11-22 01:00:42 +00:00
jdp
ad44a62f51 Add missing arguments detected by "-Wformat". 1997-11-18 03:27:34 +00:00
obrien
ce431fd607 style-police got me. :-)
Also fixed some "didn't make the most sense" problems.

Submitted by:	bde
1997-11-12 04:39:33 +00:00
obrien
304cd52b4b If "-l" is given, make sure the target of the link exist. 1997-11-08 22:15:55 +00:00
ache
7a0821ea7a Change diags to see what part of url actually parsed, see
previous change about #? parms
1997-11-01 05:47:41 +00:00
ache
f249ff21ac Don't search for ':' port in ?# params part
Require to correctly parse http://...cgi?http://...
1997-10-31 23:33:44 +00:00
fenner
032d9c5b1c 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.
1997-10-08 18:43:53 +00:00
fenner
436b2cf479 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
1997-10-06 01:09:56 +00:00
cracauer
5a7651ffaa 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
1997-09-28 11:25:59 +00:00
asami
581db96bb2 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
1997-08-19 01:57:53 +00:00
ache
b9a27a90fd Add -t option which turns T/TCP off as workaround for some broken servers
Submitted by: Marc Slemko <marcs@znep.com>
1997-08-05 20:18:39 +00:00
wollman
13f06b7aa6 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>
1997-07-26 20:18:43 +00:00
wollman
0d18d3b697 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.
1997-07-26 20:00:05 +00:00
wollman
915fbc4961 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.
1997-07-26 19:25:56 +00:00
wollman
de97e076f0 Provide a new `-b' flag to work around some broken HTTP/TCP implementations
that can't deal with a half-closed connection.
1997-07-25 19:35:44 +00:00
charnier
90063a69e4 One newline should be enough. 1997-07-02 06:28:32 +00:00
charnier
19b19c011e Do not use argv[0] in usage(). 1997-07-01 06:37:34 +00:00
ache
836a9a2c0c Now understand password in ftp:// URLs 1997-05-31 14:45:41 +00:00
jmg
57423bcf8b fix a bug in processing of FTP_TIMEOUT environment variable.
Closes PR#2947

Submitted-by: Peter Childs <pjchilds@imforei.apana.org.au>
1997-03-11 15:13:28 +00:00
jmg
5ef14f66ec 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>
1997-03-06 20:01:32 +00:00
jmg
d6216751dd 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
1997-03-06 10:01:54 +00:00
fenner
1910eaf544 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
1997-03-05 18:57:16 +00:00
wosch
b2a6a2a9b9 These man page will appear in 2.2, not 3.0. 1997-02-22 23:43:32 +00:00
peter
aef78d145b Revert $FreeBSD$ to $Id$ 1997-02-22 19:58:13 +00:00
jmg
0ac90c32e5 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
1997-02-17 04:11:47 +00:00
jmg
b3056941e0 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
1997-02-14 19:08:18 +00:00
wollman
539309d191 Fix remote request for HTTP proxies. Should close PR#2670. 1997-02-11 20:46:06 +00:00
wollman
567ebbfbc5 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>
1997-02-10 18:49:42 +00:00
wollman
4dab0898c3 Fix off-by-one error in proxy host:port parser.
Submitted by:	fenner
1997-02-07 17:55:01 +00:00
wollman
b5ba29e405 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.
1997-02-05 19:59:18 +00:00
bde
baba602eab 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
1997-02-02 09:16:37 +00:00
wollman
aa9c48db2f 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.
1997-01-31 19:55:51 +00:00
wollman
db3e7bcc95 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.
1997-01-30 21:43:44 +00:00
jkh
aef403ae97 Handle timeouts in a slightly less baroque way. 1997-01-17 12:52:12 +00:00
wosch
ab0d7e7c60 Sort cross references. 1997-01-15 23:25:55 +00:00
jkh
9c0cd3f9df 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.
1997-01-14 07:20:47 +00:00
ache
dee149421b Report net connection error via hstrerror(h_errno) now instead of
simple fact that can't connect
1996-11-14 07:36:26 +00:00
ache
673e5cc681 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)
1996-11-14 07:06:25 +00:00
peter
48379168d3 Cosmetic bugfix. fetch was modifying it's argv[] strings in place, which
caused ps(1) to show strange things..
1996-11-10 14:46:50 +00:00
phk
ce6ad7180c bin/1933: don't print negative % for huge files (80Mb) 1996-10-31 14:24:35 +00:00
adam
b884fe3de7 old host:/filename syntax was broken
implement /filename syntax for completeness
1996-10-24 00:15:44 +00:00
jmz
6501b26d53 The -h flag implies ftp = 1. 1996-10-06 00:44:24 +00:00
wosch
e7eeae0eba add missing comma(s) in .Xr macros 1996-09-23 22:24:39 +00:00
peter
aadc0046fa 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.
1996-09-19 18:07:24 +00:00
peter
baa8f674db Make fetch 64-bit safe, corresponding to libftpio changes.
Submitted by: Jason Thorpe <thorpej@nas.nasa.gov>, PR#1641
1996-09-19 17:31:34 +00:00
jkh
2958582b17 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.
1996-09-10 19:49:41 +00:00
jkh
530ab173d1 Allow proper ftp verbosity with a new -v flag. 1996-08-31 22:03:05 +00:00
jkh
d0d6875107 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).
1996-08-23 06:21:17 +00:00
mpp
0da347e402 Use the .Fx macro where appropriate. 1996-08-23 00:57:08 +00:00
jkh
a506238c1b Print the correct thing when interrupted by a signal. 1996-08-22 23:25:24 +00:00
jkh
45c6c928f9 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)
1996-08-22 21:30:51 +00:00
jkh
bc74acf88c Fix a small potential bogon I noticed here with restarts. 1996-08-21 01:27:25 +00:00
jkh
bc49f658c3 Add support for HTTP proxies, fix some bugs with http transfers.
Submitted-By: Mikael Hybsch <micke@dynas.se>
1996-08-14 17:50:23 +00:00
jkh
db6cbc908c Fix broken modtime preservation code. *Now* it preserves the modtime
correctly!
Noticed-By: knarf@camelot.de (Frank Bartels)
1996-08-12 12:55:26 +00:00
jkh
6b0d14e3a8 Defer to fashion. 1996-08-07 02:15:26 +00:00
jmz
ea5644a0a1 Suppress the messages from the server after login (ftpVerbose(ftp,0)). Errors
are already correctly reported.
1996-08-04 00:35:39 +00:00
jkh
4ace05c84a Adapt to new libftpio. [jkh]
Better error messages.
Submitted-By: "David E. O'Brien" <obrien@Nuxi.cs.ucdavis.edu>
1996-08-03 13:14:47 +00:00
jkh
d646461a9e Whups - update the usage message too. 1996-07-18 00:08:58 +00:00
jkh
008d877014 Add -n flag to use the current modtime rather than preserving it. 1996-07-18 00:08:02 +00:00
jkh
5cf09ab0b8 New man page for fetch(1).
Submitted by: jmz (with some small tweaks)
1996-07-05 01:03:20 +00:00
jmz
cacf42ae75 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.
1996-07-05 00:06:36 +00:00
jmz
fad5ffcd60 Use read(fileno(fp), ...) instead of fread(..., fp) to avoid buffered input. 1996-07-02 01:49:47 +00:00
gpalmer
c3a84b22e3 Add -Wall to CFLAGS 1996-06-26 20:49:41 +00:00
ache
cf810b3f44 Make GET request and response parsing HTTP/1.0 compatible 1996-06-25 21:33:18 +00:00
jmz
7976a31334 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.
1996-06-24 01:03:05 +00:00
jkh
181a51c6f4 Adjust the copyright to match reality, remove printing of gratuitous newline. 1996-06-22 23:24:13 +00:00
jkh
94eeb93ff9 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.
1996-06-22 21:42:14 +00:00
jkh
6d61df688b 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.
1996-06-22 20:16:57 +00:00
asami
b0bc5b5357 Jean-Marc's url fetch program, with Josh MacDonald's patches and
Jordan's ftpio library.

Submitted by:	jmz, jkh, jmacd (three-j!)
1996-06-19 09:32:11 +00:00