1CURLOPT_PROXYHEADER(3) curl_easy_setopt options CURLOPT_PROXYHEADER(3)
2
3
4
6 CURLOPT_PROXYHEADER - custom HTTP headers to pass to proxy
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYHEADER,
12 struct curl_slist *headers);
13
15 Pass a pointer to a linked list of HTTP headers to pass in your HTTP
16 request sent to a proxy. The rules for this list is identical to the
17 CURLOPT_HTTPHEADER(3) option's.
18
19 The headers set with this option is only ever used in requests sent to
20 a proxy - when there's also a request sent to a host.
21
22 The first line in a request (containing the method, usually a GET or
23 POST) is NOT a header and cannot be replaced using this option. Only
24 the lines following the request-line are headers. Adding this method
25 line in this list of headers will only cause your request to send an
26 invalid header.
27
28 Pass a NULL to this to reset back to no custom headers.
29
31 NULL
32
34 HTTP
35
37 CURL *curl = curl_easy_init();
38
39 struct curl_slist *list;
40
41 if(curl) {
42 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
43 curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy.example.com:80");
44
45 list = curl_slist_append(NULL, "Shoesize: 10");
46 list = curl_slist_append(list, "Accept:");
47
48 curl_easy_setopt(curl, CURLOPT_PROXYHEADER, list);
49
50 curl_easy_perform(curl);
51
52 curl_slist_free_all(list); /* free the list again */
53 }
54
56 Added in 7.37.0
57
59 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
60 if not.
61
63 CURLOPT_HEADEROPT(3), CURLOPT_HTTPHEADER(3),
64
65
66
67libcurl 7.66.0 May 30, 2017 CURLOPT_PROXYHEADER(3)