Re: [PATCH v2] http.c: use CURLOPT_RANGE for range requests

2015-11-01 Thread Daniel Stenberg
On Fri, 30 Oct 2015, Jeff King wrote: The goal makes sense. Why weren't we using CURLOPT_RANGE before? Did it not exist (or otherwise have limitations) in 2005, and if so, when did it become usable? Do we need to protect this with an #ifdef for the curl version? CURLOPT_RANGE existed already

Re: [PATCH v2] http.c: use CURLOPT_RANGE for range requests

2015-11-01 Thread Jeff King
On Mon, Nov 02, 2015 at 12:00:42AM +0100, Daniel Stenberg wrote: > On Fri, 30 Oct 2015, Jeff King wrote: > > >The goal makes sense. Why weren't we using CURLOPT_RANGE before? Did it > >not exist (or otherwise have limitations) in 2005, and if so, when did it > >become usable? Do we need to

Re: [PATCH v2] http.c: use CURLOPT_RANGE for range requests

2015-11-01 Thread Daniel Stenberg
On Sun, 1 Nov 2015, Jeff King wrote: While I have your attention, Daniel, am I correct in assuming that performing a second unrelated request with the same CURL object will need an explicit: curl_easy_setopt(curl, CURLOPT_RANGE, NULL); to avoid using the range twice? Correct. As the

Re: [PATCH v2] http.c: use CURLOPT_RANGE for range requests

2015-10-31 Thread Junio C Hamano
Jeff King writes: > We could even hide the whole thing away with something like: > > void http_set_range(CURL *curl, long lo, long hi) > { > char buf[128]; > int len = 0; > > if (lo >= 0) > len += xsnprintf(buf + len, "%ld", lo); > len +=

Re: [PATCH v2] http.c: use CURLOPT_RANGE for range requests

2015-10-31 Thread Jeff King
On Sat, Oct 31, 2015 at 10:40:13AM -0700, Junio C Hamano wrote: > Jeff King writes: > > > We could even hide the whole thing away with something like: > > > > void http_set_range(CURL *curl, long lo, long hi) > > { > > char buf[128]; > > int len = 0; > > > > if

[PATCH v2] http.c: use CURLOPT_RANGE for range requests

2015-10-30 Thread David Turner
A HTTP server is permitted to return a non-range response to a HTTP range request (and Apache httpd in fact does this in some cases). While libcurl knows how to correctly handle this (by skipping bytes before and after the requested range), it only turns on this handling if it is aware that a

Re: [PATCH v2] http.c: use CURLOPT_RANGE for range requests

2015-10-30 Thread Junio C Hamano
David Turner writes: > A HTTP server is permitted to return a non-range response to a HTTP > range request (and Apache httpd in fact does this in some cases). > While libcurl knows how to correctly handle this (by skipping bytes > before and after the requested range),

Re: [PATCH v2] http.c: use CURLOPT_RANGE for range requests

2015-10-30 Thread Jeff King
On Fri, Oct 30, 2015 at 06:54:42PM -0400, David Turner wrote: > A HTTP server is permitted to return a non-range response to a HTTP > range request (and Apache httpd in fact does this in some cases). > While libcurl knows how to correctly handle this (by skipping bytes > before and after the