git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] http: support building on RHEL6
@ 2022-07-01 16:24 Johannes Schindelin via GitGitGadget
  2022-07-01 16:44 ` brian m. carlson
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2022-07-01 16:24 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-05 17:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-01 16:24 [PATCH] http: support building on RHEL6 Johannes Schindelin via GitGitGadget
2022-07-01 16:44 ` 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

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 NNTP newsgroup(s).