git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, sam@vilain.net
Subject: Re: [PATCH v3 4/4] http: handle proxy authentication failure (error 407)
Date: Tue, 06 Mar 2012 12:10:12 +0100	[thread overview]
Message-ID: <4F55F094.6010606@seap.minhap.es> (raw)
In-Reply-To: <20120306085445.GE21199@sigill.intra.peff.net>

On 03/06/2012 09:54 AM, Jeff King wrote:
> On Mon, Mar 05, 2012 at 04:21:28PM +0100, Nelson Benitez Leon wrote:
> 
>> Handle http 407 error code by asking for credentials and
>> retrying request in case credentials were not present, or
>> marking credentials as rejected if they were already provided.
>>
>> Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>
>> ---
>>  http.c |   16 ++++++++++++++++
>>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> No tests. I wonder how hard it would be to set up an apache proxy for
> automated testing, just as we set one up as a git server in
> t/lib-httpd.sh. It should be basically the same process, but with a
> different config file, I would think.

I cannot help with this, I didn't even know you could setup a proxy
with solely apache, I thought you needed special software like Squid..
anyway I'm testing all these patches with my employers proxy which uses
NTLM autentication and they're performing well..

> [snip]
> 
> We need to actually loop, retrying if we get reauth (and arguably REAUTH
> should simply be called RETRY). Like this:
> 
> diff --git a/http.c b/http.c
> index e4afbe5..c325b00 100644
> --- a/http.c
> +++ b/http.c
> @@ -810,10 +810,13 @@ static int http_request(const char *url, curl_write_callback cb, void *result,
>  static int http_request_reauth(const char *url, curl_write_callback cb,
>  			       void *result, unsigned long offset, int options)
>  {
> -	int ret = http_request(url, cb, result, offset, options);
> -	if (ret != HTTP_REAUTH)
> -		return ret;
> -	return http_request(url, cb, result, offset, options);
> +	int ret;
> +
> +	do {
> +		ret = http_request(url, cb, result, offset, options);
> +	} while (ret == HTTP_REAUTH);
> +
> +	return ret;
>  }
>  
>  int http_get_strbuf(const char *url, struct strbuf *result, int options)

Yes, giving the case you mention (proxy auth + http auth) your patch does
the right thing.

      reply	other threads:[~2012-03-06 10:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05 15:21 [PATCH v3 4/4] http: handle proxy authentication failure (error 407) Nelson Benitez Leon
2012-03-06  8:54 ` Jeff King
2012-03-06 11:10   ` Nelson Benitez Leon [this message]

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=4F55F094.6010606@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).