Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
CURLOPT_HEADEROPT(3) | Library Functions Manual | CURLOPT_HEADEROPT(3) |
NAME
CURLOPT_HEADEROPT - send HTTP headers to both proxy and host or separatelySYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADEROPT, long bitmask);
DESCRIPTION
Pass a long that is a bitmask of options of how to deal with headers. The two mutually exclusive options are:DEFAULT
CURLHEADER_SEPARATE (changed in 7.42.1, used CURLHEADER_UNIFIED before then)PROTOCOLS
This functionality affects http onlyEXAMPLE
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode ret;
struct curl_slist *list;
list = curl_slist_append(NULL, "Shoesize: 10");
list = curl_slist_append(list, "Accept:");
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
/* HTTPS over a proxy makes a separate CONNECT to the proxy, so tell
libcurl to not send the custom headers to the proxy. Keep them
separate! */
curl_easy_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_SEPARATE);
ret = curl_easy_perform(curl);
curl_slist_free_all(list);
curl_easy_cleanup(curl);
}
}
AVAILABILITY
Added in curl 7.37.0RETURN VALUE
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.SEE ALSO
CURLOPT_HTTPHEADER(3), CURLOPT_PROXYHEADER(3)2024-12-21 | libcurl |