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

[PATCH] http: support building on RHEL6

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 1, 2022, 16:24 UTC
Message-ID
<pull.1277.git.1656692646303.gitgitgadget@gmail.com>
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
Next: brian m. carlson
Message 1 of 6 in “http: support building on RHEL6”
  1. http: support building on RHEL6Johannes Schindelin via GitGitGadget, Jul 1, 2022
  2. brian m. carlsonJul 1, 2022
  3. Junio C HamanoJul 1, 2022
  4. Junio C HamanoJul 1, 2022
  5. Ævar Arnfjörð BjarmasonJul 4, 2022
  6. Junio C HamanoJul 5, 2022

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.