curl-library
Re: no_proxy is being ignored
Date: Thu, 21 Dec 2006 16:43:27 +0000
> From: Daniel Stenberg <daniel_at_haxx.se>
> Date: 2006-12-21
> On Wed, 20 Dec 2006, Robert Foreman wrote:
>
>> I'm having a problem concerning the http_proxy and no_proxy environment
>> variables.
>
> $ setenv http_proxy localhost:80
> $ setenv no_proxy www.haxx.se,127.0.0.1
I have set those variables (I have to use www-cache for the proxy or I
can't connect outside my local network; the problem happens exactly the
same if I use localhost:80).
$ echo $http_proxy
http://www-cache:80
$ echo $no_proxy
www.haxx.se,127.0.0.1
> Tests:
>
> curl 127.0.0.1 => does not use proxy
> curl www.haxx.se => does not use proxy
> curl curl.haxx.se => uses proxy
> curl www.ibm.se => uses proxy
>
> Seems to do exactly right in my eyes!?
Using the curl executable, this works for me exactly as you say.
> Can you please provide us with a recipe on how to repeat your observed
> problems?
I've made a version of your simple.c example that shows my problem.
#include <stdio.h>
#include <curl/curl.h>
int main() {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1");
res = curl_easy_perform(curl);
curl_easy_setopt(curl, CURLOPT_URL, "http://www.haxx.se");
res = curl_easy_perform(curl);
curl_easy_setopt(curl, CURLOPT_URL, "http://curl.haxx.se");
res = curl_easy_perform(curl);
curl_easy_setopt(curl, CURLOPT_URL, "http://www.ibm.se");
res = curl_easy_perform(curl);
curl_easy_setopt(curl, CURLOPT_URL, "http://www.haxx.se");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
return 0;
}
When I run this program, the following happens:
- It connects to 127.0.0.1, does not use proxy
* About to connect() to 127.0.0.1 port 80 (#0)
- It connects to www.haxx.se, does not use proxy
* About to connect() to www.haxx.se port 80 (#1)
- It connects to curl.haxx.se, uses proxy
* About to connect() to proxy www-cache port 80 (#1)
- It connects to www.ibm.se, uses proxy
* Re-using existing connection! (#1) with host www-cache
- It connects to www.haxx.se, uses proxy <-- problem
* Re-using existing connection! (#1) with host www-cache
Yours,
Rob
(Apologies if my reply doesn't thread correctly, I think I got my
mailing list settings wrong).
Received on 2006-12-21