Sortix 1.1dev ports manual
This manual documents Sortix 1.1dev ports. You can instead view this document in the latest official manual.
CURLOPT_TRAILERFUNCTION(3) | curl_easy_setopt options | CURLOPT_TRAILERFUNCTION(3) |
NAME
CURLOPT_TRAILERFUNCTION - Set callback for sending trailing headersSYNOPSIS
#include <curl.h>DESCRIPTION
Pass a pointer to a callback function.DEFAULT
NULLPROTOCOLS
HTTPEXAMPLE
#include <curl/curl.h>/* libcurl will free the list */
tr = curl_slist_append(*tr, "My-super-awesome-trailer: trailer-stuff");
return CURL_TRAILERFUNC_OK; }
/* Set the URL of the request */
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/");
/* Now set it as a put */
curl_easy_setopt(curl, CURLOPT_PUT, 1L);
/* Assuming we have a function that will return the data to be pushed
Let that function be read_cb */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_cb);
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Trailer: My-super-awsome-trailer");
res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
/* Set the trailers filling callback */
curl_easy_setopt(curl, CURLOPT_TRAILERFUNCTION, trailer_cb);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
curl_slist_free_all(headers); }
AVAILABILITY
This option was added in curl 7.64.0 and is present if HTTP support is enabledSEE ALSO
CURLOPT_TRAILERDATA(3),October 31, 2019 | libcurl 7.69.0 |