summaryrefslogtreecommitdiff
path: root/lib/libfetch/http.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't dereference flags if NULL (see http.c rev 1.87)Dag-Erling Smørgrav2003-03-291-1/+1
| | | | Notes: svn path=/head/; revision=112797
* Don't parse the proxy URL unless we're actually going to use it. No realDag-Erling Smørgrav2003-03-111-3/+6
| | | | | | | functional difference, but debugging output will be less confusing. Notes: svn path=/head/; revision=112081
* style(9): add parentheses to sizeof even when not strictly required.Dag-Erling Smørgrav2003-01-281-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=109967
* A negative offset means "get it all".Dag-Erling Smørgrav2003-01-221-2/+2
| | | | Notes: svn path=/head/; revision=109693
* Implement and document support for an HTTP_REFERER environment variable.Dag-Erling Smørgrav2002-11-281-12/+21
| | | | | | | | | | PR: 28171 Submitted by: Andre Albsmeier <andre.albsmeier@mchp.siemens.de> Approved by: re (bmah) MFC after: 1 week Notes: svn path=/head/; revision=107372
* Use __func__ and break a long line.Dag-Erling Smørgrav2002-10-301-5/+4
| | | | Notes: svn path=/head/; revision=106207
* Don't forget to set the error flag when _fetch_read() returns -1.Dag-Erling Smørgrav2002-10-301-2/+6
| | | | Notes: svn path=/head/; revision=106185
* Eliminate two cases of undefined behaviour: total in _fetch_write() wasDag-Erling Smørgrav2002-10-271-0/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=106044
* HTTP authentication got broken in rev. 1.49.Ruslan Ermilov2002-10-031-4/+4
| | | | Notes: svn path=/head/; revision=104404
* Don't try to dereference conn when we know it's NULL.Dag-Erling Smørgrav2002-06-191-2/+5
| | | | Notes: svn path=/head/; revision=98422
* Make SSL support conditional on NOCRYPT.Dag-Erling Smørgrav2002-06-051-0/+3
| | | | Notes: svn path=/head/; revision=97891
* Add SSL support + slight cleanup.Dag-Erling Smørgrav2002-06-051-1/+6
| | | | | | | Submitted by: Henry Whincup <henry@techiebod.com> (in principle) Notes: svn path=/head/; revision=97868
* Wrap everything in struct connection, and enforce timeouts everywhereDag-Erling Smørgrav2002-06-051-33/+52
| | | | | | | | (except for DNS operations). Always use funopen() for HTTP, to support both timeouts and SSL. Notes: svn path=/head/; revision=97866
* Rename struct cookie to struct httpio to avoid confusion (it's not an HTTPDag-Erling Smørgrav2002-06-051-50/+50
| | | | | | | cookie) and increase symmetry with equivalent FTP code. Notes: svn path=/head/; revision=97859
* Add comments to struct cookie.Dag-Erling Smørgrav2002-06-051-8/+8
| | | | Notes: svn path=/head/; revision=97858
* Fix a bug I introduced in the chunk decoder in the previous commit..Dag-Erling Smørgrav2002-06-051-1/+1
| | | | Notes: svn path=/head/; revision=97857
* First step towards SSL support: wrap connections in a 'struct connection'Dag-Erling Smørgrav2002-06-051-77/+84
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=97856
* Do not use __progname directly (except in [gs]etprogname(3)).Mark Murray2002-03-291-3/+1
| | | | | | | | | 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. Notes: svn path=/head/; revision=93399
* Reindent, and add parentheses to return statements. Some functions inDag-Erling Smørgrav2002-02-051-736/+742
| | | | | | | | 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. Notes: svn path=/head/; revision=90267
* Check the return value from read() when reading the CR/LF at the end of aDag-Erling Smørgrav2002-01-201-2/+4
| | | | | | | | | | chunk. PR: bin/33608 MFC after: 2 weeks Notes: svn path=/head/; revision=89590
* In verbose mode, display the full error message from the server, strippingDag-Erling Smørgrav2002-01-011-3/+48
| | | | | | | | | | it of HTML tags and comments. PR: bin/32989 MFC after: 1 week Notes: svn path=/head/; revision=88771
* Remove VT100 escapes from debugging messages now that they're enabled byDag-Erling Smørgrav2002-01-011-10/+10
| | | | | | | | | | default. PR: 32988 MFC after: 3 days Notes: svn path=/head/; revision=88769
* Conditionalize some debugging code that didn't use the DEBUG macro.Dag-Erling Smørgrav2001-12-091-8/+10
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=87561
* Properly handle being redirected to an FTP URL.Dag-Erling Smørgrav2001-12-041-1/+10
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=87317
* Tons of type, style and warning fixes that have been rotting in my tree forDag-Erling Smørgrav2001-10-181-18/+24
| | | | | | | | ages - some of which wouldn't be necessary if gcc wasn't broken or TPTB were willing to do something (-fno-builtin) about it. Notes: svn path=/head/; revision=85093
* Add __FBSDID()s to libfetchMatthew Dillon2001-09-301-2/+3
| | | | Notes: svn path=/head/; revision=84203
* Implement a HTTP_USER_AGENT environment variable.Dag-Erling Smørgrav2001-05-271-1/+4
| | | | | | | | PR: 27669 Submitted by: Eoin Lawless <eoin@maths.tcd.ie> Notes: svn path=/head/; revision=77261
* Add rudimentary support for an authentication callback function.Dag-Erling Smørgrav2001-05-261-16/+40
| | | | Notes: svn path=/head/; revision=77238
* Apply 'const' liberally.Archie Cobbs2001-04-241-20/+20
| | | | | | | Fix some other minor glitches. Notes: svn path=/head/; revision=75891
* Support lower-case versions of the proxy environment variables.Dag-Erling Smørgrav2001-03-071-1/+2
| | | | | | | PR: bin/25494 Notes: svn path=/head/; revision=73932
* Use the documented (and historical) defaults. Centralize the decision logicDag-Erling Smørgrav2000-11-101-20/+3
| | | | | | | | | in order to avoid this bug in the future. Submitted by: se Notes: svn path=/head/; revision=68551
* Use CHECK_FLAGDag-Erling Smørgrav2000-10-291-6/+6
| | | | Notes: svn path=/head/; revision=67892
* Rework proxy handling so that proxies can be specified as URLs.Dag-Erling Smørgrav2000-10-121-132/+65
| | | | | | | As a side effect, remove a lot of duplicate and now redundant code. Notes: svn path=/head/; revision=67043
* Work around buggy servers such as NCSA httpd which send an incompleteDag-Erling Smørgrav2000-09-241-9/+18
| | | | | | | HTTP-Version on the Status-Line (see RFC2616 sections 3.1 and 6.1). Notes: svn path=/head/; revision=66325
* Fix signedness bogon.Dag-Erling Smørgrav2000-08-021-7/+6
| | | | Notes: svn path=/head/; revision=64129
* Centralize the default port finding code.Dag-Erling Smørgrav2000-07-251-16/+23
| | | | | | | | Work around YA Apache bug: don't send port in Host: header if it's the default port. Notes: svn path=/head/; revision=63842
* Ignore environment variables that are set but empty.Dag-Erling Smørgrav2000-07-211-40/+81
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=63716
* Don't try to skip to the requested offset if the server returns more dataDag-Erling Smørgrav2000-07-191-8/+10
| | | | | | | | | 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. Notes: svn path=/head/; revision=63567
* Introduce fetchXGet*(), which combine the functionalities of fetchGet*() andDag-Erling Smørgrav2000-07-171-7/+21
| | | | | | | | | 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. Notes: svn path=/head/; revision=63340
* Don't forget to set file descriptor to -1 after closing it, since the codeDag-Erling Smørgrav2000-07-171-1/+1
| | | | | | | | | | 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. Notes: svn path=/head/; revision=63337
* #ifdef DEBUG -> #ifndef NDEBUGDag-Erling Smørgrav2000-07-161-2/+2
| | | | | | | Pointed out by: ache Notes: svn path=/head/; revision=63281
* Reinsert the MIT copyright, which applies to the base64 code and wasDag-Erling Smørgrav2000-07-161-0/+32
| | | | | | | left out by accident during the rewrite. Notes: svn path=/head/; revision=63236
* Fix a bug (misplaced continue) that caused redirects to fail. Lots of codeDag-Erling Smørgrav2000-07-131-16/+29
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=63069
* Extensive rewrite of the HTTP code. The new code is significantly cleaner andDag-Erling Smørgrav2000-07-121-446/+685
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=63012
* Rework the authorization code.Dag-Erling Smørgrav2000-07-111-78/+83
| | | | | | | | | Only send absolute URI if connected to a proxy, since Apache doesn't always understand absolute URIs. Clean up some of the debugging output. Notes: svn path=/head/; revision=62965
* Fix basic authentication, and add proxy authentication.Dag-Erling Smørgrav2000-07-081-19/+45
| | | | | | | Submitted by: se Notes: svn path=/head/; revision=62811
* Don't incorrectly report a protocol error when we get a 302 and redirectsDag-Erling Smørgrav2000-06-211-2/+5
| | | | | | | are disabled. Notes: svn path=/head/; revision=61896
* Hackish support for 302 redirect.Dag-Erling Smørgrav2000-05-261-24/+59
| | | | Notes: svn path=/head/; revision=60954
* IPv6 support.Hajimu UMEMOTO2000-05-201-6/+39
| | | | Notes: svn path=/head/; revision=60737
* Better handling of some boundary conditions.Dag-Erling Smørgrav2000-05-191-0/+2
| | | | | | | Submitted by: ume Notes: svn path=/head/; revision=60707