Commit Graph

289 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
b554dea773 Plug memory leak.
PR:		27506
2001-05-26 17:23:38 +00:00
Dag-Erling Smørgrav
ea63a39cef Add some error codes that were added in RFC2616. 2001-05-23 18:52:02 +00:00
Archie Cobbs
38c7e4a631 Apply 'const' liberally.
Fix some other minor glitches.
2001-04-24 00:06:21 +00:00
Dima Dorfman
5e75e35cca Grammar police: "its", not "it's", is the possessive form of "it". 2001-04-15 19:53:47 +00:00
Dag-Erling Smørgrav
525be862e6 If the server's reply to the SIZE command is unparseable, reset us->size
to -1 so the caller will know it's invalid.  This is an MFC candidate.
2001-04-07 15:26:31 +00:00
Ruslan Ermilov
4a558355e5 MAN[1-9] -> MAN. 2001-03-27 17:27:19 +00:00
Dag-Erling Smørgrav
d5f175ce90 Use high port range by default, and replace the 'h' option with an 'l' option
that forces the ftp code to use the low (default) port range instead.
2001-03-24 00:28:57 +00:00
Dag-Erling Smørgrav
e238d2a8da Don't remember an EINTR, since the caller may want to restart the call. 2001-03-07 05:12:14 +00:00
Dag-Erling Smørgrav
4cee73c80f Support lower-case versions of the proxy environment variables.
PR:		bin/25494
2001-03-07 04:45:55 +00:00
Ruslan Ermilov
9884911506 mdoc(7) police: fixed broken references. 2001-01-16 11:52:00 +00:00
Ruslan Ermilov
32f6256a49 Prepare for mdoc(7)NG. 2001-01-16 09:08:22 +00:00
Dag-Erling Smørgrav
c86c6f748b The user name for anonymous ftp is now "anonymous".
Remove the period after the last man page reference.
Add a reference to RFC1635, and sort the RFC references by number.
2001-01-08 13:46:40 +00:00
Dag-Erling Smørgrav
bf4dd407e3 Back out previous (accidental) commit. 2001-01-08 13:17:21 +00:00
Dag-Erling Smørgrav
80ed165e91 Use "anonymous" rather than "ftp" as login name for anonymous ftp.
Rather than have a separate (misnamed) FTP_ANONYMOUS_PASSWORD constant, use
FTP_ANONYMOUS_USER (i.e. "anonymous") to construct the anonymous ftp password
if getlogin() fails.
2001-01-08 13:15:14 +00:00
Dag-Erling Smørgrav
659e0d5ef7 Document FTP_LOGIN. 2000-12-22 18:03:21 +00:00
Dag-Erling Smørgrav
e72f0de24e Check the FTP_LOGIN environment variable before falling back on
FTP_ANONYMOUS_USER.
2000-12-22 18:01:40 +00:00
Dag-Erling Smørgrav
1ba8497660 Avoid a segfault (due to an unitialized pointer) when parsing URLs that have
no scheme or host part.
2000-12-13 11:21:09 +00:00
Dag-Erling Smørgrav
6c81eb523e Somewhere along the line, I misunderstood the whole FTP_PASSIVE_MODE debate
and had libfetch selecting passive mode even when FTP_PASSIVE_MODE was not
set at all, which is really quite surprising unless you know about it. So
change it to the agreed default behaviour of selecting passive mode if
FTP_PASSIVE_MODE is set, but not "no".
2000-12-06 09:23:27 +00:00
Dag-Erling Smørgrav
79aad71d3b Remove some obsolete comments. 2000-12-01 11:05:15 +00:00
Dag-Erling Smørgrav
f9c2053bca Clean up the whitespace encoding code. 2000-12-01 11:04:57 +00:00
Dag-Erling Smørgrav
025bb05a82 Add SCHEME_HTTPS. 2000-12-01 11:04:43 +00:00
Dag-Erling Smørgrav
882974d431 Fix old-style proxy specs: default to FTP if FTP_PROXY was set; only default
to HTTP if HTTP_PROXY was used instead.
2000-11-27 13:42:56 +00:00
Dag-Erling Smørgrav
b431558526 Don't try to get the proxy port number from /etc/services. 2000-11-27 13:41:55 +00:00
Dag-Erling Smørgrav
d41c0df8f8 Don't go haywire if the server closes the connection in the middle of a
multiline response (proper fix this time).
2000-11-22 14:50:46 +00:00
Dag-Erling Smørgrav
04a80993c1 Revert previous commit, it was somewhat hasty. 2000-11-22 14:44:48 +00:00
Dag-Erling Smørgrav
1baad1a183 Don't go haywire if the server closes the connection during a multiline
response.
2000-11-22 14:30:28 +00:00
Ruslan Ermilov
725ab6287f log 2000-11-22 09:23:54 +00:00
Ruslan Ermilov
b82f5db0ac Spell the des's name correctly. 2000-11-14 13:19:26 +00:00
Ruslan Ermilov
b5c508fba3 Use Fx macro wherever possible. 2000-11-14 11:20:58 +00:00
Dag-Erling Smørgrav
e828ada709 Use the documented (and historical) defaults. Centralize the decision logic
in order to avoid this bug in the future.

