Sortix cross-volatile manual
This manual documents Sortix cross-volatile. You can instead view this document in the latest official manual.
CURLOPT_HSTSWRITEFUNCTION(3) | Library Functions Manual | CURLOPT_HSTSWRITEFUNCTION(3) |
NAME
CURLOPT_HSTSWRITEFUNCTION - write callback for HSTS hostsSYNOPSIS
#include <curl/curl.h>
struct curl_hstsentry {
char *name;
size_t namelen;
unsigned int includeSubDomains:1;
char expire[18]; /* YYYYMMDD HH:MM:SS [null-terminated] */
};
struct curl_index {
size_t index; /* the provided entry's "index" or count */
size_t total; /* total number of entries to save */
};
CURLSTScode hstswrite(CURL *easy, struct curl_hstsentry *sts,
struct curl_index *count, void *clientp);
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
DESCRIPTION
Pass a pointer to your callback function, as the prototype shows above.DEFAULT
NULL - no callback.PROTOCOLS
This functionality affects http onlyEXAMPLE
struct priv {
void *custom;
};
static CURLSTScode hswr_cb(CURL *easy, struct curl_hstsentry *sts,
struct curl_index *count, void *clientp)
{
/* save the passed in HSTS data somewhere */
return CURLSTS_OK;
}
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
struct priv my_stuff;
CURLcode res;
/* set HSTS read callback */
curl_easy_setopt(curl, CURLOPT_HSTSWRITEFUNCTION, hswr_cb);
/* pass in suitable argument to the callback */
curl_easy_setopt(curl, CURLOPT_HSTSWRITEDATA, &my_stuff);
res = curl_easy_perform(curl);
}
}
AVAILABILITY
Added in curl 7.74.0RETURN VALUE
This returns CURLE_OK.SEE ALSO
CURLOPT_HSTS(3), CURLOPT_HSTSWRITEDATA(3), CURLOPT_HSTSWRITEFUNCTION(3), CURLOPT_HSTS_CTRL(3)2024-11-23 | libcurl |