Sortix main manual
This manual documents Sortix main. You can instead view this document in the latest official manual.
CURLOPT_HTTPHEADER(3) | curl_easy_setopt options | CURLOPT_HTTPHEADER(3) |
NAME
CURLOPT_HTTPHEADER - set of HTTP headersSYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPHEADER,
struct curl_slist *headers);
DESCRIPTION
Pass a pointer to a linked list of HTTP headers to pass to the server and/or proxy in your HTTP request. The same list can be used for both host and proxy requests!SPECIFIC HEADERS
Setting some specific headers will cause libcurl to act differently.- Host:
- The specified host name will be used for cookie matching if the cookie engine is also enabled for this transfer. If the request is done over HTTP/2 or HTTP/3, the custom host name will instead be used in the ":authority" header field and Host: will not be sent at all over the wire.
- Transfer-Encoding: chunked
- Tells libcurl the upload is to be done using this chunked encoding instead of providing the Content-Length: field in the request.
SECURITY CONCERNS
By default, this option makes libcurl send the given headers in all HTTP requests done by this handle. You should therefore use this option with caution if you for example connect to the remote site using a proxy and a CONNECT request, you should to consider if that proxy is supposed to also get the headers. They may be private or otherwise sensitive to leak.DEFAULT
NULLPROTOCOLS
HTTPEXAMPLE
CURL *curl = curl_easy_init();
struct curl_slist *list = NULL;
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
list = curl_slist_append(list, "Shoesize: 10");
list = curl_slist_append(list, "Accept:");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
curl_easy_perform(curl);
curl_slist_free_all(list); /* free the list */
}
AVAILABILITY
As long as HTTP is enabledRETURN VALUE
Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.SEE ALSO
CURLOPT_CUSTOMREQUEST(3), CURLOPT_HEADEROPT(3), CURLOPT_PROXYHEADER(3), CURLOPT_HEADER(3)June 17, 2022 | libcurl 7.84.0 |