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

Re: [PATCH v3 2/4] http: try http_proxy env var when http.proxy config option is not set

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 5, 2012, 17:30 UTC
Message-ID
<7v4nu32bwp.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4F54D91C.6080905@seap.minhap.es>
Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es> writes:
Show 9 quoted lines
> cURL already reads it, but if $http_proxy has username but no password
> cURL will not ask you for the password and so failed to authenticate
> returning a 407 error code. So we read it ourselves to detect that and
> ask for the password. Also we read it prior to connection to be able to
> make a proactive authentication in case the flag http_proactive_auth is
> set.
>
> Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>
> ---

The above does not address my earlier worries about compatibility across curl applications (it does not even say "it does not matter; we do not care about other's application"), so let's spell it out again. When the user has

	http_proxy=http://me@proxy.example.com
	export http_proxy

with your patch, git might do whatever we desire to do, and the end result may be better, but how would the user experience be for the user when using other curl based programs on the same system?

Also I thought the conclusion from the other thread was that even if we were to do this, we should apply the http_proxy environment only when we are talking to http:// and for https:// we would instead read HTTPS_PROXY or something?

Show 21 quoted lines
>  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);
Previous: Nelson Benitez LeonNext: Nelson Benitez Leon
Message 2 of 6 in “http: try http_proxy env var when http.proxy config option is not set”
  1. 2/4 http: try http_proxy env var when http.proxy config option is not setNelson Benitez Leon, Mar 5, 2012
  2. Junio C HamanoMar 5, 2012
  3. Nelson Benitez LeonMar 6, 2012
  4. Jeff KingMar 6, 2012
  5. Nelson Benitez LeonMar 6, 2012
  6. Junio C HamanoMar 6, 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.