Sortix cisortix manual
This manual documents Sortix cisortix. You can instead view this document in the latest official manual.
CURLOPT_HEADERFUNCTION(3) | curl_easy_setopt options | CURLOPT_HEADERFUNCTION(3) |
NAME
CURLOPT_HEADERFUNCTION - callback that receives header dataSYNOPSIS
#include <curl/curl.h>
size_t header_callback(char *buffer,
size_t size,
size_t nitems,
void *userdata);
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADERFUNCTION,
header_callback);
DESCRIPTION
Pass a pointer to your callback function, which should match the prototype shown above.LIMITATIONS
libcurl does not unfold HTTP "folded headers" (deprecated since RFC 7230). A folded header is a header that continues on a subsequent line and starts with a whitespace. Such folds will be passed to the header callback as a separate one, although strictly it is just a continuation of the previous line.DEFAULT
Nothing.PROTOCOLS
Used for all protocols with headers or meta-data concept: HTTP, FTP, POP3, IMAP, SMTP and more.EXAMPLE
static size_t header_callback(char *buffer, size_t size,
size_t nitems, void *userdata)
{
/* received header is nitems * size long in 'buffer' NOT ZERO TERMINATED */
/* 'userdata' is set with CURLOPT_HEADERDATA */
return nitems * size;
}
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
curl_easy_perform(curl);
}
AVAILABILITY
AlwaysRETURN VALUE
Returns CURLE_OKSEE ALSO
curl_easy_header(3), CURLOPT_HEADERDATA(3), CURLOPT_WRITEFUNCTION(3),May 17, 2022 | libcurl 7.84.0 |