git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 31, 2015, 17:40 UTC
Message-ID
<xmqqfv0rhr7m.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20151031000837.GA25849@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 19 quoted lines
> 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 += xsnprintf(buf + len, "-");
> 	if (hi >= 0)
> 		len += xsnprintf(buf + len, "%ld", hi);
>
> 	curl_easy_setopt(curl, CURLOPT_RANGE, buf);
>   }
>
> That would also make it easier to replace if we do need to keep an
> #ifdef for older versions of curl. But maybe it is just
> over-engineering.

I personally do not think this is an over-engineered version. This is exactly what I had in mind when I alluded to a small helper ;-)

Previous: Jeff KingNext: Jeff King
Message 4 of 8 in “http.c: use CURLOPT_RANGE for range requests”
  1. http.c: use CURLOPT_RANGE for range requestsDavid Turner, Oct 30, 2015
  2. Junio C HamanoOct 30, 2015
  3. Jeff KingOct 31, 2015
  4. Junio C HamanoOct 31, 2015
  5. Jeff KingOct 31, 2015
  6. Daniel StenbergNov 1, 2015
  7. Jeff KingNov 2, 2015
  8. Daniel StenbergNov 2, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.