1CURLOPT_NOPROXY(3)         curl_easy_setopt options         CURLOPT_NOPROXY(3)
2
3
4

NAME

6       CURLOPT_NOPROXY - disable proxy use for specific hosts
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_easy_setopt(CURL  *handle,  CURLOPT_NOPROXY,  char  *no‐
12       proxy);
13

DESCRIPTION

15       Pass a pointer to a null-terminated string. The string  consists  of  a
16       comma  separated  list of host names that do not require a proxy to get
17       reached, even if one is specified.  The only wildcard  available  is  a
18       single  *  character, which matches all hosts, and effectively disables
19       the proxy. Each name in this list is matched as either a  domain  which
20       contains the hostname, or the hostname itself. For example, example.com
21       would match example.com, example.com:80, and www.example.com,  but  not
22       www.notanexample.com or example.com.othertld.
23
24       If  the  name  in the noproxy list has a leading period, it is a domain
25       match against the provided host  name.  This  way  ".example.com"  will
26       switch off proxy use for both "www.example.com" as well as for "foo.ex‐
27       ample.com".
28
29       Setting the noproxy string to "" (an empty string) will explicitly  en‐
30       able  the  proxy  for  all  host names, even if there is an environment
31       variable set for it.
32
33       Enter IPv6 numerical addresses in the list of host  names  without  en‐
34       closing brackets:
35
36        "example.com,::1,localhost"
37
38       IPv6  numerical  addresses  are  compared as strings, so they will only
39       match if the representations are the same: "::1" is the same as "::0:1"
40       but they don't match.
41
42       The  application  does not have to keep the string around after setting
43       this option.
44

Environment variables

46       If there's an environment variable called no_proxy  (or  NO_PROXY),  it
47       will  be used if the CURLOPT_NOPROXY(3) option is not set. It works ex‐
48       actly the same way.
49

DEFAULT

51       NULL
52

PROTOCOLS

54       Most
55

EXAMPLE

57       CURL *curl = curl_easy_init();
58       if(curl) {
59         /* accept various URLs */
60         curl_easy_setopt(curl, CURLOPT_URL, input);
61         /* use this proxy */
62         curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
63         /* ... but make sure this host name is not proxied */
64         curl_easy_setopt(curl, CURLOPT_NOPROXY, "www.example.com");
65         curl_easy_perform(curl);
66       }
67

AVAILABILITY

69       Added in 7.19.4
70

RETURN VALUE

72       Returns CURLE_OK if the option is  supported,  CURLE_UNKNOWN_OPTION  if
73       not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
74

SEE ALSO

76       CURLOPT_PROXY(3), CURLOPT_PROXYAUTH(3),
77
78
79
80libcurl 7.76.1                 November 04, 2020            CURLOPT_NOPROXY(3)
Impressum