cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Automatic use of http_proxy environment variable

From: <andrei_at_korostelev.net>
Date: Tue, 16 Sep 2014 18:55:05 +0200

> On Tue, 16 Sep 2014, andrei_at_korostelev.net wrote:
>
>> Normally if the app is configured not to use proxy, it simply calls
>> curl_easy_perform(); which is clean and logical.
>
> Yes, but that also means "please mr libcurl, use your default proxy
> environment variable proxy detection magic".

This can be true for Unix users.
This is hardly true for Windows users.

>
>> With your suggestion we shall first do this prelude:
>>
>> curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLPROXY_HTTP);
>> curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
>> curl_easy_setopt(cutl, CURLOPT_PROXY, "");
>>
>> and then call
>> curl_easy_perform(curl);
>>
>> Right?
>
> There's no point in setting PROXYAUTH (twice) if you're not using a proxy.

Sorry, typo, the first call should have been
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);

> But
> yes, if you explicitly want to disable proxies that's how to do it.
> That'll
> force libcurl to not use any proxy environment variable.

Right but I'm pretty sure the most Windows developers will expect that
plain curl_easy_perform() call is a way to do this.
In other words, if they do not need proxy, they just don't configure it.

>
>> Technically it will probably achieve a right result (proxy will be
>> disabled) but it looks unnecessary over-complicated.
>> Don't you think so?
>
> You think using (a new option like) CURLOPT_PROXYLOGICDISABLED is less
> complicated than setting CURLOPT_PROXY to "" ? How so?
>
> Another option is set CURLOPT_NOPROXY to "*".
>

If we set the default behavior to detect proxy on Unix and not to detect
it on Windows, there will be no need to explicitly set this option in most
cases.

> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-09-16