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

[PATCH v2 2/3] http: try http_proxy env var when http.proxy config option is not set

From
NLNelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es>
Date
Mar 1, 2012, 18:21 UTC
Message-ID
<4F4FBE0F.6020004@seap.minhap.es>

CuRL already reads it, but if $http_proxy has username but no password curl will not ask you for the password.. so we read it ourselves to detect that and ask for the password.

Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>
---
 http.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/http.c b/http.c
index 8ac8eb6..8932da5 100644
--- a/http.c
+++ b/http.c
@@ -295,6 +295,13 @@ static CURL *get_curl_handle(void)
 	if (curl_ftp_no_epsv)
 		curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);

+	if (!curl_http_proxy) {
+		const char *env_proxy;
+		env_proxy = getenv("http_proxy");
+		if (env_proxy) {
+			curl_http_proxy = xstrdup(env_proxy);
+		}
+	}
 	if (curl_http_proxy) {
 		curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);
 		curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
-- 
1.7.7.6
Next: Sam Vilain
Message 1 of 6 in “http: try http_proxy env var when http.proxy config option is not set”
  1. 2/3 http: try http_proxy env var when http.proxy config option is not setNelson Benitez Leon, Mar 1, 2012
  2. Sam VilainMar 1, 2012
  3. Junio C HamanoMar 1, 2012
  4. Junio C HamanoMar 1, 2012
  5. Jeff KingMar 1, 2012
  6. Junio C HamanoMar 1, 2012

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.