Dag-Erling Smørgrav
4d3d90ad0a
Slight tweak to previous commit: don't forget to call _http_seterr() if
...
we get a genuine 416 reply.
2004-02-11 09:35:27 +00:00
Dag-Erling Smørgrav
b5e1214546
When restarting a transfer that has already completed, the server will
...
reply with a 416 error code (requested range not satisfiable) because
we ask it to start at the end of the file. Handle this gracefully by
considering a 416 reply a success if the requested offset exactly
matches the length of the file and the requested length is zero.
2004-02-11 09:31:39 +00:00
Dag-Erling Smørgrav
2576e45915
Re-wrap some comments.
2004-02-11 09:23:35 +00:00
Dag-Erling Smørgrav
762892c047
Don't dereference flags if NULL (see http.c rev 1.87)
2003-03-29 15:15:38 +00:00
Dag-Erling Smørgrav
b91d6074d4
Don't parse the proxy URL unless we're actually going to use it. No real
...
functional difference, but debugging output will be less confusing.
2003-03-11 08:20:58 +00:00
Dag-Erling Smørgrav
930105c1e9
style(9): add parentheses to sizeof even when not strictly required.
...
MFC after: 3 days
2003-01-28 08:04:40 +00:00
Dag-Erling Smørgrav
591c019988
A negative offset means "get it all".
2003-01-22 17:52:27 +00:00
Dag-Erling Smørgrav
d5216a4fb7
Implement and document support for an HTTP_REFERER environment variable.
...
PR: 28171
Submitted by: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
Approved by: re (bmah)
MFC after: 1 week
2002-11-28 12:07:15 +00:00
Dag-Erling Smørgrav
a49b853d94
Use __func__ and break a long line.
2002-10-30 15:01:29 +00:00
Dag-Erling Smørgrav
cab8495092
Don't forget to set the error flag when _fetch_read() returns -1.
2002-10-30 04:42:01 +00:00
Dag-Erling Smørgrav
9f788e9c90
Eliminate two cases of undefined behaviour: total in _fetch_write() was
...
not initialized before use, and _http_growbuf() did not return a value
on success.
Reported by: Peter Edwards <pmedwards@eircom.net>
MFC after: 2 weeks
2002-10-27 15:43:40 +00:00
Ruslan Ermilov
721d559c03
HTTP authentication got broken in rev. 1.49.
2002-10-03 10:42:19 +00:00
Dag-Erling Smørgrav
f8bd33a0ae
Don't try to dereference conn when we know it's NULL.
2002-06-19 08:36:00 +00:00
Dag-Erling Smørgrav
3070f6cb06
Make SSL support conditional on NOCRYPT.
2002-06-05 21:35:35 +00:00
Dag-Erling Smørgrav
111e251009
Add SSL support + slight cleanup.
...
Submitted by: Henry Whincup <henry@techiebod.com> (in principle)
2002-06-05 12:46:36 +00:00
Dag-Erling Smørgrav
9601e333a8
Wrap everything in struct connection, and enforce timeouts everywhere
...
(except for DNS operations). Always use funopen() for HTTP, to support
both timeouts and SSL.
2002-06-05 12:19:08 +00:00
Dag-Erling Smørgrav
ccdd94bdd9
Rename struct cookie to struct httpio to avoid confusion (it's not an HTTP
...
cookie) and increase symmetry with equivalent FTP code.
2002-06-05 10:31:01 +00:00
Dag-Erling Smørgrav
d3b03a9006
Add comments to struct cookie.
2002-06-05 10:27:24 +00:00
Dag-Erling Smørgrav
3f4823c55d
Fix a bug I introduced in the chunk decoder in the previous commit..
2002-06-05 10:23:19 +00:00
Dag-Erling Smørgrav
dea29ca1d5
First step towards SSL support: wrap connections in a 'struct connection'
...
which contains the socket descriptor, the input buffer and (yet unused)
SSL state variables. This has the neat side effect of greatly improving
reentrance (though we're not *quite* there yet) and opening the door to
HTTP connection caching.
This commit is inspired by email conversations with and patches from
Henry Whincup <henry@techiebod.com> last fall.
2002-06-05 10:05:03 +00:00
Mark Murray
4cd0119367
Do not use __progname directly (except in [gs]etprogname(3)).
...
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.
2002-03-29 22:43:43 +00:00
Dag-Erling Smørgrav
e19e6098b3
Reindent, and add parentheses to return statements. Some functions in
...
ftp.c and http.c now have exceedingly long lines due to deep nesting;
this will be corrected by reorganizing the code in a later revision.
2002-02-05 22:13:51 +00:00
Dag-Erling Smørgrav
e6f0a33e68
Check the return value from read() when reading the CR/LF at the end of a
...
chunk.
PR: bin/33608
MFC after: 2 weeks
2002-01-20 19:53:12 +00:00
Dag-Erling Smørgrav
a8e9bd8750
In verbose mode, display the full error message from the server, stripping
...
it of HTML tags and comments.
PR: bin/32989
MFC after: 1 week
2002-01-01 16:25:29 +00:00
Dag-Erling Smørgrav
f67efa37d6
Remove VT100 escapes from debugging messages now that they're enabled by
...
default.
PR: 32988
MFC after: 3 days
2002-01-01 14:48:09 +00:00
Dag-Erling Smørgrav
7f807cb867
Conditionalize some debugging code that didn't use the DEBUG macro.
...
MFC after: 1 week
2001-12-09 15:05:58 +00:00
Dag-Erling Smørgrav
6598654546
Properly handle being redirected to an FTP URL.
...
Also fix a couple of not-so-minor bugs:
- missing case for HTTP_SEE_OTHER
- incorrect definition of HTTP_NEED_PROXY_AUTH
PR: 20259
MFC after: 2 weeks
2001-12-04 01:12:51 +00:00
Dag-Erling Smørgrav
f573a5fc94
Tons of type, style and warning fixes that have been rotting in my tree for
...
ages - some of which wouldn't be necessary if gcc wasn't broken or TPTB were
willing to do something (-fno-builtin) about it.
2001-10-18 08:29:26 +00:00
Matthew Dillon
cecb889f1d
Add __FBSDID()s to libfetch
2001-09-30 21:36:09 +00:00
Dag-Erling Smørgrav
6a0cf64bce
Implement a HTTP_USER_AGENT environment variable.
...
PR: 27669
Submitted by: Eoin Lawless <eoin@maths.tcd.ie>
2001-05-27 11:00:36 +00:00
Dag-Erling Smørgrav
6490b215b3
Add rudimentary support for an authentication callback function.
2001-05-26 19:37:15 +00:00
Archie Cobbs
38c7e4a631
Apply 'const' liberally.
...
Fix some other minor glitches.
2001-04-24 00:06:21 +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
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
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
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
be6aff992d
Fix signedness bogon.
2000-08-02 11:25:21 +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
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
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
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
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
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
4d029f13b4
Fix basic authentication, and add proxy authentication.
...
Submitted by: se
2000-07-08 08:08:58 +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