Submitted by:	se
2000-11-10 08:43:40 +00:00
Dag-Erling Smørgrav
d74a913b68 Use CHECK_FLAG 2000-10-29 15:56:10 +00:00
Dag-Erling Smørgrav
23109751fd Stricter error checking in the I/O functions. 2000-10-29 15:52:05 +00:00
Dag-Erling Smørgrav
1c2598aa2e Add CHECK_FLAGS, a macro for (safely) checking if a particular flag is set. 2000-10-29 15:45:31 +00:00
Dag-Erling Smørgrav
91c5104600 Document FTP_PASSIVE_MODE and FTP_PASSWORD.
PR:		docs/20626
Submitted by:	nik
2000-10-29 12:58:08 +00:00
Dag-Erling Smørgrav
7ca2f6ae1f Fix this my way. David had absolutely no call overriding MAINTAINER without
even giving me 24 hours to read his mail and find the bug.
2000-10-28 20:53:02 +00:00
David E. O'Brien
f18255c68b Install per function manpages so one doesn't mistakenly think we don't
have manpages for libfetch's functions.
2000-10-28 20:32:39 +00:00
David E. O'Brien
f03bce74fc Repeat after me, "check to see that a pointer isn't NULL before
dereferenceing it".  This fixes ``pkg_add -r''.
2000-10-28 20:27:11 +00:00
Dag-Erling Smørgrav
303fd73aa7 MFS: don't expect result code until you close the data connection 2000-10-27 11:37:21 +00:00
Dag-Erling Smørgrav
c7d40ef296 Use funopen() instead of fdopen(). This fixes three problems:
- ftpTimeout was not honored when reading actual data, as opposed to
   talking protocol

 - connection caching was broken because _ftp_cached_connect() would see
   the result of the transfer instead of the result of the NOOP.

 - if the RETR succeeded, but an error occurred later (as can happen
   when talking to a proxy), the error would not be detected.

There still remains to register an atexit(3) callback to close the cached
connection gracefully instead of just dropping it on the floor.
2000-10-22 12:07:28 +00:00
Dag-Erling Smørgrav
23fe6d7a4c If the scheme is HTTP or HTTPS, percent-escape whitespace in the document
part.

Submitted by:	green
2000-10-21 14:58:18 +00:00
Dag-Erling Smørgrav
8b9ba4668d Argh! Fix passive mode selection (again) 2000-10-17 19:01:18 +00:00
Dag-Erling Smørgrav
cb5b735396 Use the right user name 2000-10-13 09:36:46 +00:00
Dag-Erling Smørgrav
1df2031c15 Document recent changes in URL parsing and proxy handling 2000-10-12 22:11:26 +00:00
Dag-Erling Smørgrav
bbc5af0c5a ftp.c needs _http_request() 2000-10-12 22:10:43 +00:00
Dag-Erling Smørgrav
1a16ed4c9c Rework proxy handling so that proxies can be specified as URLs.
As a side effect, remove a lot of duplicate and now redundant code.
2000-10-12 22:10:26 +00:00
Dag-Erling Smørgrav
59769ab192 Relax URL syntax so that schemeless URLs are supported. 2000-10-12 22:07:49 +00:00
Dag-Erling Smørgrav
be9e1d8a68 Add macros for the names of the URL schemes we support. 2000-10-12 21:59:22 +00:00
Dag-Erling Smørgrav
89d755e156 Make the ENVIRONMENT section more legible, and mention that HTTP_AUTH is
colon-separated.
2000-10-12 16:55:52 +00:00
Dag-Erling Smørgrav
a898bb8d0d Work around buggy servers such as NCSA httpd which send an incomplete
HTTP-Version on the Status-Line (see RFC2616 sections 3.1 and 6.1).
2000-09-24 12:22:12 +00:00
Dag-Erling Smørgrav
2e83f63844 Document the FTP_PROXY and HTTP_PROXY variables better. 2000-08-31 15:13:22 +00:00
Dag-Erling Smørgrav
ea014d857f Grok 125 replies to passive RETR. This fixes an interoperability bug with
Microsoft FTP Service.

