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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 3, 2015 at 4:31 AM, Knut Franke
<k.franke@xxxxxxxxxxxxxxxxxxxx> wrote:
> 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.

Junio meant that, on this project, code still follows the rule that
all declarations in a block must come before statements in order to
appease older compilers. That is (good):

    {
        int foo; /* declaration */

        if (doodad) /* statement */
            snorg();
        glop(&foo);
    }

rather than (bad):

    {
        if (doodad) /* statement */
            snorg();

        int foo; /* declaration after statement */
        glop(&foo);
    }

The gcc option -Wdeclaration-after-statement can help.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]