1CURLOPT_HSTSWRITEFUNCTION(3)curl_easy_setopt optionsCURLOPT_HSTSWRITEFUNCTION(3)
2
3
4

NAME

6       CURLOPT_HSTSWRITEFUNCTION - write callback for HSTS hosts
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLSTScode hstswrite(CURL *easy, struct curl_hstsentry *sts,
12                             struct curl_index *count, void *userp);
13
14       CURLcode   curl_easy_setopt(CURL   *handle,  CURLOPT_HSTSWRITEFUNCTION,
15       hstswrite);
16

DESCRIPTION

18       Pass a pointer to your callback function, as the prototype shows above.
19
20       This callback function gets called by libcurl repeatedly to  allow  the
21       application  to store the in-memory HSTS cache when libcurl is about to
22       discard it.
23
24       Set the userp argument with the CURLOPT_HSTSWRITEDATA(3) option  or  it
25       will be NULL.
26
27       When  the  callback  is  invoked, the sts pointer points to a populated
28       struct: Read the host name to 'name' (it is 'namelen'  bytes  long  and
29       null terminated. The 'includeSubDomains' field is non-zero if the entry
30       matches subdomains. The 'expire' string is a date stamp null-terminated
31       string using the syntax YYYYMMDD HH:MM:SS.
32
33       The  callback  should return CURLSTS_OK if it succeeded and is prepared
34       to be called again (for another host) or CURLSTS_DONE if there's  noth‐
35       ing more to do. It can also return CURLSTS_FAIL to signal error.
36

DEFAULT

38       NULL - no callback.
39

PROTOCOLS

41       This feature is only used for HTTP(S) transfer.
42

EXAMPLE

44       {
45         /* set HSTS read callback */
46         curl_easy_setopt(curl, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
47
48         /* pass in suitable argument to the callback */
49         curl_easy_setopt(curl, CURLOPT_HSTSWRITEDATA, &hstspreload[0]);
50
51         result = curl_easy_perform(curl);
52       }
53

AVAILABILITY

55       Added in 7.74.0
56

RETURN VALUE

58       This will return CURLE_OK.
59

SEE ALSO

61       CURLOPT_HSTSWRITEDATA(3),       CURLOPT_HSTSWRITEFUNCTION(3),      CUR‐
62       LOPT_HSTS(3), CURLOPT_HSTS_CTRL(3),
63
64
65
66libcurl 7.79.1                September 06, 2021  CURLOPT_HSTSWRITEFUNCTION(3)
Impressum