summaryrefslogtreecommitdiff
path: root/lib/libfetch/http.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix two issues related to the use of SIGINFO in fetch(1) to displayDag-Erling Smørgrav2012-01-181-5/+12
| | | | | | | | | | | | | | | | progress information. The first is that fetch_read() (used in the HTTP code but not the FTP code) can enter an infinite loop if it has previously been interrupted by a signal. The second is that when it is interrupted, fetch_read() will discard any data it may have read up to that point. Luckily, both bugs are extremely timing-sensitive and therefore difficult to trigger. PR: bin/153240 Submitted by: Mark <markjdb@gmail.com> MFC after: 3 weeks Notes: svn path=/head/; revision=230307
* latin1 -> utf8Dag-Erling Smørgrav2011-10-191-1/+1
| | | | Notes: svn path=/head/; revision=226537
* Update copyright dates and strip my middle name.Dag-Erling Smørgrav2011-09-271-1/+1
| | | | Notes: svn path=/head/; revision=225814
* Increase WARNS to 4.Dag-Erling Smørgrav2011-05-121-1/+1
| | | | Notes: svn path=/head/; revision=221822
* Mechanical whitespace cleanup.Dag-Erling Smørgrav2011-05-121-100/+100
| | | | Notes: svn path=/head/; revision=221821
* Increase WARNS to 3.Dag-Erling Smørgrav2011-05-121-1/+1
| | | | Notes: svn path=/head/; revision=221820
* Fix a couple of embarrassing mistakes in the previous commit.Dag-Erling Smørgrav2010-07-281-2/+2
| | | | | | | Submitted by: Dimitry Andric <dimitry@andric.com> Notes: svn path=/head/; revision=210563
* If the A flag is supplied, http_request() will attempt the request onlyDag-Erling Smørgrav2010-07-011-2/+4
| | | | | | | | | | | | | | once, even if authentication is required, instead of retrying with the proper credentials. Fix this by bumping the countdown if the origin or proxy server requests authentication so that the initial unauthenticated request does not count as an attempt. PR: 148087 Submitted by: Tom Evans <tevans.uk@googlemail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=209632
* Add HTTP digest authentication.Dag-Erling Smørgrav2010-01-191-66/+816
| | | | | | | | Submitted by: Jean-Francois Dockes <jf@dockes.org> Forgotten by: des (repeatedly) Notes: svn path=/head/; revision=202613
* Add support for HTTP 1.1 If-Modified-Since behavior.Murray Stokely2008-12-151-3/+25
| | | | | | | | | | | | | | | | | fetch(1) accepts a new argument -i <file> that if specified will cause the file to be downloaded only if it is more recent than the mtime of <file>. libfetch(3) accepts the mtime in the url structure and a flag to indicate when this behavior is desired. PR: bin/87841 Submitted by: Jukka A. Ukkonen <jau@iki.fi> (partially) Reviewed by: des, ru MFC after: 3 weeks Notes: svn path=/head/; revision=186124
* Don't fail mistakenly with -r when we already have the whole file.Ruslan Ermilov2008-10-241-0/+1
| | | | | | | Reviewed by: des Notes: svn path=/head/; revision=184222
* Use memcpy(3) instead of the BSD-specific bcopy(3).Dag-Erling Smørgrav2008-02-081-1/+1
| | | | | | | | Submitted by: Joerg Sonnenberger <joerg@britannica.bec.de> MFC after: 2 weeks Notes: svn path=/head/; revision=176105
* Add necessary cast for tolower() argument.Dag-Erling Smørgrav2008-02-061-2/+3
| | | | | | | | Submitted by: Joerg Sonnenberger <joerg@britannica.bec.de> MFC after: 1 week Notes: svn path=/head/; revision=176036
* As several people pointed out, I did all the ctype casts the wrongDag-Erling Smørgrav2007-12-191-13/+15
| | | | | | | | | | way (not for the first time...) Noticed by: bde, ru ++ MFC after: 1 week Notes: svn path=/head/; revision=174761
* Add support for the NO_PROXY / no_proxy environment variable as used byDag-Erling Smørgrav2007-12-181-3/+5
| | | | | | | | | | | | lynx, curl etc. Note that this patch differs significantly from that in the PR, as the submitter refined it after submitting the PR. PR: 110388 Submitted by: Alexander Pohoyda <alexander.pohoyda@gmx.net> MFC after: 3 weeks Notes: svn path=/head/; revision=174752
* Old patch I had lying around: correctly cast the argument to is*().Dag-Erling Smørgrav2007-12-181-12/+13
| | | | | | | | | IWBNI gcc could warn about this the way it warns about printf() abuse. MFC after: 1 week Notes: svn path=/head/; revision=174751
* Clean up namespace violations.Dag-Erling Smørgrav2007-12-141-97/+97
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=174588
* Handle temporary redirects (HTTP status code 307)Dag-Erling Smørgrav2007-05-081-0/+2
| | | | | | | | | PR: kern/112515 Submitted by: Ryan C. Gordon <icculus@icculus.org> MFC after: 3 weeks Notes: svn path=/head/; revision=169386
* Ignore HTTP_PROXY if it is defined but empty. This was already handledDag-Erling Smørgrav2005-08-241-1/+1
| | | | | | | | | | | | | correctly in the case of FTP_PROXY, because an empty FTP_PROXY has a specific meaning ("don't use any proxy at all for ftp, even if HTTP_PROXY is defined"), while an empty HTTP_PROXY has no meaning at all. PR: bin/85185 Submitted by: Conall O'Brien <conallob=freebsd@maths.tcd.ie> MFC after: 2 weeks Notes: svn path=/head/; revision=149414
* Set the TCP_NODELAY socket option and clear TCP_NOPUSH in order to flushKelly Yancey2005-03-021-2/+15
| | | | | | | | | | | any pending HTTP request rather than calling shutdown(2) with SHUT_WR. This makes libfetch (and thus fetch(1)) work again with Squid proxies configured to not allow half-closed connections. Reported by: Pawel Worach (pawel.worach AT telia DOT com) Notes: svn path=/head/; revision=143049
* Set TCP_NOPUSH on HTTP requests, reducing the number of round-tripsKelly Yancey2005-02-161-1/+9
| | | | | | | | | necessary to establish each connection. MFC after: 2 weeks Notes: svn path=/head/; revision=141958
* Update copyright years.Dag-Erling Smørgrav2004-09-211-1/+1
| | | | Notes: svn path=/head/; revision=135546
* Don't forget to allocate space for the terminating NUL when converting toDag-Erling Smørgrav2004-08-071-1/+1
| | | | | | | | | | | base 64. PR: misc/70022 Submitted by: Herve Masson <herve-bsdbt@mindstep.com> MFC after: 3 days Notes: svn path=/head/; revision=133280
* Slight tweak to previous commit: don't forget to call _http_seterr() ifDag-Erling Smørgrav2004-02-111-0/+1
| | | | | | | we get a genuine 416 reply. Notes: svn path=/head/; revision=125697
* When restarting a transfer that has already completed, the server willDag-Erling Smørgrav2004-02-111-9/+41
| | | | | | | | | | 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. Notes: svn path=/head/; revision=125696
* Re-wrap some comments.Dag-Erling Smørgrav2004-02-111-6/+7
| | | | Notes: svn path=/head/; revision=125695
* 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