All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, peff@peff.net, sam@vilain.net
Subject: Re: [PATCH v2 1/3]http: authenticate on NTLM proxies and others suppported by CuRL
Date: Fri, 02 Mar 2012 14:55:57 +0100	[thread overview]
Message-ID: <4F50D16D.3090800@seap.minhap.es> (raw)
In-Reply-To: <7v399snnrs.fsf@alter.siamese.dyndns.org>

On 03/01/2012 08:07 PM, Junio C Hamano wrote:
> Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es> writes:
> 
> Thanks; doesn't a missing space before http: above look ugly to you, by
> the way?
> 
>> CURLAUTH_ANY option automatically chooses the best auth method from
>> among those the server supports, that means curl will ask the proxy and
>> use the appropiate, and it will only do that if you are using a proxy
>> (i.e. you've set CURLOPT_PROXY or you have http_proxy env var), also
>> curl will not try to authenticate if you've not provided username or
>> password in the proxy string, as told here[1]..
> 
> The above may justify why you used CURLAUTH_ANY as opposed to
> CURLAUTH_BASIC or other types, but without any description of the problem
> you are trying to solve before that paragraph, it does not justify why you
> are adding a code to use CURLOPT_PROXYAUTH in the first place.
> 
> This is my *guess* of the problem you are trying to solve.

I've ammended the commit message with your wording, text as follows:

When the proxy server specified by the http.proxy configuration or
the http_proxy environment variable requires authentication, git
failed to connect to the proxy, because we did not configure the
cURL handle with CURLOPT_PROXYAUTH.

When a proxy is in use, and you tell git that the proxy requires
authentication by having username in the http.proxy configuration,
an extra request needs to be made to the proxy to find out what
authentication method it supports, as this patch uses CURLAUTH_ANY
to let the library pick the most secure method supported by the
proxy server.

The extra round-trip adds extra latency, but relieves the user
from the burden to configure a specific authentication method.  If
it becomes problem, a later patch could add a configuration option
to specify what method to use, but let's start simple for the time
being.

So as CURLAUTH_ANY provide us out-of-the-box proxy support, we don't
want it activated manually from a config option, instead we added it
automatically when a proxy is being used.

Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>
---
 http.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/http.c b/http.c
index 0ffd79c..8ac8eb6 100644
--- a/http.c
+++ b/http.c
@@ -295,8 +295,10 @@ static CURL *get_curl_handle(void)
 	if (curl_ftp_no_epsv)
 		curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);
 
-	if (curl_http_proxy)
+	if (curl_http_proxy) {
 		curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);
+		curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
+	}
 
 	return result;
 }
-- 
1.7.7.6

  reply	other threads:[~2012-03-02 12:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-01 18:19 [PATCH v2 1/3]http: authenticate on NTLM proxies and others suppported by CuRL Nelson Benitez Leon
2012-03-01 19:07 ` Junio C Hamano
2012-03-02 13:55   ` Nelson Benitez Leon [this message]
2012-03-02 18:50     ` Junio C Hamano
2012-03-05 15:33       ` Nelson Benitez Leon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F50D16D.3090800@seap.minhap.es \
    --to=nelsonjesus.benitez@seap.minhap.es \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sam@vilain.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.