]> git.ipfire.org Git - thirdparty/git.git/commit - http.c
http: use curl's tcp keepalive if available
authorJeff King <peff@peff.net>
Tue, 15 Oct 2013 00:06:14 +0000 (20:06 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 16 Oct 2013 18:26:09 +0000 (11:26 -0700)
commit47ce115370cba8ebfced696f9997e718c465435d
tree913b534484ca757bb1fe82060c8d096724af3aa4
parenta15d069a19867b9c508ccfca5702f36448e829e8
http: use curl's tcp keepalive if available

Commit a15d069 taught git to use curl's SOCKOPTFUNCTION hook
to turn on TCP keepalives. However, modern versions of curl
have a TCP_KEEPALIVE option, which can do this for us. As an
added bonus, the curl code knows how to turn on keepalive
for a much wider variety of platforms. The only downside to
using this option is that not everybody has a new enough curl.
Let's split our keepalive options into three conditionals:

  1. With curl 7.25.0 and newer, we rely on curl to do it
     right.

  2. With older curl that still knows SOCKOPTFUNCTION, we
     use the code from a15d069.

  3. Otherwise, we are out of luck, and the call is a no-op.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c