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