Reported by:	asmodai, eivind
2000-08-21 07:18:31 +00:00
Dag-Erling Smørgrav
be6aff992d Fix signedness bogon. 2000-08-02 11:25:21 +00:00
Dag-Erling Smørgrav
0f27c7838c Don't fail if _ftp_stat() reports a protocol error, since that most likely
means that the server doesn't understand SIZE or MDTM, which should not be a
hard failure.

Submitted by:	ume
2000-07-27 08:48:48 +00:00
Dag-Erling Smørgrav
63428824c9 If the server reports the size as 0, treat it as unknown. This works around
a bug in some ftp servers (most notably ftp.vmunix.com) which report the
size of a file correctly in ascii mode, but report it as 0 in binary mode.

Reported by:	asmodai

Also remove an unneeded initialization.
2000-07-25 14:41:02 +00:00
Dag-Erling Smørgrav
10851dc4ad Centralize the default port finding code.
Work around YA Apache bug: don't send port in Host: header if it's the
default port.
2000-07-25 11:45:38 +00:00
Dag-Erling Smørgrav
c78f1cc912 Ignore environment variables that are set but empty.
Sort out the size / length confusion.  Always try to report the *real* file
size in the url_stat structure, no matter how much of it is actually being
sent, and try to detect inconsistencies between sizes.

Rearrange the request loop to avoid having to add meaningless code just to
silence compiler warnings.

Switch to a more sensible and consistent interface for the _http_parse*()
functions.
2000-07-21 11:02:43 +00:00
Dag-Erling Smørgrav
e0a9ca38aa Document the proxy support better. 2000-07-21 10:57:15 +00:00
Dag-Erling Smørgrav
dfe7c55fcc The decision to use an HTTP proxy for FTP documents belongs in the FTP code 2000-07-21 10:46:22 +00:00
Dag-Erling Smørgrav
2e88106bd1 Don't send port number to proxy unless it's not the standard FTP port 2000-07-21 10:25:33 +00:00
Dag-Erling Smørgrav
5e3f46b51a Fix the case where the file name is preceded by a lone slash. 2000-07-20 02:03:56 +00:00
Dag-Erling Smørgrav
87b41116cc Don't try to skip to the requested offset if the server returns more data
than requested.  Instead, inform the caller of the real offset by modifying
the offset field in the original struct url, and let him decide how to handle
the situation.
2000-07-19 23:43:49 +00:00
Dag-Erling Smørgrav
269532d987 Don't take a failure to stat a file to mean that it doesn't exist, as it may
be a dynamically created file, e.g. a tarball on servers that support sending
tarballs of directories.
2000-07-18 07:12:26 +00:00
Dag-Erling Smørgrav
1a5faa1061 Introduce fetchXGet*(), which combine the functionalities of fetchGet*() and
fetchStat*().  In most cases, either fetchGet*() or fetchXGet*() is a wrapper
around the other; in all cases, calling fetchGet*() is identical to calling
fetchXGet*() with the second argument set to NULL.
2000-07-17 21:25:00 +00:00
Dag-Erling Smørgrav
c789727701 Don't forget to set file descriptor to -1 after closing it, since the code
outside the loop inspects it to determine whether or not we succeeded in
retrieving the requested document. This fixes a bug where fetchGetHTTP()
would return a FILE with an invalid file descriptor if it hit the redirect
limit without locating the requested document.
2000-07-17 21:09:11 +00:00
Dag-Erling Smørgrav
5cd33c40d7 Use a symbolic constant instead of hardcoding 999 2000-07-17 21:00:49 +00:00
Dag-Erling Smørgrav
d999dcac2d Don't forget to declare fetchRestartCalls. 2000-07-17 20:52:06 +00:00
Dag-Erling Smørgrav
a1bb3f482a Introduce the (undocumented) variable fetchRestartCalls, which controls whether
or not interrupted system calls will be restarted. This fixes a bug where
fetch(1) would hang (potentially forever) if a server stopped responding,
because the signal handler would absorb the user's efforts to interrupt the
transfer.
2000-07-17 20:49:39 +00:00
Dag-Erling Smørgrav
7c80207e33 Remove fetchContentType(), which disappeared in the HTTP rewrite. 2000-07-17 20:42:13 +00:00
Dag-Erling Smørgrav
e66b380285 #ifdef DEBUG -> #ifndef NDEBUG
Pointed out by:	ache
2000-07-16 23:18:44 +00:00
Dag-Erling Smørgrav
6290ee735b Reinsert the MIT copyright, which applies to the base64 code and was
left out by accident during the rewrite.
2000-07-16 01:04:10 +00:00
Dag-Erling Smørgrav
f4683775d7 Fix a bug (misplaced continue) that caused redirects to fail. Lots of code
moved around, but the acutal functional changes are small.
Add support for site-internal redirects (where the Location: header gives a
path instead of an absolute URI)

