cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: small logic error with CURLOPT_NOPROXY, and a patch...

From: A. Craig West <acraigwest_at_gmail.com>
Date: Thu, 18 Jun 2009 14:06:35 -0400

2009/6/18 Alexander Beedie <ayembee_at_gmail.com>:
> If I have set CURLOPT_NOPROXY to "*", or to a host that should not use a
> proxy, I actually can still end up using a proxy; in the source file
> "lib\url.c" we have this code sequence (around line 4380):
...
> * I explicitly set CURLOPT_NOPROXY to "*"
> * Consequently I don't bother to set CURLOPT_PROXY.
> * BUT my environment variables have a value for HTTP_proxy.
>
> So, coming into the block of code above we now have the following: proxy is
> NULL (I never set it because I have indicated I want to ignore all proxies),
> so !proxy sends me into the 'detect_proxy' sub, finds my environment
> variable, and returns me a proxy. Gah! I now have a proxy I don't want, and
> 'check_noproxy' won't run as I'm in the other half of the IF/ELSE.

The patch looks reasonable to me. I actually considered this case when
I was reworking the code, but decided it wasn't worth fixing as it is
a fairly bogus thing to do to have conflicting environment proxy
settings and CURLOPT settings. On the other hand, the app can't always
control the environment variables, so it should always be possible to
over-ride them like this
-Craig
Received on 2009-06-18