From: Jeff King <peff@peff.net>
To: Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 3/6] http: fix http_proxy specified without protocol part
Date: Fri, 4 May 2012 03:22:20 -0400 [thread overview]
Message-ID: <20120504072220.GC21895@sigill.intra.peff.net> (raw)
In-Reply-To: <4FA2B4E6.3080009@seap.minhap.es>
On Thu, May 03, 2012 at 06:40:06PM +0200, Nelson Benitez Leon wrote:
> An earlier patch broke http_proxy specified as <host>:<port> by abusing
> credential_from_url(). Teach the function to parse that format, but the
> caller needs to be updated to handle the case where there is no protocol
> in the parse result.
>
> Also allow keyring implementations to differentiate authentication
> material meant for http proxies and http destinations by using a
> different token "http-proxy" to consult them for the former.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Should this be:
From: Junio C Hamano <gitster@pobox.com>
?
Also, any time we read "an earlier patch broke..." and that earlier
patch is in this series, I have to wonder why the patches are not simply
reordered. Shouldn't the first half of this one come first, and just
explain the rationale as "teach credential_from_url to handle
protocol-less URLs, since those are used for proxy specifications, which
we will need to parse in a later patch".
> diff --git a/http.c b/http.c
> index 02f9fcd..22ffe0c 100644
> --- a/http.c
> +++ b/http.c
> @@ -366,17 +366,20 @@ static CURL *get_curl_handle(const char *url)
> }
>
> if (curl_http_proxy) {
> - struct strbuf proxyhost = STRBUF_INIT;
> -
> - if (!proxy_auth.host) /* check to parse only once */
> + if (!proxy_auth.host) {
> credential_from_url(&proxy_auth, curl_http_proxy);
> + if (!proxy_auth.protocol ||
> + !strcmp(proxy_auth.protocol, "http")) {
> + free(proxy_auth.protocol);
> + proxy_auth.protocol = xstrdup("http-proxy");
> + }
> + }
And then this hunk would just get squashed in in the first place.
> if (http_proactive_auth && proxy_auth.username && !proxy_auth.password)
> /* proxy string has username but no password, ask for password */
> credential_fill(&proxy_auth);
>
> - strbuf_addf(&proxyhost, "%s://%s", proxy_auth.protocol, proxy_auth.host);
> - curl_easy_setopt(result, CURLOPT_PROXY, strbuf_detach(&proxyhost, NULL));
> + curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);
And this too, which gets rid of my complaints about the previous patch.
-Peff
prev parent reply other threads:[~2012-05-04 7:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 16:40 [PATCH 3/6] http: fix http_proxy specified without protocol part Nelson Benitez Leon
2012-05-04 7:22 ` Jeff King [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=20120504072220.GC21895@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nelsonjesus.benitez@seap.minhap.es \
/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).