Pointed out by:	kuriyama
2000-07-13 09:13:58 +00:00
Dag-Erling Smørgrav
98f5573fdd Fully document the HTTP authorization feature.
Update the BUGS section to reflect the HTTP rewrite.
2000-07-12 10:41:29 +00:00
Dag-Erling Smørgrav
e4878e39a3 Extensive rewrite of the HTTP code. The new code is significantly cleaner and
more robust, and somewhat more efficient. It also handles authorization and
redirects properly, and supports timeouts like the FTP code.

Many thanks to Umemoto-san for his assistance with IPv6 support, both here
and in other parts of libfetch.
2000-07-12 10:39:56 +00:00
Dag-Erling Smørgrav
e137bceb8f Use fetch_putln() 2000-07-11 23:50:22 +00:00
Dag-Erling Smørgrav
a176302737 Add _fetch_putln() 2000-07-11 23:50:08 +00:00
Dag-Erling Smørgrav
bc2a5e683a Document that basic authorization now kinda works. 2000-07-11 18:13:08 +00:00
Dag-Erling Smørgrav
35f723db8a Rework the authorization code.
Only send absolute URI if connected to a proxy, since Apache doesn't always
understand absolute URIs.
Clean up some of the debugging output.
2000-07-11 18:12:41 +00:00
Dag-Erling Smørgrav
ec894321e3 Clean up the debugging output 2000-07-11 18:07:09 +00:00
Hajimu UMEMOTO
7487ef6243 Free chunks obtained by getaddrinfo(3).
Approved by:	des
2000-07-10 16:28:28 +00:00
Hajimu UMEMOTO
fa5dce6c26 Make EPSV work again. Separate parsing code of 229 replies from
the code for 227 and 228.

