1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_PROXYHEADER 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_HEADEROPT (3) 9 - CURLOPT_HTTPHEADER (3) 10--- 11 12# NAME 13 14CURLOPT_PROXYHEADER - set of HTTP headers to pass to proxy 15 16# SYNOPSIS 17 18~~~c 19#include <curl/curl.h> 20 21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYHEADER, 22 struct curl_slist *headers); 23~~~ 24 25# DESCRIPTION 26 27Pass a pointer to a linked list of HTTP headers to pass in your HTTP request 28sent to a proxy. The rules for this list is identical to the 29CURLOPT_HTTPHEADER(3) option's. 30 31The headers set with this option is only ever used in requests sent to a proxy 32- when there is also a request sent to a host. 33 34The first line in a request (containing the method, usually a GET or POST) is 35NOT a header and cannot be replaced using this option. Only the lines 36following the request-line are headers. Adding this method line in this list 37of headers causes your request to send an invalid header. 38 39Pass a NULL to this to reset back to no custom headers. 40 41# DEFAULT 42 43NULL 44 45# PROTOCOLS 46 47HTTP 48 49# EXAMPLE 50 51~~~c 52int main(void) 53{ 54 CURL *curl = curl_easy_init(); 55 56 struct curl_slist *list; 57 58 if(curl) { 59 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 60 curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy.example.com:80"); 61 62 list = curl_slist_append(NULL, "Shoesize: 10"); 63 list = curl_slist_append(list, "Accept:"); 64 65 curl_easy_setopt(curl, CURLOPT_PROXYHEADER, list); 66 67 curl_easy_perform(curl); 68 69 curl_slist_free_all(list); /* free the list again */ 70 } 71} 72~~~ 73 74# AVAILABILITY 75 76Added in 7.37.0 77 78# RETURN VALUE 79 80Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 81