Sortix cross-volatile manual
This manual documents Sortix cross-volatile. You can instead view this document in the latest official manual.
CURLOPT_HTTPHEADER(3) | Library Functions Manual | 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 HTTP HEADERS
Setting some specific headers causes libcurl to act differently.- Host:
- The specified hostname is 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 hostname is instead used in the ":authority" header field and Host: is not 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.
SPECIFIC MIME HEADERS
When used to build a MIME email for IMAP or SMTP, the following document-level headers can be set to override libcurl-generated values:- Mime-Version:
- Tells the parser at the receiving site how to interpret the MIME framing. It defaults to "1.0" and should normally not be altered.
- Content-Type:
- Indicates the document's global structure type. By default, libcurl sets it to "multipart/mixed", describing a document made of independent parts. When a MIME mail is only composed of alternative representations of the same data (i.e.: HTML and plain text), this header must be set to "multipart/alternative". In all cases the value must be of the form "multipart/*" to respect the document structure and may not include the "boundary=" parameter.
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
This functionality affects http, imap and smtpEXAMPLE
int main(void)
{
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 */
}
}
HISTORY
Use for MIME mail added in 7.56.0.AVAILABILITY
Added in curl 7.1RETURN VALUE
Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.SEE ALSO
CURLOPT_CUSTOMREQUEST(3), CURLOPT_HEADER(3), CURLOPT_HEADEROPT(3), CURLOPT_MIMEPOST(3), CURLOPT_PROXYHEADER(3), curl_mime_init(3)2024-12-28 | libcurl |