git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH] http: support building on RHEL6
Date: Fri, 01 Jul 2022 16:24:06 +0000	[thread overview]
Message-ID: <pull.1277.git.1656692646303.gitgitgadget@gmail.com> (raw)

From: Johannes Schindelin <johannes.schindelin@gmx.de>

There was a bug report attached to the copy of 511cfd3bffa (http: add
custom hostname to IP address resolutions, 2022-05-16) in the `git/git`
repository on GitHub, claiming that that commit broke the build on
RedHat Enterprise Linux 6. The most likely explanation is that the
available cURL version does not support the `CURLOPT_RESOLVE` feature.

Let's work around this by warning the user if they configure
`http.curloptResolve` if compiled against a too-old cURL version.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    http: support building on RHEL6
    
    This came in via the awkward venue of a commit comment at
    https://github.com/git/git/commit/511cfd3bffa685fda0e7c25bfa08082aa0de3a30#commitcomment-77360864.
    
    I looked here [https://curl.se/libcurl/c/CURLOPT_RESOLVE.html] to find
    out since when cURL supports CURLOPT_RESOLVE.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1277%2Fdscho%2Fcurlopt_resolve-in-rhel6-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1277/dscho/curlopt_resolve-in-rhel6-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1277

 git-curl-compat.h | 7 +++++++
 http.c            | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/git-curl-compat.h b/git-curl-compat.h
index 56a83b6bbd8..80315e731d7 100644
--- a/git-curl-compat.h
+++ b/git-curl-compat.h
@@ -28,6 +28,13 @@
  * introduced, oldest first, in the official version of cURL library.
  */
 
+/**
+ ** CURLOPT_RESOLVE was added in 7.21.3, released in December 2010.
+ */
+#if LIBCURL_VERSION_NUM >= 0x071503
+#define GIT_CURL_HAVE_CURLOPT_RESOLVE 1
+#endif
+
 /**
  * CURL_SOCKOPT_OK was added in 7.21.5, released in April 2011.
  */
diff --git a/http.c b/http.c
index 168ca30c558..4c7a2311ec8 100644
--- a/http.c
+++ b/http.c
@@ -1228,7 +1228,12 @@ struct active_request_slot *get_active_slot(void)
 	if (curl_save_cookies)
 		curl_easy_setopt(slot->curl, CURLOPT_COOKIEJAR, curl_cookie_file);
 	curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, pragma_header);
+#ifdef GIT_CURL_HAVE_CURLOPT_RESOLVE
 	curl_easy_setopt(slot->curl, CURLOPT_RESOLVE, host_resolutions);
+#else
+	if (host_resolutions)
+		warning(_("lacking support for `http.curloptResolve`"));
+#endif
 	curl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, curl_errorstr);
 	curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, NULL);
 	curl_easy_setopt(slot->curl, CURLOPT_READFUNCTION, NULL);

base-commit: e4a4b31577c7419497ac30cebe30d755b97752c5
-- 
gitgitgadget

             reply	other threads:[~2022-07-01 16:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 16:24 Johannes Schindelin via GitGitGadget [this message]
2022-07-01 16:44 ` [PATCH] http: support building on RHEL6 brian m. carlson
2022-07-01 21:32   ` Junio C Hamano
2022-07-01 21:48     ` Junio C Hamano
2022-07-04  7:38       ` Ævar Arnfjörð Bjarmason
2022-07-05 17:46         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1277.git.1656692646303.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).