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

EXPERIMENTAL

18       Warning: this feature is early code and is marked as  experimental.  It
19       can only be enabled by explicitly telling configure with --enable-hsts.
20       You are advised to not ship this in production before the  experimental
21       label is removed.
22

DESCRIPTION

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

DEFAULT

44       NULL - no callback.
45

PROTOCOLS

47       This feature is only used for HTTP(S) transfer.
48

EXAMPLE

50       {
51         /* set HSTS read callback */
52         curl_easy_setopt(curl, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
53
54         /* pass in suitable argument to the callback */
55         curl_easy_setopt(curl, CURLOPT_HSTSWRITEDATA, &hstspreload[0]);
56
57         result = curl_easy_perform(curl);
58       }
59

AVAILABILITY

61       Added in 7.74.0
62

RETURN VALUE

64       This will return CURLE_OK.
65

SEE ALSO

67       CURLOPT_HSTSWRITEDATA(3),      CURLOPT_HSTSWRITEFUNCTION(3),       CUR‐
68       LOPT_HSTS(3), CURLOPT_HSTS_CTRL(3),
69
70
71
72libcurl 7.76.1                 November 04, 2020  CURLOPT_HSTSWRITEFUNCTION(3)
Impressum