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

[PATCH 1/2] Conditional use of CURLOPT_PROXYHEADER based on libcurl version

From
Alejandro R. Sedeño <asedeno@mit.edu>
Date
Oct 14, 2024, 13:13 UTC
Message-ID
<20241014131346.3556163-2-asedeno@mit.edu>
In-Reply-To
<20241014131346.3556163-1-asedeno@mit.edu>
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Signed-off-by: Alejandro R. Sedeño <asedeno@google.com>
---
 git-curl-compat.h | 7 +++++++
 http.c            | 4 ++++
 2 files changed, 11 insertions(+)
diff --git a/git-curl-compat.h b/git-curl-compat.h
index e1d0bdd273..08ae73e0f1 100644
--- a/git-curl-compat.h
+++ b/git-curl-compat.h
@@ -65,6 +65,13 @@
 #define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0
 #endif
 
+/**
+ * CURLOPT_PROXYHEADER was added in 7.37.0, released in May 2014.
+ */
+#if LIBCURL_VERSION_NUM >= 0x072500
+#define GIT_CURL_HAVE_CURLOPT_PROXYHEADER
+#endif
+
 /**
  * CURLOPT_PINNEDPUBLICKEY was added in 7.39.0, released in November
  * 2014. CURLE_SSL_PINNEDPUBKEYNOTMATCH was added in that same version.
diff --git a/http.c b/http.c
index d59e59f66b..30d5e4c67b 100644
--- a/http.c
+++ b/http.c
@@ -652,8 +652,12 @@ static void set_proxyauth_name_password(CURL *result)
 		curl_easy_setopt(result, CURLOPT_PROXYPASSWORD,
 			proxy_auth.password);
 	} else if (proxy_auth.authtype && proxy_auth.credential) {
+#ifdef GIT_CURL_HAVE_CURLOPT_PROXYHEADER
 		curl_easy_setopt(result, CURLOPT_PROXYHEADER,
 				 http_append_auth_header(&proxy_auth, NULL));
+#else
+		warning(_("CURLOPT_PROXYHEADER not supported with cURL < 7.37.0"));
+#endif
 	}
 }
 
-- 
2.39.5
Previous: Alejandro R. SedeñoNext: Alejandro R. Sedeño
Message 2 of 10 in “Restore support for older libcurl and fix some typos”
  1. 0/2 Restore support for older libcurl and fix some typosAlejandro R. Sedeño, Oct 14, 2024
  2. 1/2 Conditional use of CURLOPT_PROXYHEADER based on libcurl versionAlejandro R. Sedeño, Oct 14, 2024
  3. 2/2 Fix inconsistencies in git-curl-compat.hAlejandro R. Sedeño, Oct 14, 2024
  4. Taylor BlauOct 15, 2024
  5. Alejandro R. SedeñoOct 15, 2024
  6. Eric SunshineOct 15, 2024
  7. Taylor BlauOct 15, 2024
  8. Torsten BögershausenOct 17, 2024
  9. Oswald BuddenhagenOct 17, 2024
  10. Torsten BögershausenOct 17, 2024

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.