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

Re: [PATCH v2 4/4] http.c: allow custom TCP keepalive behavior via config

From
Jeff King <peff@peff.net>
Date
Apr 1, 2025, 09:16 UTC
Message-ID
<20250401091606.GC21089@coredump.intra.peff.net>
In-Reply-To
<3fe62181e563d011d4a6374ed7894cc4ea807316.1742423021.git.me@ttaylorr.com>
On Wed, Mar 19, 2025 at 06:23:56PM -0400, Taylor Blau wrote:
> For those users and others who wish to more finely tune the OS's
> keepalive behavior, expose configuration and environment variables which
> allow setting curl's KEEPIDLE, KEEPINTVL, and KEEPCNT options.

OK. I have never wanted those myself, but I have no problem with other people using them. ;)

The implementation mostly looks as I'd expect, but...
Show 5 quoted lines
> +http.keepAliveIdle::
> +	Specifies how long in seconds to wait on an idle connection
> +	before sending TCP keepalive probes (if supported by the OS). If
> +	unset, curl's default value is used. Can be overridden by the
> +	`GIT_HTTP_KEEPALIVE_IDLE` environment variable.

...while this environment variable (and its siblings) makes sense to me....

Show 7 quoted lines
> @@ -1382,6 +1409,10 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
>  			ssl_cert_password_required = 1;
>  	}
>  
> +	set_long_from_env(&curl_tcp_keepidle, "GIT_TCP_KEEPIDLE");
> +	set_long_from_env(&curl_tcp_keepintvl, "GIT_TCP_KEEPINTVL");
> +	set_long_from_env(&curl_tcp_keepcnt, "GIT_TCP_KEEPCNT");
...we seem to use different names in the code.

I think the ones mentioning HTTP make the most sense, to match the config (and since this only affects curl).

-Peff
Previous: Taylor BlauNext: Elijah Newren
Message 20 of 21 in “http: support fine-tuning curl's keepalive behavior”
  1. 0/3 http: support fine-tuning curl's keepalive behaviorTaylor Blau, Mar 18, 2025
  2. 1/3 http.c: introduce `set_long_from_env()` for convenienceTaylor Blau, Mar 18, 2025
  3. Elijah NewrenMar 19, 2025
  4. Patrick SteinhardtMar 19, 2025
  5. Taylor BlauMar 19, 2025
  6. 2/3 http.c: inline `set_curl_keepalive()`Taylor Blau, Mar 18, 2025
  7. Elijah NewrenMar 19, 2025
  8. 3/3 http.c: allow custom TCP keepalive behavior via configTaylor Blau, Mar 18, 2025
  9. Patrick SteinhardtMar 19, 2025
  10. Elijah NewrenMar 19, 2025
  11. Taylor BlauMar 19, 2025
  12. 0/4 http: support fine-tuning curl's keepalive behaviorTaylor Blau, Mar 19, 2025
  13. 1/4 http.c: remove unnecessary casts to longTaylor Blau, Mar 19, 2025
  14. 2/4 http.c: introduce `set_long_from_env()` for convenienceTaylor Blau, Mar 19, 2025
  15. Patrick SteinhardtMar 20, 2025
  16. Jeff KingApr 1, 2025
  17. 3/4 http.c: inline `set_curl_keepalive()`Taylor Blau, Mar 19, 2025
  18. Jeff KingApr 1, 2025
  19. 4/4 http.c: allow custom TCP keepalive behavior via configTaylor Blau, Mar 19, 2025
  20. Jeff KingApr 1, 2025
  21. Elijah NewrenMar 19, 2025

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.