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

Re: [PATCH 2/3] http: try standard proxy env vars when http.proxy config option is not set

From
NLNelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es>
Date
Feb 28, 2012, 14:57 UTC
Message-ID
<4F4CEB5D.5020808@seap.minhap.es>
In-Reply-To
<878vjn8823.fsf@thomas.inf.ethz.ch>
On 02/28/2012 01:19 PM, Thomas Rast wrote:
Show 26 quoted lines
> Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es> writes:
> 
>> +	if (!curl_http_proxy) {
>> +		const char *env_proxy;
>> +		env_proxy = getenv("HTTP_PROXY");
>> +		if (!env_proxy) {
>> +			env_proxy = getenv("http_proxy");
>> +		}
>> +		if (env_proxy) {
>> +			curl_http_proxy = xstrdup(env_proxy);
>> +		}
>> +	}
> 
> Admittedly I'm mostly clueless about curl, but while investigating the
> NTLM login thing I noticed this bit in curl(1):
> 
> ENVIRONMENT
>        The environment variables can be specified in lower case or upper
>        case. The lower case version has precedence. http_proxy is an
>        exception as it is only available in lower case.
> 
> Which raises the questions:
> 
> * Why is this needed?  Does git's use of libcurl ignore http_proxy?  [1]
>   seems to indicate that libcurl respects <protocol>_proxy
>   automatically.

It could not be needed, because, as you noted, curl already reads it, but then we will loose the feature on patch [3/3] because if $http_proxy has username but no password curl will not ask you for the password.. instead if we read it we could detect that, and ask for the password.

As a minor note if we let curl to read it then patch [1/1] has to be changed to include CURLOPT_PROXYAUTH unconditionally (ie. out of the 'if (curl_http_proxy)'). I personally like the feature of not writing my password on $http_proxy at the cost of reading the env vars ourselves.

> 
> * Why do you (need to?) support HTTP_PROXY when curl doesn't?

I found somewhere documented HTTP_PROXY as well as http_proxy, but I've just checked wget[1] and also only supports http_proxy so I think we can discard it as is not widely used..

[1] http://www.gnu.org/software/wget/manual/html_node/Proxies.html
> 
> 
> [1] http://curl.haxx.se/libcurl/c/libcurl-tutorial.html, "Environment Variables"
> 
Previous: Thomas RastNext: Thomas Rast
Message 3 of 24 in “http: try standard proxy env vars when http.proxy config option is not set”
  1. 2/3 http: try standard proxy env vars when http.proxy config option is not setNelson Benitez Leon, Feb 28, 2012
  2. Thomas RastFeb 28, 2012
  3. Nelson Benitez LeonFeb 28, 2012
  4. Thomas RastFeb 28, 2012
  5. Junio C HamanoFeb 28, 2012
  6. Nelson Benitez LeonFeb 29, 2012
  7. Junio C HamanoFeb 29, 2012
  8. Nelson Benitez LeonMar 1, 2012
  9. Daniel StenbergMar 4, 2012
  10. Jeff KingFeb 28, 2012
  11. Sam VilainFeb 28, 2012
  12. Jeff KingFeb 28, 2012
  13. Matthieu MoyFeb 29, 2012
  14. Nelson Benitez LeonFeb 29, 2012
  15. Jeff KingFeb 29, 2012
  16. Nelson Benitez LeonMar 1, 2012
  17. Jeff KingMar 1, 2012
  18. James CloosMar 11, 2012
  19. Junio C HamanoMar 11, 2012
  20. Nelson Benitez LeonMar 13, 2012
  21. Junio C HamanoMar 14, 2012
  22. Nelson Benitez LeonMar 14, 2012
  23. Junio C HamanoMar 14, 2012
  24. Nelson Benitez LeonMar 15, 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.