From: Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es>
To: Jeff King <peff@peff.net>
Cc: Sam Vilain <sam@vilain.net>, git@vger.kernel.org
Subject: Re: [PATCH v2 3/3] http: when proxy url has username but no password, ask for password
Date: Fri, 02 Mar 2012 14:33:53 +0100 [thread overview]
Message-ID: <4F50CC41.5020307@seap.minhap.es> (raw)
In-Reply-To: <20120301215812.GG17631@sigill.intra.peff.net>
On 03/01/2012 10:58 PM, Jeff King wrote:
> On Thu, Mar 01, 2012 at 09:49:16AM -0800, Sam Vilain wrote:
>
>>> if (curl_http_proxy) {
>>> - curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);
>>> + credential_from_url(&proxy_auth, curl_http_proxy);
>>> + if (proxy_auth.username != NULL&& proxy_auth.password == NULL) {
>>> + /* proxy string has username but no password, ask for password */
>>> + struct strbuf pbuf = STRBUF_INIT;
>>> + credential_fill(&proxy_auth);
>>
>> Wouldn't it be better to wait until the proxy returns a 403 before
>> assuming that the proxy setting is incorrect/missing a password?
>> What if the administrator expects the user to fill in both the
>> username and password? That is the behaviour of a web browser.
>>
>> Also, I think you should wait until that 403 to detect whether the
>> proxy setting came from the environment, and only load it explicitly
>> then.
>
> It's worth looking at what the http auth code does here.
>
[snip]
> overhaul it.
>
> Complicating all of this is the fact that I think Nelson's original
> patch was based on an older, pre-986bbc0 version of git, which is why he
> followed the pre-prompt route, copying the style of regular http auth.
>
> So there's the history lesson. What should proxy auth do?
>
> 1. Definitely respond to HTTP 407 by prompting on the fly; this code
> should go along-side the HTTP 401 code in http.c.
>
> 2. Definitely do the pre-prompt thing when http_proactive_auth is set
> (which is used only by http-push). Unless somebody really feels
> like re-writing http-push to handle retries for authentication.
>
> 3. Consider doing the pre-prompt thing when http_proactive_auth is not
> set. This can save a round-trip, but we should not do it if there
> is a good reason not to. The two possible reasons I can think of
> are:
>
> a. Like http auth, if curl will read the proxy credentials from
> .netrc, then we should not do it for the same reasons
> mentioned in 986bbc0.
>
> b. If people realistically have proxy URLs with usernames but do
> _not_ want to ask for a password, then the prompt will be
> annoying. I'm not sure that anybody expects that.
So, trying to sum up, I will try to redo patch-set as follows:
- Ignore PATCH 2/3 , that is, we won't read any env var.
- Let cURL try to connect and if that fails with 407 , then do a credential_fill
and try to reconnect.
Is that ok? or do I need to do something more?
next prev parent reply other threads:[~2012-03-02 12:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-01 18:22 [PATCH v2 3/3] http: when proxy url has username but no password, ask for password Nelson Benitez Leon
2012-03-01 17:49 ` Sam Vilain
2012-03-01 21:58 ` Jeff King
2012-03-02 13:33 ` Nelson Benitez Leon [this message]
2012-03-02 12:45 ` Jeff King
2012-03-02 14:05 ` Nelson Benitez Leon
2012-03-02 13:52 ` Jeff King
2012-03-01 19:16 ` Junio C Hamano
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=4F50CC41.5020307@seap.minhap.es \
--to=nelsonjesus.benitez@seap.minhap.es \
--cc=git@vger.kernel.org \
--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.