Re: [PATCH v2 2/3] http: try http_proxy env var when http.proxy config option is not set
- From
Sam Vilain <sam@vilain.net>
- Date
- Mar 1, 2012, 17:45 UTC
- Message-ID
- <4F4FB5BF.8000904@vilain.net>
- In-Reply-To
- <4F4FBE0F.6020004@seap.minhap.es>
On 3/1/12 10:21 AM, Nelson Benitez Leon wrote:
> 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.
That's not what this change does. This change explicitly loads from the environment the 'http_proxy' variable and sets up curl to use it. As Junio said, this is (on its own) a regression.
Sam
Show 23 quoted lines
> 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);