From patchwork Fri Sep 10 11:04:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12484915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A64B8C433EF for ; Fri, 10 Sep 2021 11:04:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88CDF611AD for ; Fri, 10 Sep 2021 11:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232505AbhIJLFu (ORCPT ); Fri, 10 Sep 2021 07:05:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232442AbhIJLFu (ORCPT ); Fri, 10 Sep 2021 07:05:50 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 176D0C061756 for ; Fri, 10 Sep 2021 04:04:39 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id i23so2067526wrb.2 for ; Fri, 10 Sep 2021 04:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SEMIZdSYkElwb087O14Hplmrdixg0yjN9upmkC1IboU=; b=LrpH80kqx3Yt3QSgZ+oHZa9A3bceSvVwWE3+agHj6zGKWHTyuj12axR6j/a+C1+7rU t2eSBDKQQQc7R22ZjhIs22LcNtjnnlwC4JbN9XEnskhlJ82AeB7wD0E8wJ9T5t0HMy50 QIENwlt/I2TsAgTIySVsnWDA2HtvO4icYVV9qOQVIECSEZpmBlWqRFOI0G5rYAzJ+DeS UxzoAvzGS95IxRoJIOv2Ecrjx1OYvz7x7vWLg6VitcPAyQ8t6jw+9mQlpIjPSw81UCTR kVaDOkkT5fm9RsIvd1aI7/O71iZaU3YJaz5Jl0mGY1wPzzjAhBrlm6m1yyGnlfV5yTOT gskA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SEMIZdSYkElwb087O14Hplmrdixg0yjN9upmkC1IboU=; b=l+96r8CGxiSOvZuqhws6a4r4w37sY3j1oxWdfeGd8FCPEYdf7QUYM8iZ7CioFDI+00 qLFMYHx/U1D2sADXyyXbfNWzoH14e9fF1Vvtu9+qtyGfnkAhUKaUqm4hD4KSL/Eio0/5 pnKgHkl7sRvLQp6lQOZGi/UP1jyNwu/9CEF9YWhGtqH18gkFIBBGufCgavb4U+yEE02K 9I9EslgBGIy4RWuTmsEVrUs7ioeboIt8+R4hL9fWqrZsfhMV6MKZ3inLkiTqX5DPMOy8 ep3uba20S126kGCgt/v4smjkePGzcrh0Hv1t3T3iyszqeH6zZt7I3ia5gIwmThbQGXoC mefg== X-Gm-Message-State: AOAM5323uBVKjuhdP33AmnuqRRuyKIiAzI9IUnHLVyMp3be31AoG+Nfp VmFNUgYJkC2FFRsEKpse4FF4BjlaC5tkcw== X-Google-Smtp-Source: ABdhPJzgNsEiJ83l2BtOrSB2utx8SvM3n4tceD3EFVP+ENoEpxwgNc1Dv09mOAwO6MT4Z+06S3jnjA== X-Received: by 2002:a5d:668c:: with SMTP id l12mr2003603wru.436.1631271877327; Fri, 10 Sep 2021 04:04:37 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q201sm1013631wme.2.2021.09.10.04.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 04:04:37 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Bagas Sanjaya , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 1/8] INSTALL: don't mention the "curl" executable at all Date: Fri, 10 Sep 2021 13:04:26 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.873.g125ff7b9940 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In 1d53f90ed97 (The "curl" executable is no longer required, 2008-06-15) the wording for requiring curl(1) was changed to the current "you might also want...". Mentioning the "curl" executable at all is just confusing, someone building git might want to use it to debug things, but they might also just use wget(1) or some other http client. The "curl" executable has the advantage that you might be able to e.g. reproduce a bug in git's usage of libcurl with it, but anyone going to those extents is unlikely to be aided by this note in INSTALL. Signed-off-by: Ævar Arnfjörð Bjarmason --- INSTALL | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/INSTALL b/INSTALL index 66389ce0591..5c6ecf03c27 100644 --- a/INSTALL +++ b/INSTALL @@ -139,11 +139,11 @@ Issues of note: (PPC_SHA1). - "libcurl" library is used by git-http-fetch, git-fetch, and, if - the curl version >= 7.34.0, for git-imap-send. You might also - want the "curl" executable for debugging purposes. If you do not - use http:// or https:// repositories, and do not want to put - patches into an IMAP mailbox, you do not have to have them - (use NO_CURL). + the curl version >= 7.34.0, for git-imap-send. + + If you do not use http:// or https:// repositories, and do + not want to put patches into an IMAP mailbox, you do not + have to have them (use NO_CURL). - "expat" library; git-http-push uses it for remote lock management over DAV. Similar to "curl" above, this is optional From patchwork Fri Sep 10 11:04:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12484919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D91DFC433EF for ; Fri, 10 Sep 2021 11:04:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B43B1611BD for ; Fri, 10 Sep 2021 11:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232561AbhIJLFx (ORCPT ); Fri, 10 Sep 2021 07:05:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232513AbhIJLFu (ORCPT ); Fri, 10 Sep 2021 07:05:50 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B756AC061574 for ; Fri, 10 Sep 2021 04:04:39 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id v20-20020a1cf714000000b002e71f4d2026so839509wmh.1 for ; Fri, 10 Sep 2021 04:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3VW+2sa9oywdjcwB84CgGbewQl/O724gubn5nEyVTik=; b=gMPkqQdfhvKHSDq3nonPzcTI3ncZ24Uwz1QXYWD/PFFpOqxIpJuAq7VlahxRKsmRsw d3MESVElEQhOygb8cfiX4Ptro553tbA3kEM7Y7ltzX6OfbP1KfhbAyvvuL7WjAloe5Yj Y9e/IojgvbjJG1uUE/71jh+1RVtJoHlSfLW+BdQ6ma6MqnLSTpe4FgxsRPcTUU1j+kWB 4rHh70FqL14dJhQhM3rLHMS3v1na7KIk6LDY1zRNX7Qegvwl+vA+rDeTBRMwWMFJMgEX SyvIElofvPvsX1x176N/5PDj8t/EhZXLr2zM/q9LtNPKCQnu8SVN9ijL38uLxuiLb8nf 1zRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3VW+2sa9oywdjcwB84CgGbewQl/O724gubn5nEyVTik=; b=Ob4haOpTd45Nnsfvv+e+/JApsRQryi22U2Or/3RL3VwW/W7Afpxht5fmmse2Lqiipc 1WZCU9qnTsgEsG/8YKtyymMU1odOhnKDXGH66WuR3p68Sgc9R4/PsxkzwxYHe72gqxaS LlVu0FxnM5xa46G1dkOgJS/lLUJYOHplOKvwFL/6XWN8+Cxh5d5bP3EMSQdFsJISXdFk +EhDxESp6XsmnGmE1L6Dy6E9gUijcETKYliyfoE6tHRRio+AySzsXoEgvG0cl1KctZD4 QtxT1D4ra1bV/YClXhWgyndM/MWk5Lxg4or1Uc2UdlsRSlVmsM+hubF6KfVnfBY383N0 o9tA== X-Gm-Message-State: AOAM532N3di/9m3PMwyUsUIloIQ62y/wuG+Nhf93HQzl3MT9lmvAu+Y3 v/Qs8WjEvE2HorlSo/fgk9uLylIiBiGECg== X-Google-Smtp-Source: ABdhPJz3ZbdAblGg/zRpsOxWsQH/tAEBO+kD6vHj3DYkh2qfScS+W5uSr88GpLps8YVQKEo+kkuBQA== X-Received: by 2002:a1c:488:: with SMTP id 130mr7593456wme.156.1631271878108; Fri, 10 Sep 2021 04:04:38 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q201sm1013631wme.2.2021.09.10.04.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 04:04:37 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Bagas Sanjaya , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 2/8] INSTALL: mention that we need libcurl 7.19.4 or newer to build Date: Fri, 10 Sep 2021 13:04:27 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.873.g125ff7b9940 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Without NO_CURL=Y we require at least version "7.19.4" of libcurl, see 644de29e220 (http: drop support for curl < 7.19.4, 2021-07-30). Let's document this in the "INSTALL" document. Signed-off-by: Ævar Arnfjörð Bjarmason --- INSTALL | 3 +++ 1 file changed, 3 insertions(+) diff --git a/INSTALL b/INSTALL index 5c6ecf03c27..81f3a6cf018 100644 --- a/INSTALL +++ b/INSTALL @@ -141,6 +141,9 @@ Issues of note: - "libcurl" library is used by git-http-fetch, git-fetch, and, if the curl version >= 7.34.0, for git-imap-send. + Git version "7.19.4" of "libcurl" or later to build. This + version requirement may be bumped in the future. + If you do not use http:// or https:// repositories, and do not want to put patches into an IMAP mailbox, you do not have to have them (use NO_CURL). From patchwork Fri Sep 10 11:04:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12484921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3AF7C433F5 for ; Fri, 10 Sep 2021 11:04:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBEAB611BD for ; Fri, 10 Sep 2021 11:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232576AbhIJLFz (ORCPT ); Fri, 10 Sep 2021 07:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232520AbhIJLFv (ORCPT ); Fri, 10 Sep 2021 07:05:51 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 867CDC061574 for ; Fri, 10 Sep 2021 04:04:40 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id v20-20020a1cf714000000b002e71f4d2026so839527wmh.1 for ; Fri, 10 Sep 2021 04:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5hEbeovRWl39OfC1lzchLvWv9UNpMHWZQ2dp3jGwPf8=; b=RDq3+ne2JUr6ERx4azeyLtC58xNGIIaWBsNq/9F6SnTDz1F1K7C7wzn7Yla0kxRId5 Ds7xWaRelGZvyFopAbevqTo4qgJQ4Y9oFsULp+5G/cqo4R45XtLiq5UkkPmsp6yEzDL9 YHJMdksxVwdtkUSroaS1MARi/va2FyuCs6YD9IPmUiCB6DYHKBm4gyppxSAfxjsSX6Eg s5/Ldnot9axw1dkkFQO49/bkFktafzHRv25YJY+JTiQ4bQwImanMv1HOB41mbLdJn519 peltR8DVcgPPvcCXSnRmopTPT8D75pVYe/g86sfFaStWq1VBr5BBB/EAAtmIef6ZdMXc HQaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5hEbeovRWl39OfC1lzchLvWv9UNpMHWZQ2dp3jGwPf8=; b=74twVRCWlJU4X6soCvgfxpGaLuKyjyJk3X3EHlJ2SnGSeR1vas4SpfWip4efPBjEQz d5N2sHERJqHgjWkCAND2g7m+fxz+i4I1xoSUpkiYI+5iztogJnk2VSiMXRWmpFZCikah dAa9PP/FVblS4ZIpKBBJ1DSO+KqmaADMCG1lOz43CHvjr59TTcq2JBJocqOeWM4JBLZV KLyQfBA+6txEeXNIcxAKI7WF7vKeSHGQvfFFTo1ePGfGNRe9kHuJDCcAWo+E5v82vvC/ PLjWQq9H7mbjFLBQW0r3imUIiDJbTaLD1QAj5RokCp4TiACxUFtKhytFcMdZV9ekbO9Q tTyA== X-Gm-Message-State: AOAM532ahHZYjGcAeA4wntFUBSYfx3Y71EFuI6dAfPE8ZbyJROPJtwJG 0tWJQKgxMk6bEIze1SdhUwF2vOMuxufkpA== X-Google-Smtp-Source: ABdhPJzeoFtjK9+YMBXZ+g3uaePy9PKFwa8FlIR1mPN8+WBGhtd2ED09QEMheodQ7enAk3Nmbph6+Q== X-Received: by 2002:a1c:46:: with SMTP id 67mr7641044wma.29.1631271878790; Fri, 10 Sep 2021 04:04:38 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q201sm1013631wme.2.2021.09.10.04.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 04:04:38 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Bagas Sanjaya , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 3/8] Makefile: drop support for curl < 7.9.8 (again) Date: Fri, 10 Sep 2021 13:04:28 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.873.g125ff7b9940 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In 1119a15b5c8 (http: drop support for curl < 7.11.1, 2021-07-30) support for curl versions older than 7.11.1 was removed, and we currently require at least version 7.19.4, see 644de29e220 (http: drop support for curl < 7.19.4, 2021-07-30). In those changes this Makefile-specific check added in 0890098780f (Decide whether to build http-push in the Makefile, 2005-11-18) was missed, now that we're never going to use such an ancient curl version we don't need to check that we have at least 7.9.8 here. I have no idea what in http-push.c broke on versions older than that. This does not impact "NO_CURL" setups, as this is in the "else" branch after that check. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 429c276058d..378f58b950d 100644 --- a/Makefile +++ b/Makefile @@ -1436,15 +1436,8 @@ else REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES) PROGRAM_OBJS += http-fetch.o PROGRAMS += $(REMOTE_CURL_NAMES) - curl_check := $(shell (echo 070908; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p) - ifeq "$(curl_check)" "070908" - ifndef NO_EXPAT - PROGRAM_OBJS += http-push.o - else - EXCLUDED_PROGRAMS += git-http-push - endif - else - EXCLUDED_PROGRAMS += git-http-push + ifndef NO_EXPAT + PROGRAM_OBJS += http-push.o endif curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p) ifeq "$(curl_check)" "072200" From patchwork Fri Sep 10 11:04:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12484923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BE3BC433F5 for ; Fri, 10 Sep 2021 11:04:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 662906113A for ; Fri, 10 Sep 2021 11:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232590AbhIJLF4 (ORCPT ); Fri, 10 Sep 2021 07:05:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232536AbhIJLFw (ORCPT ); Fri, 10 Sep 2021 07:05:52 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80036C061756 for ; Fri, 10 Sep 2021 04:04:41 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id g74so919157wmg.5 for ; Fri, 10 Sep 2021 04:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7lr+vWLfvlOX6WWabmhoxW4Ecpsa83klZ7DpF/rCf6M=; b=AoY9bPlGSl8o6l607GKKYdBLXA8yhvFm9juIhvPdoBoBCOGBVuCCQ//Q5PBbloPdyi 4qC5IC4CcVfi0q/2KAR7/iSqJlNoJ/30rG449e/zVAfSk61a/fbdiI9w9RB4msCA9WwV dLShiVRkvU/LxexC6UbOdwvh7HuVO+0j0yxI/mClE4DKHyp4KT4VsWo2w9ElH7+QG4bd OcetGPl/0JMYcehRIktowbAyga1UYwu+NBrNzbeX5rY5OhLxLE+PRBGtqNWKBRY0CcJ+ weZfg9d+eB3FsPW79bmTkvykptQccmf2Cm8Bwu+moG2xxH0TfTvUkFbdh8R2IA8xzm+b 7YpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7lr+vWLfvlOX6WWabmhoxW4Ecpsa83klZ7DpF/rCf6M=; b=L0cBCBlJZXkGeB+diPrbbc24qDBUazNPYcS+xc813fWswfhhZCvBjIHB9vep8ynB/f GQPJWweRfRMZ1gA+5FmFLTPmpnTQ0X+ct+RXTAbpU3f2bZRfoDK8zEVtLkk2uGW7x0Fb 0+yvCH8dO4gKPXCqWEvD8uf7i3YauCjJBJ3hxQnMNsVbwpRmxcsaVA5YFcAuAWveLFs5 T+QhbXeZJQJ+rB6HmRFQIvzyPO9dIU1s37GFvpGp7dGRdGh91bejEZHRQPG8YIWN93zV MCdF0MZdOaZLZqT14DaUsDkfcY9UDQwFrCwkEISToJCHW2Su5aVJVE/TgysjOEZC3Dn4 oSZQ== X-Gm-Message-State: AOAM532CI9uCzBRFnvoPlamok7Zo4Wj8lpMv3dUkIa1alBoM4fYbcH/A atlrYtdDeIDmq6KX0s7eWlKDHeZLM6PxjQ== X-Google-Smtp-Source: ABdhPJwF2OzxOIitMUyOhE++fn7SWqPXXceVdvrd0XZkpjOloThXcOPWNl8/vqK1yj/Psfv3vwr8Bg== X-Received: by 2002:a7b:cb8c:: with SMTP id m12mr7568966wmi.77.1631271879855; Fri, 10 Sep 2021 04:04:39 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q201sm1013631wme.2.2021.09.10.04.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 04:04:39 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Bagas Sanjaya , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 4/8] http: drop support for curl < 7.18.0 (again) Date: Fri, 10 Sep 2021 13:04:29 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.873.g125ff7b9940 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In 644de29e220 (http: drop support for curl < 7.19.4, 2021-07-30) we dropped support for curl < 7.19.4, so we can drop support for this non-obvious dependency on curl < 7.18.0. It's non-obvious because in curl's hex version notation 0x071800 is version 7.24.0, *not* 7.18.0, so at a glance this patch looks incorrect. But it's correct, because the existing version check being removed here is wrong. The check guards use of the following curl defines: CURLPROXY_SOCKS4 7.10 CURLPROXY_SOCKS4A 7.18.0 CURLPROXY_SOCKS5 7.10 CURLPROXY_SOCKS5_HOSTNAME 7.18.0 I.e. the oldest version that has these is in fact 7.18.0, not 7.24.0. That we were checking 7.24.0 is just an mistake in 6d7afe07f29 (remote-http(s): support SOCKS proxies, 2015-10-26), i.e. its author confusing base 10 and base 16. Signed-off-by: Ævar Arnfjörð Bjarmason --- http.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/http.c b/http.c index a0f169d2fe5..56856178bfe 100644 --- a/http.c +++ b/http.c @@ -927,7 +927,6 @@ static CURL *get_curl_handle(void) */ curl_easy_setopt(result, CURLOPT_PROXY, ""); } else if (curl_http_proxy) { -#if LIBCURL_VERSION_NUM >= 0x071800 if (starts_with(curl_http_proxy, "socks5h")) curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME); @@ -940,7 +939,6 @@ static CURL *get_curl_handle(void) else if (starts_with(curl_http_proxy, "socks")) curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); -#endif #if LIBCURL_VERSION_NUM >= 0x073400 else if (starts_with(curl_http_proxy, "https")) { curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS); From patchwork Fri Sep 10 11:04:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12484925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9314CC433EF for ; Fri, 10 Sep 2021 11:04:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 762996113A for ; Fri, 10 Sep 2021 11:04:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232600AbhIJLF7 (ORCPT ); Fri, 10 Sep 2021 07:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232537AbhIJLFx (ORCPT ); Fri, 10 Sep 2021 07:05:53 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24B94C061574 for ; Fri, 10 Sep 2021 04:04:42 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id u15-20020a05600c19cf00b002f6445b8f55so1101118wmq.0 for ; Fri, 10 Sep 2021 04:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TXs09l7j+Xu6i1ACeccIVAN33VqATgAcZxCoec5XmSc=; b=nDPpX8Mzxelyh43aykJmejND+y0HmohgXPcH4nOiCmHXcibd4E4Ja76IXxxGOx3dU+ vSLO9UXqIgK9Rped4WIHAg3FhhM5mqUfaoi65o09HAZaHluEaJOcAs73V15TkGufq9UK U2X07cOzuKWnEJ4rqV5fnw1jG7Z1LYfZZ+lo3LBiCB9rFbTcrcmGjGtmHhkjMbcVhDjE TX35ZWE7a27IPtSE2Fk+y7s7nJJEEiLooDP6bXV4XqdW+P11fX96ztFeeT0a0VdoS/Sp 1hLmUPGppRiIiduxs6a3KNwJKnve/skQ6cuZQ19I9SVhG8mOpWPz74gVql+pND5S6B9O ty1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TXs09l7j+Xu6i1ACeccIVAN33VqATgAcZxCoec5XmSc=; b=zcaJxqrioyRPHZpuj4yirrzXdtdE8oTZoewnGUEQgq0MeiM78JVNxY59R+00+wrN+/ WZ0lhLl4vUnJgnTzP+HcSpS+L2a9AEPVSfa/SIWChTJmY+jSloc7vVehG8L9QP/exQf+ 3vhYKuEfucQCdwKAW9sMB22UbIqnUUmA/S/HJq9BJKLc6kQF6q5/05VhKGEcb8gfPlUs OLz5KzYaaNMuIVqQLDuLpyDeMjtZeI35uwpxRJIwzwkO434/3Xk+6P44IALXHJpMFjzw sokVGDIxOiWsqjAn8niO3H2rPpV+vUy+mnHpJVwnerCHScziPv/7u6/1rIYN8q+sooXP dJIA== X-Gm-Message-State: AOAM531fT1PODj0yUv0HSVLgkirbYw50sj2ArN3qBzjw1gWpQZIHTnrE PB29CJ0D+Eq0T8YYlxlserNBKGH8KCyayw== X-Google-Smtp-Source: ABdhPJwDQQ8aXpW9wyYzE7oj7tck1n4gBjya1/4NxLKIyiYLHl8NuVAh9buoAEHsbFvHlNrHdkbi9w== X-Received: by 2002:a05:600c:1c13:: with SMTP id j19mr7886786wms.109.1631271880514; Fri, 10 Sep 2021 04:04:40 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q201sm1013631wme.2.2021.09.10.04.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 04:04:40 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Bagas Sanjaya , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 5/8] http: correct version check for CURL_HTTP_VERSION_2 Date: Fri, 10 Sep 2021 13:04:30 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.873.g125ff7b9940 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In d73019feb44 (http: add support selecting http version, 2018-11-08) a dependency was added on CURL_HTTP_VERSION_2, but this feature was introduced in curl version 7.43.0, not 7.47.0, as the incorrect version check led us to believe. As looking through the history of that commit on the mailing list will reveal[1], the reason for this is that an earlier version of it depended on CURL_HTTP_VERSION_2TLS, which was introduced in libcurl 7.47.0. But the version that made it in in d73019feb44 had dropped the dependency on CURL_HTTP_VERSION_2TLS, but the corresponding version check was not corrected. The newest symbol we depend on is CURL_HTTP_VERSION_2. It was added in 7.33.0, but the CURL_HTTP_VERSION_2 alias we used was added in 7.47.0. So we could support an even older version here, but let's just correct the checked version. 1. https://lore.kernel.org/git/pull.69.git.gitgitgadget@gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason --- http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http.c b/http.c index 56856178bfe..b82b5b7a532 100644 --- a/http.c +++ b/http.c @@ -732,7 +732,7 @@ static long get_curl_allowed_protocols(int from_user) return allowed_protocols; } -#if LIBCURL_VERSION_NUM >=0x072f00 +#if LIBCURL_VERSION_NUM >=0x072b00 static int get_curl_http_version_opt(const char *version_string, long *opt) { int i; @@ -774,7 +774,7 @@ static CURL *get_curl_handle(void) curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2); } -#if LIBCURL_VERSION_NUM >= 0x072f00 // 7.47.0 +#if LIBCURL_VERSION_NUM >= 0x072b00 if (curl_http_version) { long opt; if (!get_curl_http_version_opt(curl_http_version, &opt)) { From patchwork Fri Sep 10 11:04:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12484927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F433C433FE for ; Fri, 10 Sep 2021 11:04:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D9D7611B0 for ; Fri, 10 Sep 2021 11:04:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232609AbhIJLGA (ORCPT ); Fri, 10 Sep 2021 07:06:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232563AbhIJLFx (ORCPT ); Fri, 10 Sep 2021 07:05:53 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2FAAC061574 for ; Fri, 10 Sep 2021 04:04:42 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id s24so921029wmh.4 for ; Fri, 10 Sep 2021 04:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R0MfkI47ZKJnsiLXFRP0qdKwbb8lMPMQJbi8RFlxmIE=; b=dsEYgEeoSgRQe9l7kOd2EjhuJqdUsJ/RRGMWDTD0Do+AgIZxMWMcgZCAF8eXJVh7hS Cy+NuKRXYMJzTIYPWsghLLZ2LFZIwcyIaGIflUsAnIBSCw6FJZ6WnwQOpJLTLpIZrfGq Q1YllJ6vbJt8ARRti+Y4/lntzcOlpXI3LbGWYkkBck1UqjIs5Zu4/Nx13G3xi/cf81oV j+mVWGcxrvZmxS6djsjBaDqa1rczfIzXk/i1fzfbhEBaR2oVm/+cfqJMP/xH+A46yib7 pJGGID2ybBTIIZOr+PlNvVbsHUyCna6JDfxX/7yAoPUoyVbgt1Y5f4uEvDM3BuXv7O7H h6Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R0MfkI47ZKJnsiLXFRP0qdKwbb8lMPMQJbi8RFlxmIE=; b=59SjSqSAp1FImM4NvRW5d/zrGI/r6SACgy7Hv5yx2k0nhSCyhOeRKzFVfq+ZZNA0// Dzx6ChjblyMwYZX7aSVAed5fVOcIMyJENNv8RHVFiM0ce+Uu/U/5x+9q8cE2K/FwNk1f gRbzdOu3+vNpUQBihqrmwXZP/3T/vFJdU92L4uO/jFcpKrxKduxv2C0iQf35348IcqOU ZljpbzCTmuHVveNFoPTyP9ZwCBBsjloAQvOMPTFQSIo9wCG0pKihqY7rlLRlyNMUbhsD sUbXJV9+VOIAwV1RRyevjVZOaW52AD7D1tX6ntRz1hrBXaTU7AWXD6EzKylERAjCIuoy fJrg== X-Gm-Message-State: AOAM531YrHWUGFjboxKgyIbSrsJysSgchuuzejhXfFdu8iqgVl13Tq06 FDZHpLX2LvRGwIJogBc0y0q4oZ5wkH9xOQ== X-Google-Smtp-Source: ABdhPJyLEYu1hAtzJYRWif30QHJOin+UuB3WdpopP+E/96E8El5GqwnaUBfnRUTy1DkhVwuj6JCPQQ== X-Received: by 2002:a1c:1b17:: with SMTP id b23mr7644757wmb.139.1631271881317; Fri, 10 Sep 2021 04:04:41 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q201sm1013631wme.2.2021.09.10.04.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 04:04:40 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Bagas Sanjaya , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 6/8] http: correct curl version check for CURLOPT_PINNEDPUBLICKEY Date: Fri, 10 Sep 2021 13:04:31 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.873.g125ff7b9940 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In aeff8a61216 (http: implement public key pinning, 2016-02-15) a dependency and warning() was added if curl older than 7.44.0 was used, but the relevant code depended on CURLOPT_PINNEDPUBLICKEY, introduced in 7.39.0. Signed-off-by: Ævar Arnfjörð Bjarmason --- http.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/http.c b/http.c index b82b5b7a532..543faad9879 100644 --- a/http.c +++ b/http.c @@ -59,7 +59,7 @@ static struct { static const char *ssl_key; static const char *ssl_capath; static const char *curl_no_proxy; -#if LIBCURL_VERSION_NUM >= 0x072c00 +#if LIBCURL_VERSION_NUM >= 0x072700 static const char *ssl_pinnedkey; #endif static const char *ssl_cainfo; @@ -373,10 +373,10 @@ static int http_options(const char *var, const char *value, void *cb) } if (!strcmp("http.pinnedpubkey", var)) { -#if LIBCURL_VERSION_NUM >= 0x072c00 +#if LIBCURL_VERSION_NUM >= 0x072700 return git_config_pathname(&ssl_pinnedkey, var, value); #else - warning(_("Public key pinning not supported with cURL < 7.44.0")); + warning(_("Public key pinning not supported with cURL < 7.39.0")); return 0; #endif } @@ -845,7 +845,7 @@ static CURL *get_curl_handle(void) curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key); if (ssl_capath != NULL) curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath); -#if LIBCURL_VERSION_NUM >= 0x072c00 +#if LIBCURL_VERSION_NUM >= 0x072700 if (ssl_pinnedkey != NULL) curl_easy_setopt(result, CURLOPT_PINNEDPUBLICKEY, ssl_pinnedkey); #endif From patchwork Fri Sep 10 11:04:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12484929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C9F2C433F5 for ; Fri, 10 Sep 2021 11:04:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 630B4611AD for ; Fri, 10 Sep 2021 11:04:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232616AbhIJLGB (ORCPT ); Fri, 10 Sep 2021 07:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232566AbhIJLFz (ORCPT ); Fri, 10 Sep 2021 07:05:55 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09680C061756 for ; Fri, 10 Sep 2021 04:04:44 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id u15-20020a05600c19cf00b002f6445b8f55so1101186wmq.0 for ; Fri, 10 Sep 2021 04:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OHv/l0mLONrlVjqYS7F7Hd9WkfFZyayikfxum6h4ez8=; b=VOO+4NNBK0/EK7uvnrJDE295t1HbI1+u3Vf/uss69bP3p/wbQ5geckDG7DoOFWOLin 4dsCkh0OU78hR91tRV8gGCcZccsRj1HaTiT3w7gOgisMLMnIcE9FpijZ4wAJ+Td3R7Vg KKefLPi3f/PO/Qeut3vLi+EHvF2WyqS5ThOWoSnQMvwVMseMpVUQBmWHj35Tj4KIAVJO K299NB/WKuOYCzvz0YVuWQlTfa9ZLI8LBtcfh1++YSO/giyksgNusQEtz41kEga/aRwy PIogm2gkCAon4LRyXMQ7Uzeeqpat8zQaSZSuUFSyIvATIncWV7Lg2AdC5eDoSFSdsaR9 apuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OHv/l0mLONrlVjqYS7F7Hd9WkfFZyayikfxum6h4ez8=; b=JGNSa2WYjLLuB76c17CZkisYRC0li0af7tBGDPBaI0LT13N6PhissFhTI6iLZEpscj PedH350xzk+Qn/S1G/3OxAOecRpBezTUbjioQkMBqWnqwPfmuwkBTicDDtyiKYdns1YJ pl8TtG8BdKL9tBXrYsRwr7a7xIWKM+yS09JACojIvGED+JiMHbeMAD/103T2rfcA2FEd 4N3wMiVxjvE6FJOP1DCUzWKt3k7VbOyBhVKvlDBKNNvUd6UQUkF3arHAEnV7PxqmEtgH 2glKm7lYcNwckq2MCbrqgU7y+9/KKGbVd+gtkoi+1lkdri0LaKq+6OITXcpdFkJb+2LE BO1w== X-Gm-Message-State: AOAM533iJh4UYUR68AqcMRMzps2pw3LCvvcHdaNo3tKV9CDBY8y7jY5A xwfYrZO0agNOerLu5S00nqWFMns/CENQ6Q== X-Google-Smtp-Source: ABdhPJwC2nJdvHG8lpKtk3sytgRuJ7WyGmgOyZ4ExDvmk18yDoNpavO1oL4bP7cMZKKKOsb0TMP5gg== X-Received: by 2002:a05:600c:22ca:: with SMTP id 10mr7706058wmg.170.1631271882248; Fri, 10 Sep 2021 04:04:42 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q201sm1013631wme.2.2021.09.10.04.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 04:04:41 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Bagas Sanjaya , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 7/8] http: centralize the accounting of libcurl dependencies Date: Fri, 10 Sep 2021 13:04:32 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.873.g125ff7b9940 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org As discussed in 644de29e220 (http: drop support for curl < 7.19.4, 2021-07-30) checking against LIBCURL_VERSION_NUM isn't as reliable as checking specific symbols present in curl, as some distros have been known to backport features. However, while some of the curl_easy_setopt() arguments we rely on are macros, others are enum, and we can't assume that those that are macros won't change into enums in the future. So we're still going to have to check LIBCURL_VERSION_NUM, but by doing that in one central place and using a macro definition of our own, anyone who's backporting features can define it themselves, and thus have access to more modern curl features that they backported, even if they didn't bump the LIBCURL_VERSION_NUM. More importantly, as shown in a preceding commit doing these version checks makes for hard to read and possibly buggy code, as shown by the bug fixed there where we were conflating base 10 for base 16 when comparing the version. By doing them all in one place we'll hopefully reduce the chances of such future mistakes, furthermore it now becomes easier to see at a glance what the oldest supported version is, which makes it easier to reason about any future deprecation similar to the recent e48a623dea0 (Merge branch 'ab/http-drop-old-curl', 2021-08-24). Signed-off-by: Ævar Arnfjörð Bjarmason --- git-curl-compat.h | 117 ++++++++++++++++++++++++++++++++++++++++++++++ http.c | 29 ++++++------ imap-send.c | 2 +- 3 files changed, 133 insertions(+), 15 deletions(-) create mode 100644 git-curl-compat.h diff --git a/git-curl-compat.h b/git-curl-compat.h new file mode 100644 index 00000000000..7ad87e89ed5 --- /dev/null +++ b/git-curl-compat.h @@ -0,0 +1,117 @@ +#ifndef GIT_CURL_COMPAT_H +#define GIT_CURL_COMPAT_H +#include + +/** + * This header centralizes the declaration of our libcurl dependencies + * to make it easy to discover the oldest versions we support, and to + * inform decisions about removing support for older libcurl in the + * future. + * + * The oldest supported version of curl is documented in the "INSTALL" + * document. + * + * The source of truth for what versions have which symbols is + * https://github.com/curl/curl/blob/master/docs/libcurl/symbols-in-versions; + * the release dates are taken from curl.git (at + * https://github.com/curl/curl/). + * + * For each X symbol we need from curl we define our own + * GIT_CURL_HAVE_X. If multiple similar symbols with the same prefix + * were defined in the same version we pick one and check for that name. + * + * Keep any symbols in date order of when their support was + * introduced, oldest first, in the official version of cURL library. + */ + +/** + * CURLOPT_TCP_KEEPALIVE was added in 7.25.0, released in March 2012. + */ +#if LIBCURL_VERSION_NUM >= 0x071900 +#define GITCURL_HAVE_CURLOPT_TCP_KEEPALIVE 1 +#endif + + +/** + * CURLOPT_LOGIN_OPTIONS was added in 7.34.0, released in December + * 2013. + * + * If we start requiring 7.34.0 we might also be able to remove the + * code conditional on USE_CURL_FOR_IMAP_SEND in imap-send.c, see + * 1e16b255b95 (git-imap-send: use libcurl for implementation, + * 2014-11-09) and the check it added for "072200" in the Makefile. + + */ +#if LIBCURL_VERSION_NUM >= 0x072200 +#define GIT_CURL_HAVE_CURLOPT_LOGIN_OPTIONS 1 +#endif + +/** + * CURL_SSLVERSION_TLSv1_[012] was added in 7.34.0, released in + * December 2013. + */ +#if LIBCURL_VERSION_NUM >= 0x072200 +#define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0 +#endif + +/** + * CURLOPT_PINNEDPUBLICKEY was added in 7.39.0, released in November + * 2014. + */ +#if LIBCURL_VERSION_NUM >= 0x072c00 +#define GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY 1 +#endif + +/** + * CURL_HTTP_VERSION_2 was added in 7.43.0, released in June 2015. + * + * The CURL_HTTP_VERSION_2 alias (but not CURL_HTTP_VERSION_2_0) has + * always been a macro, not an enum field (checked on curl version + * 7.78.0) + */ +#if LIBCURL_VERSION_NUM >= 0x072b00 +#define GIT_CURL_HAVE_CURL_HTTP_VERSION_2 1 +#endif + +/** + * CURLSSLOPT_NO_REVOKE was added in 7.44.0, released in August 2015. + * + * The CURLSSLOPT_NO_REVOKE is, has always been a macro, not an enum + * field (checked on curl version 7.78.0) + */ +#if LIBCURL_VERSION_NUM >= 0x072c00 +#define GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE 1 +#endif + +/** + * CURLOPT_PROXY_CAINFO was added in 7.52.0, released in August 2017. + */ +#if LIBCURL_VERSION_NUM >= 0x073400 +#define GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO 1 +#endif + +/** + * CURLOPT_PROXY_{KEYPASSWD,SSLCERT,SSLKEY} was added in 7.52.0, + * released in August 2017. + */ +#if LIBCURL_VERSION_NUM >= 0x073400 +#define GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD 1 +#endif + +/** + * CURL_SSLVERSION_TLSv1_3 was added in 7.53.0, released in February + * 2017. + */ +#if LIBCURL_VERSION_NUM >= 0x073400 +#define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_3 1 +#endif + +/** + * CURLSSLSET_{NO_BACKENDS,OK,TOO_LATE,UNKNOWN_BACKEND} were added in + * 7.56.0, released in September 2017. + */ +#if LIBCURL_VERSION_NUM >= 0x073800 +#define GIT_CURL_HAVE_CURLSSLSET_NO_BACKENDS +#endif + +#endif diff --git a/http.c b/http.c index 543faad9879..94eefe97089 100644 --- a/http.c +++ b/http.c @@ -1,4 +1,5 @@ #include "git-compat-util.h" +#include "git-curl-compat.h" #include "http.h" #include "config.h" #include "pack.h" @@ -47,19 +48,19 @@ static struct { { "sslv2", CURL_SSLVERSION_SSLv2 }, { "sslv3", CURL_SSLVERSION_SSLv3 }, { "tlsv1", CURL_SSLVERSION_TLSv1 }, -#if LIBCURL_VERSION_NUM >= 0x072200 +#ifdef GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0 { "tlsv1.0", CURL_SSLVERSION_TLSv1_0 }, { "tlsv1.1", CURL_SSLVERSION_TLSv1_1 }, { "tlsv1.2", CURL_SSLVERSION_TLSv1_2 }, #endif -#if LIBCURL_VERSION_NUM >= 0x073400 +#ifdef GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_3 { "tlsv1.3", CURL_SSLVERSION_TLSv1_3 }, #endif }; static const char *ssl_key; static const char *ssl_capath; static const char *curl_no_proxy; -#if LIBCURL_VERSION_NUM >= 0x072700 +#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY static const char *ssl_pinnedkey; #endif static const char *ssl_cainfo; @@ -373,7 +374,7 @@ static int http_options(const char *var, const char *value, void *cb) } if (!strcmp("http.pinnedpubkey", var)) { -#if LIBCURL_VERSION_NUM >= 0x072700 +#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY return git_config_pathname(&ssl_pinnedkey, var, value); #else warning(_("Public key pinning not supported with cURL < 7.39.0")); @@ -500,7 +501,7 @@ static int has_cert_password(void) return 1; } -#if LIBCURL_VERSION_NUM >= 0x073400 +#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD static int has_proxy_cert_password(void) { if (http_proxy_ssl_cert == NULL || proxy_ssl_cert_password_required != 1) @@ -516,7 +517,7 @@ static int has_proxy_cert_password(void) } #endif -#if LIBCURL_VERSION_NUM >= 0x071900 +#ifdef GITCURL_HAVE_CURLOPT_TCP_KEEPALIVE static void set_curl_keepalive(CURL *c) { curl_easy_setopt(c, CURLOPT_TCP_KEEPALIVE, 1); @@ -732,7 +733,7 @@ static long get_curl_allowed_protocols(int from_user) return allowed_protocols; } -#if LIBCURL_VERSION_NUM >=0x072b00 +#ifdef GIT_CURL_HAVE_CURL_HTTP_VERSION_2 static int get_curl_http_version_opt(const char *version_string, long *opt) { int i; @@ -774,7 +775,7 @@ static CURL *get_curl_handle(void) curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2); } -#if LIBCURL_VERSION_NUM >= 0x072b00 +#ifdef GIT_CURL_HAVE_CURL_HTTP_VERSION_2 if (curl_http_version) { long opt; if (!get_curl_http_version_opt(curl_http_version, &opt)) { @@ -805,7 +806,7 @@ static CURL *get_curl_handle(void) if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) && !http_schannel_check_revoke) { -#if LIBCURL_VERSION_NUM >= 0x072c00 +#ifdef GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE); #else warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0")); @@ -845,20 +846,20 @@ static CURL *get_curl_handle(void) curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key); if (ssl_capath != NULL) curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath); -#if LIBCURL_VERSION_NUM >= 0x072700 +#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY if (ssl_pinnedkey != NULL) curl_easy_setopt(result, CURLOPT_PINNEDPUBLICKEY, ssl_pinnedkey); #endif if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) && !http_schannel_use_ssl_cainfo) { curl_easy_setopt(result, CURLOPT_CAINFO, NULL); -#if LIBCURL_VERSION_NUM >= 0x073400 +#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO curl_easy_setopt(result, CURLOPT_PROXY_CAINFO, NULL); #endif } else if (ssl_cainfo != NULL || http_proxy_ssl_ca_info != NULL) { if (ssl_cainfo != NULL) curl_easy_setopt(result, CURLOPT_CAINFO, ssl_cainfo); -#if LIBCURL_VERSION_NUM >= 0x073400 +#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO if (http_proxy_ssl_ca_info != NULL) curl_easy_setopt(result, CURLOPT_PROXY_CAINFO, http_proxy_ssl_ca_info); #endif @@ -939,7 +940,7 @@ static CURL *get_curl_handle(void) else if (starts_with(curl_http_proxy, "socks")) curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); -#if LIBCURL_VERSION_NUM >= 0x073400 +#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD else if (starts_with(curl_http_proxy, "https")) { curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS); @@ -1004,7 +1005,7 @@ void http_init(struct remote *remote, const char *url, int proactive_auth) free(normalized_url); string_list_clear(&config.vars, 1); -#if LIBCURL_VERSION_NUM >= 0x073800 +#ifdef GIT_CURL_HAVE_CURLSSLSET_NO_BACKENDS if (http_ssl_backend) { const curl_ssl_backend **backends; struct strbuf buf = STRBUF_INIT; diff --git a/imap-send.c b/imap-send.c index 49a5f8aa597..e6090a0346a 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1441,7 +1441,7 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred) curl_easy_setopt(curl, CURLOPT_PORT, server.port); if (server.auth_method) { -#if LIBCURL_VERSION_NUM < 0x072200 +#ifndef GIT_CURL_HAVE_CURLOPT_LOGIN_OPTIONS warning("No LOGIN_OPTIONS support in this cURL version"); #else struct strbuf auth = STRBUF_INIT; From patchwork Fri Sep 10 11:04:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12484931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34E90C433FE for ; Fri, 10 Sep 2021 11:04:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14F07611B0 for ; Fri, 10 Sep 2021 11:04:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232625AbhIJLGD (ORCPT ); Fri, 10 Sep 2021 07:06:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232582AbhIJLFz (ORCPT ); Fri, 10 Sep 2021 07:05:55 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E60A9C061760 for ; Fri, 10 Sep 2021 04:04:44 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id b6so2025315wrh.10 for ; Fri, 10 Sep 2021 04:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gdyHaiS7NgAAponwRzaB9fFkyNFfvagqnezXwI73qHs=; b=ptcuEQClND5eizv6H46jcpGGe+aJk7amw+8QLmYSoIjSuWZKeywPrPaRtVbji81MLt uYDODl1ZarJVIdN0kTLy7wFjgOQhOA78KP7cny2spUzvnfAwLJjpIYr8a6nbrp7SDC+6 wqHQcorwmv+jnV4+62xBK8LMiYEPK0CCDGMS6Rco0kidLmuklWYF232PONlUCMgczZIb I6qlQmPbh4nokSoqz3MTPWj9/R4HBLKrBI3gLFqPaGRUhOiR+0Iox8ggfRRUSwDLWcXb gm2U0hj3G5pESfmZvLTT4rx1Wfdptl7sIfxOkJNgWebI7kdyS2SRcDJg4YWjK62WK0fC W85A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gdyHaiS7NgAAponwRzaB9fFkyNFfvagqnezXwI73qHs=; b=lZQbYnA/FVVwp1WNmI9OcfmMVXS8hRqQ9bdEyWalgNYZf8lmg8GVqU1mO1dFtg808r q9vUvwKzQ8ZD8OMg1gpFssKG00d+x4rOhiM4OXyKdjwbSOpnjcnGW4ioS7pIRkGOqckr gVhZqBd/d1NfPYjt7KLUdVdyTbBJzWkZzOda2h9t72r5vmEG/6kxqp/1OgzJP8p1jUJ0 OI+RVV15XgC1/CmxDYWKfqPh20WK+gCSWMnYpE8B5Nt4GKzFRE2K+3d7oNKJHk18m4W0 ZW3wrafsI9fbP07EJJw160+GE+mwknHGT4YmqBTC+1zVtU1kYXSP/mReOcZmOA3pCmRR ze/A== X-Gm-Message-State: AOAM533yA5PUwj2tAa+iZlU895Il1kOWpuHuMUOz1TaEi23o+rTgYTvo l+Z9a6QQi7QwohS1cxZV8VbfljszrTZvRQ== X-Google-Smtp-Source: ABdhPJwshtKq7s/94eEFdE5cU8/KUUFu+FbP5+cATtsA45du7QlvYAA6wTGFhpl8gvG4I8/YWq5heA== X-Received: by 2002:adf:eb4f:: with SMTP id u15mr6226138wrn.352.1631271883309; Fri, 10 Sep 2021 04:04:43 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q201sm1013631wme.2.2021.09.10.04.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 04:04:42 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , "brian m . carlson" , Bagas Sanjaya , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v2 8/8] http: don't hardcode the value of CURL_SOCKOPT_OK Date: Fri, 10 Sep 2021 13:04:33 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.873.g125ff7b9940 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Use the new git-curl-compat.h header to define CURL_SOCKOPT_OK to its known value if we're on an older curl version that doesn't have it. It was hardcoded in http.c in a15d069a198 (http: enable keepalive on TCP sockets, 2013-10-12). Signed-off-by: Ævar Arnfjörð Bjarmason --- git-curl-compat.h | 16 ++++++++++++++++ http.c | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/git-curl-compat.h b/git-curl-compat.h index 7ad87e89ed5..3d162730aaf 100644 --- a/git-curl-compat.h +++ b/git-curl-compat.h @@ -20,10 +20,26 @@ * GIT_CURL_HAVE_X. If multiple similar symbols with the same prefix * were defined in the same version we pick one and check for that name. * + * We may also define a missing CURL_* symbol to its known value, if + * doing so is sufficient to add support for it to older versions that + * don't have it. + * * Keep any symbols in date order of when their support was * introduced, oldest first, in the official version of cURL library. */ +/** + * CURL_SOCKOPT_OK was added in 7.21.5, released in April 2011. + * + * This should be safe as CURL_SOCKOPT_OK has always been a macro, not + * an enum field (checked on curl version 7.78.0, released on July 19, + * 2021). Even if that were to change the value of "0" for "OK" is + * unlikely to change. + */ +#ifndef CURL_SOCKOPT_OK +#define CURL_SOCKOPT_OK 0 +#endif + /** * CURLOPT_TCP_KEEPALIVE was added in 7.25.0, released in March 2012. */ diff --git a/http.c b/http.c index 94eefe97089..d7c20493d7f 100644 --- a/http.c +++ b/http.c @@ -537,7 +537,7 @@ static int sockopt_callback(void *client, curl_socket_t fd, curlsocktype type) if (rc < 0) warning_errno("unable to set SO_KEEPALIVE on socket"); - return 0; /* CURL_SOCKOPT_OK only exists since curl 7.21.5 */ + return CURL_SOCKOPT_OK; } static void set_curl_keepalive(CURL *c)