1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_NOPROXY 5Section: 3 6Source: libcurl 7Protocol: 8 - All 9See-also: 10 - CURLOPT_PROXY (3) 11 - CURLOPT_PROXYAUTH (3) 12 - CURLOPT_PROXYTYPE (3) 13--- 14 15# NAME 16 17CURLOPT_NOPROXY - disable proxy use for specific hosts 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOPROXY, char *noproxy); 25~~~ 26 27# DESCRIPTION 28 29Pass a pointer to a null-terminated string. The string consists of a comma 30separated list of hostnames that do not require a proxy to get reached, even 31if one is specified. The only wildcard available is a single * character, 32which matches all hosts, and effectively disables the proxy. Each name in this 33list is matched as either a domain which contains the hostname, or the 34hostname itself. For example, "ample.com" would match ample.com, ample.com:80, 35and www.ample.com, but not www.example.com or ample.com.org. 36 37Setting the *noproxy* string to "" (an empty string) explicitly enables the 38proxy for all hostnames, even if there is an environment variable set for it. 39 40Enter IPv6 numerical addresses in the list of hostnames without enclosing 41brackets: 42 43 "example.com,::1,localhost" 44 45Since 7.86.0, IP addresses specified to this option can be provided using CIDR 46notation: an appended slash and number specifies the number of "network bits" 47out of the address to use in the comparison. For example "192.168.0.0/16" 48would match all addresses starting with "192.168". 49 50The application does not have to keep the string around after setting this 51option. 52 53# Environment variables 54 55If there is an environment variable called **no_proxy** (or **NO_PROXY**), 56it is used if the CURLOPT_NOPROXY(3) option is not set. It works exactly 57the same way. 58 59# DEFAULT 60 61NULL 62 63# EXAMPLE 64 65~~~c 66int main(void) 67{ 68 CURL *curl = curl_easy_init(); 69 if(curl) { 70 /* accept various URLs */ 71 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 72 /* use this proxy */ 73 curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80"); 74 /* ... but make sure this host name is not proxied */ 75 curl_easy_setopt(curl, CURLOPT_NOPROXY, "www.example.com"); 76 curl_easy_perform(curl); 77 } 78} 79~~~ 80 81# AVAILABILITY 82 83Added in 7.19.4 84 85# RETURN VALUE 86 87Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or 88CURLE_OUT_OF_MEMORY if there was insufficient heap space. 89