Submitted by:	des
2000-07-10 08:41:25 +00:00
Dag-Erling Smørgrav
51e3d46ec0 Don't assume the remote address in a 227 reply is enclosed in parentheses. 2000-07-08 09:27:47 +00:00
Dag-Erling Smørgrav
4d029f13b4 Fix basic authentication, and add proxy authentication.
Submitted by:	se
2000-07-08 08:08:58 +00:00
Dag-Erling Smørgrav
893980ad29 Make restart work in active mode, too.
PR:		bin/18688
Submitted by:	Rudolf Cejka <cejkar@dcse.fee.vutbr.cz>
2000-06-29 10:44:10 +00:00
Dag-Erling Smørgrav
eac7a1e07f Handle multiline replies properly, instead of kinda-right. 2000-06-28 15:48:26 +00:00
Dag-Erling Smørgrav
cf5af79cac Don't incorrectly report a protocol error when we get a 302 and redirects
are disabled.
2000-06-21 09:49:51 +00:00
Dag-Erling Smørgrav
def5f54c85 Back out wes' commit with extreme prejudice. 2000-06-20 13:57:00 +00:00
Wes Peters
bda4ef1aa0 Add implementation of fetchListFTP.
Reviewed by:	silence
2000-06-20 05:32:41 +00:00
Dag-Erling Smørgrav
6f9febf93c Hackish support for 302 redirect. 2000-05-26 15:34:42 +00:00
Dag-Erling Smørgrav
d02e84a626 Honor FTP_PASSIVE_MODE so caller doesn't need to. 2000-05-26 12:56:53 +00:00
Dag-Erling Smørgrav
a68f8b580f Output newline after debugging message 2000-05-25 16:50:08 +00:00
Dag-Erling Smørgrav
9a964d6a82 Add (and document) fetchMakeURL() 2000-05-25 16:46:09 +00:00
Dag-Erling Smørgrav
ba101983d5 Dump com_err, it's a stinking crock of shit. 2000-05-25 16:24:31 +00:00
Hajimu UMEMOTO
4ab587f4cf Use $FTP_PASSWORD for FTP password. If $FTP_PASSWORD is not
found, `yourname@yourhost' is used.
2000-05-22 13:01:13 +00:00
Hajimu UMEMOTO
28c645cf6a IPv6 support. 2000-05-20 18:23:51 +00:00
Dag-Erling Smørgrav
6efb30c8d0 Better handling of some boundary conditions.
Submitted by:	ume
2000-05-19 09:45:42 +00:00
Hajimu UMEMOTO
c97925ad4e Make HTTP_PROXY work for FTP.
Reported by:	Ben Smithurst <ben@scientia.demon.co.uk>
Reviewed by:	des
2000-05-15 09:05:36 +00:00
Dag-Erling Smørgrav
40ac28454e Document struct url.
Document the default values for fetchStat*().
2000-05-15 08:34:42 +00:00
Dag-Erling Smørgrav
7a5b4b1ba6 Initialize the struct url_stat at the beginning of _fetch_stat_file(). 2000-05-15 08:33:58 +00:00
Dag-Erling Smørgrav
0669702c01 Initialize the struct url_stat at the beginning of fetchStatFTP(). 2000-05-15 08:24:58 +00:00
Dag-Erling Smørgrav
f8f4130b77 Remove unused 'verbose'.
Initialize the struct url_stat at the beginning of fetchStatHTTP().
2000-05-15 08:24:29 +00:00
Dag-Erling Smørgrav
89474d129e Add workaround for ftpds with the Y2K MDTM bug 2000-05-11 16:01:03 +00:00
Dag-Erling Smørgrav
96d7319afb Bump major number, since struct url has changed.
Discussed with:	jdp
2000-05-11 15:29:26 +00:00
Dag-Erling Smørgrav
9364c53225 Fix hard sentence break.
Submitted by:	sheldonh
2000-05-11 15:22:52 +00:00
Dag-Erling Smørgrav
60245e42b0 Reorganize some of the http code and split it into more functions.
Implement fetchStatHTTP().
Unbungle struct url, and add fetchFreeURL().
Document it.
2000-05-11 13:31:02 +00:00
Sheldon Hearn
0f5fcaa3f1 Supply only one author name per instance of %A, as per mdoc.samples(7).
PR:		18465
Submitted by:	Kazu TAKAMUNE <takamune@avrl.mei.co.jp>
2000-05-10 09:49:04 +00:00
Dag-Erling Smørgrav
068cd2851f While we're at it, add a length field too in case we want to fully implement
partial fetches later.
2000-05-07 20:52:40 +00:00
Dag-Erling Smørgrav
3d2a847151 Implement restart 2000-05-07 20:51:31 +00:00
Dag-Erling Smørgrav
807c941c90 Use sizeof more consistently. 2000-05-07 20:02:52 +00:00
Dag-Erling Smørgrav
e6182307e8 Use sizeof more consistently.
Outline sanity checking of server port spec.
2000-05-07 20:01:55 +00:00
Dag-Erling Smørgrav
32425dafcd Implement restart.
Use sizeof more consistently.
Outline sanity checking of server port spec.
2000-05-07 20:00:12 +00:00
Dag-Erling Smørgrav
5ff28c822b Implement restart 2000-05-07 19:56:07 +00:00
Dag-Erling Smørgrav
fd75cc902e Add offset field to struct url 2000-05-07 19:46:33 +00:00
Alexey Zelkin
15efcd39ae Introduce .Lb macro to libfetch manpage
Sort .Nm values
Change first column width in errors list (table look much better now)
Remove redundant comma
2000-04-22 16:08:41 +00:00
Sheldon Hearn
c6ff3a1bf7 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.
2000-03-02 09:14:21 +00:00
Dag-Erling Smørgrav
5d32c97ce9 Fix timestamp handling.
Submitted by:	bde
2000-01-26 12:50:46 +00:00
Rodney W. Grimes
d05257b0f2 Replace beforeinstall target with new variables used by .mk system.
Reviewed by:	marcel, and make world
2000-01-14 07:57:47 +00:00
Dag-Erling Smørgrav
fc6e9e6539 More old uncommitted patches: implement timeouts at the protocol level.
Currently only supported for ftp connections.
2000-01-07 12:58:40 +00:00
Dag-Erling Smørgrav
be0d5ff224 Add error codes for protocol errors. 2000-01-07 12:56:27 +00:00
Dag-Erling Smørgrav
f5f109a068 Patches I've had lying around for several months:
* Add the 'h' ftp flag (allocate local port in high range)
 * Add the 'd' flag (use direct connection even if proxy is defined)
 * Make sure flags != NULL before calling strchr().
 * Minor changes to some comments.
2000-01-07 10:59:12 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Bruce Evans
e7720fa877 Fixed prototype for fetchParseURL(). 1999-03-05 18:45:32 +00:00
Dag-Erling Smørgrav
5a5375540a Add MAINTAINER. 1999-01-29 12:15:34 +00:00
Dag-Erling Smørgrav
ce71b7364c Implement and document file list retrieval. 1998-12-21 19:41:50 +00:00
Dag-Erling Smørgrav
d941fd2df9 Don't specify a language to compile_et.
Rename fetchConnect to _fetch_connect since it's internal.
1998-12-18 14:32:48 +00:00
Dag-Erling Smørgrav
5aea254ff0 Implement and document fetchStatFTP.
Update description of struct url_stat in the man page.
Clean up error handling in ftp.c.
1998-12-16 15:29:03 +00:00
Dag-Erling Smørgrav
3b7a67401b Remove unused header files. Fix a few shadowing bugs. Improve error reporting. 1998-12-16 11:44:31 +00:00
Dag-Erling Smørgrav
0fba3a0005 Add verbose flag, and support functions.
Brucify the Makefile.
Differentiate atime and mtime in fetch*Stat().
Fix a few pointer bugs.
Tweak some error messages.
Don't #include sys/param.h and stdio.h in fetch.h.
Document that sys/param.h and stdio.h must be #included before fetch.h.
1998-12-16 10:24:55 +00:00
Dag-Erling Smørgrav
2878b30827 Fix the "Unknown HTTP error" message.
Make compile_et generate prototypes.
1998-12-15 12:24:26 +00:00
Dag-Erling Smørgrav
08f9fcbfa8 fetch_err.h is a generated file, so don't look for it in ${.CURDIR}. 1998-11-07 08:59:38 +00:00
Dag-Erling Smørgrav
d8acd8dc5c Second of a series of cleanups to libfetch.
This commit introduces the following features:

 a) the fetchStat*() functions, which return meta-information for a
    document, such as size, modification time, etc.

 b) the use of the com_err(3) facilities to report errors.

It also fixes a bunch of style bugs and a few logic bugs and somewhat
improves the man page.

Changed files, in alphabetical order:

 Makefile:
  Don't generate macros in {ftp,http}err.c.

  Generate category fields for the error message lists.

  Compile the error table.

  Install fetch_err.h along with fetch.h.

 common.c:
  Remove the _netdb_errstring() macro, and add FETCH_ERR_NETDB to the
  error code in the _netdb_seterr() macro.

  Add categories to the _netdb_errlist table.

  Report errors through the Common Error library.

 common.h:
  Add the DEBUG macros.

  Add prototype for fetchConnect().

  Remove the prototype for _fetch_errstring(), which is local to common.c

  Add a categroy field to struct fetcherr, and define constants for
  error categories.

  Define macros for _{url,netdb,ftp,http}_seterr().

 errors.et: (new file)
  List error categories.

 fetch.3:
  Document the fetchStat*() functions.

  Move the "unimplemented functionality" comments from NOTES to BUGS.

  Document that applications which use libfetch must also use
  libcom_err, and list existing error codes.

  Undocument fetchLastErr{Code,String}.

  Remove the (empty) DIAGNOSTICS section.

  Mention Eugene Skepner in the AUTHORS section.

 fetch.c:
  Move the DEBUG macros to common.c

  Add fetchStat() and fetchStatURL().

  Generate error messages for URL parser errors, and fix a minor bug
  in the parser.

  Use 'struct url' instead of 'url_t'.

  Remove fetchLastErr{Code,String}.

 fetch.h:
  Use 'struct url' instead of 'url_t', and remove the typedef.

  Define struct url_stat (used by fetchStat()).

  Add prototypes for fetchStat*().

  Remove the declarations for fetchLastErr{Code,String}.

  Include fetch_err.h.

 fetch_err.et: (new file)
  Error table for libfetch.

 file.c:
  Add fetchStatFile().

  Use 'struct url' instead of 'url_t'.

 ftp.c:
  Add fetchStatFTP().

  Use 'struct url' instead of 'url_t'.

  Don't use fetchLastErrCode.

 ftp.errors:
  Add categories to all error messages.

 http.c:
  Add fetchStatHTTP().

  Use 'struct url' instead of 'url_t'.

  Don't use fetchLastErr{Code,Text}.

 http.errors:
  Add categories to all error messages.

Prompted by: jkh and Eugene Skepner
Numerous sugestions from: Garett Wollman and Eugene Skepner
1998-11-06 22:14:08 +00:00
Dag-Erling Smørgrav
842a95cc23 First of a series of cleanups to libfetch. Changed files, in
alphabetical order:

 Makefile:
  Add common.c to SRCS.

  Make debugging easier by making 'CFLAGS += -DNDEBUG' conditional on DEBUG

  Don't declare struct {ftp,http}err in {ftp,http}err.c; use struct fetcherr
  instead.

 README:
  Remove the todo list, which is out of date anyway.

 common.c: (new file)
  Gather utility functions in this file.

  Merge the error reporting functions intp _fetch_errstring(),
  _fetch_seterr() and _fetch_syserr().

  Set fetchLastErrCode and fetchLastErrText appropriately when fetchConnect
  fails.

 common.h: (new file)
  Gather internal prototypes and structures in this files.

 fetch.3:
  Undocument fetchFreeURL().

  Document a few more known bugs.

  Document fetchLastErrCode and fetchLastErrText.

 fetch.c:
  Add descriptive comments to all functions that lacked them.

  Move fetchConnect() to common.c.

  Obviate the need for fetchFreeURL(), and remove it.

 fetch.h:
  Modify struct url_t so the document part is at the end.

 ftp.c:
  Remove code that is duplicated elsewhere.

 http.c:
  Remove code that is duplicated elsewhere.

Prompted by: jkh
1998-11-05 19:48:17 +00:00
Dag-Erling Smørgrav
db5f8ceb40 Bring the man page more or less up to date with the code. 1998-09-26 20:42:44 +00:00
Bruce Evans
90152d9d21 Made this actually work when there's an object directory:
- replaced bogus dependencies of distribution sources on generated
  sources by the same ones that bsd.lib.mk would generate if it knew
  all the sources.  We shoot ourself in the foot by not naming the
  generated (included) sources *.h, so we can just put the generated
  sources in SRCS.
- replaced -I${.CURDIR} by `-I.'.  Here `.' is an alias for ${.OBJDIR}.
  -I${.CURDIR} didn't do anything, since ${.CURDIR} is the default in
  all cases here (it would be necessary for ""-style includes made from
  sources in ${.OBJDIR}.

Don't use `+=' for setting CLEANFILES for the first time.

Added $Id$.
1998-08-17 20:39:09 +00:00
Dag-Erling Smørgrav
ecc9135299 Commit a bunch of patches that have been accumulating:
- Fix the README to reflect the new status of the ftp code.
 - Change tons of 'if (xxx < 0)' to 'if (xxx == -1)'
 - Add two new interface functions
 - Fix the Makefile so it actually works (yay!)

Now the manpage is lagging even further behind... :( Next on the todo
list is to clean up the http code.
1998-08-17 09:30:19 +00:00
Dag-Erling Smørgrav
44bcb03a54 Forgot to remove base64.c from SRCS in the Makefile. 1998-07-12 22:37:45 +00:00
Dag-Erling Smørgrav
f62e5228fd Base64 code (and the MIT copyright) moved to http.c
FTP STORe and APPEnd added.
FTP proxy support added (untested).
1998-07-12 22:34:40 +00:00
Dag-Erling Smørgrav
346298f0de FTP retrieve works. 1998-07-11 21:29:08 +00:00
Dag-Erling Smørgrav
8e3986ea36 Too many changes to list. Basically, FTP is nearly there and error
reporting is kinda sorted out. Now HTTP needs to catch up...
1998-07-11 18:56:01 +00:00
Dag-Erling Smørgrav
4ca1ab9434 Imported libfetch into the tree. It compiles, but there's still some
work to do. I especially need help with the man page.
1998-07-09 16:52:44 +00:00