Subject: Re: [PATCH 2/2] http: use credential API to handle proxy authentication

From: Knut Franke <[email-masked]>
Date: Tue, 3 Nov 2015 10:31:04 +0100

On 2015-11-02 14:54, Junio C Hamano wrote:
> >  static void init_curl_proxy_auth(CURL *result)
> >  {
> > +	if (proxy_auth.username) {
> > +		if (!proxy_auth.password)
> > +			credential_fill(&proxy_auth);
> > +#if LIBCURL_VERSION_NUM >= 0x071301
> > +		curl_easy_setopt(result, CURLOPT_PROXYUSERNAME,
> > +			proxy_auth.username);
> > +		curl_easy_setopt(result, CURLOPT_PROXYPASSWORD,
> > +			proxy_auth.password);
> > +#else
> > +		struct strbuf s = STRBUF_INIT;
> > +		strbuf_addstr_urlencode(&s, proxy_auth.username, 1);
> > +		strbuf_addch(&s, ':');
> > +		strbuf_addstr_urlencode(&s, proxy_auth.password, 1);
> > +		curl_proxyuserpwd = strbuf_detach(&s, NULL);
> > +		curl_easy_setopt(result, CURLOPT_PROXYUSERPWD, curl_proxyuserpwd);
> > +#endif
> 
> I think #else clause of this thing would introduce decl-after-stmt
> compilation error.

I've actually tested this with CURL 7.15.5 (0x070f05), and didn't get any
compilation error.

Cheers,
Knut
-- 
Vorstandsvorsitzender/Chairman of the board of management:
Gerd-Lothar Leonhart
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Arno Steitz
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Philippe Miltin
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196