cURL / Mailing Lists / curl-library / Single Mail


Re: Automatic use of http_proxy environment variable

From: <>
Date: Tue, 16 Sep 2014 15:37:40 +0200

> On Tue, 16 Sep 2014, wrote:
>> We have an app which we distribute to Windows and Linux and which makes
>> use
>> of libcurl. The app allows to setup proxy in config file. However when
>> http_proxy env. variable is set it comes into a conflict with
>> app-specific
>> proxy settings. This is especially annoying for Windows users.
> Can't you then just set the proxy if there is one, and set it to "" if you
> explicitly do not want one? I can't think of a situation where this would
> be
> unclear. Can you?

Normally if the app is configured not to use proxy, it simply calls
which is clean and logical.

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


Technically it will probably achieve a right result (proxy will be
disabled) but it looks unnecessary over-complicated.
Don't you think so?

>> The solution I propose is very simple. Since all proxy-detection magic
>> lives
>> in detect_proxy() function in url.c, we can easily call this function
>> conditionally:
>> proxy = detect_proxy(conn);
>> #endif
> If a disable switch really is necessary, I would think it should be
> possible
> to set at run-time and not require a special build!

That's even better.

> --
> /
> -------------------------------------------------------------------
> List admin:
> Etiquette:

List admin:
Received on 2014-09-16