From: Jeff King <peff@peff.net>
To: Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es>
Cc: git@vger.kernel.org, sam@vilain.net
Subject: Re: [PATCH v3 3/4] http: handle proxy proactive authentication
Date: Tue, 6 Mar 2012 05:09:47 -0500 [thread overview]
Message-ID: <20120306100947.GA710@sigill.intra.peff.net> (raw)
In-Reply-To: <4F55EDF3.2030201@seap.minhap.es>
On Tue, Mar 06, 2012 at 11:58:59AM +0100, Nelson Benitez Leon wrote:
> > Also, when turning it back into a URL to hand to curl, should we be
> > percent-encoding the items we put in? If my password has an "@" in it,
> > wouldn't we generate a bogus URL? Although looking at how the http auth
> > code handles this, we set CURLOPT_USERPWD directly. Should you be
> > setting CURLOPT_PROXYUSERPWD instead of munging the proxy URL?
>
> Ok, but it seems is CURLOPT_PROXYUSERNAME and CURLOPT_PROXYPASSWORD what
> we need here as per documentation[1]
>
> [1] http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXYUSERNAME
Yes, the split CURLOPT_USERNAME and CURLOPT_PASSWORD interface is much
better (it allows the username to contain a colon). But it was not
introduced until curl 7.19.3, and we support older versions.
We could do an #if on LIBCURL_VERSION_NUM to use the new form when it's
available, but nobody has complained so far.
> >> + free ((void *)curl_http_proxy);
> >
> > Please don't cast to void. This is C, not C++, and casts to void
> > pointers are implicit. They can never help, and might cover up an
> > actual type error (e.g., casting a non-pointer type).
>
> Ok, will remove it, I copy/paste it from the http code and I must admit
> I didn't understand why this was needed.
Ah. I grepped for the spot you copied. The cast is to get rid of the
"const" on curl_http_proxy. But if it's a pointer to allocated memory,
it should not be declared const in the first place. Unfortunately,
fixing this means casting in the call to git_config_string (which for
some reason takes a pointer-to-const-pointer, even though the value it
puts in will always be allocated by xstrdup). Or fixing
git_config_string, but that cascades to require fixing in lots of other
places. Ugh.
-Peff
next prev parent reply other threads:[~2012-03-06 10:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-05 15:19 [PATCH v3 3/4] http: handle proxy proactive authentication Nelson Benitez Leon
2012-03-06 8:30 ` Jeff King
2012-03-06 10:58 ` Nelson Benitez Leon
2012-03-06 10:09 ` Jeff King [this message]
2012-03-06 10:53 ` Jeff King
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=20120306100947.GA710@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=nelsonjesus.benitez@seap.minhap.es \
--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).