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

Re: [BUG?] git http connection reuse

From
Daniel Stenberg <daniel@haxx.se>
Date
Feb 18, 2014, 09:09 UTC
Message-ID
<alpine.DEB.2.00.1402181001540.15465@tvnag.unkk.fr>
In-Reply-To
<20140218075534.GB29804@sigill.intra.peff.net>
On Tue, 18 Feb 2014, Jeff King wrote:
> I'm not clear whether you mean by this that it is _expected_ in my test 
> program for curl not to reuse the connection. Or that curl may simply have 
> to do a little more work, and it is still a bug that the connection is not 
> reused.

Okey, I checked this closer now and this is the full explanation to what happens. It seems to work as intended:

It's all about where the connection cache is held by libcurl. When you create a multi handle, it will create a connection cache that will automatically be shared by all easy handles that are added to it.

If you create an easy handle and make a curl_easy_perform() on that, it will create its own connection cache and keep it associated with this easy handle.

When first using an easy handle within a multi handle it will use the shared connection cache in there as long as it is in that multi handle family, but as soon as you remove it from there it will be detached from that connection cache.

Then, when doing a fresh request with easy_perform using the handle that was detached from the multi handle, it will create and use its own private cache as it can't re-use the previous connection that is cached within the multi handle.

> We can certainly teach git to use the multi interface, even when doing a 
> single blocking request.
For connection re-use purposes, that may make a lot of sense.
-- 
  / daniel.haxx.se
Previous: Daniel StenbergNext: Jeff King
Message 10 of 11 in “[BUG?] git http connection reuse”
  1. Jeff KingFeb 16, 2014
  2. Kyle J. McKayFeb 16, 2014
  3. Daniel StenbergFeb 16, 2014
  4. Daniel StenbergFeb 16, 2014
  5. Jeff KingFeb 17, 2014
  6. Jeff KingFeb 17, 2014
  7. Daniel StenbergFeb 18, 2014
  8. Jeff KingFeb 18, 2014
  9. Daniel StenbergFeb 18, 2014
  10. Daniel StenbergFeb 18, 2014
  11. http: never use curl_easy_performJeff King, Feb 18, 2014

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.