1CURLOPT_HSTSREADFUNCTION(3)curl_easy_setopt optionsCURLOPT_HSTSREADFUNCTION(3)
2
3
4

NAME

6       CURLOPT_HSTSREADFUNCTION - read callback for HSTS hosts
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLSTScode  hstsread(CURL  *easy,  struct  curl_hstsentry  *sts,  void
12       *userp);
13
14       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSREADFUNCTION,  hst‐
15       sread);
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 when it  popu‐
27       lates the in-memory HSTS cache.
28
29       Set  the  userp  argument with the CURLOPT_HSTSREADDATA(3) option or it
30       will be NULL.
31
32       When this callback is invoked, the sts pointer points  to  a  populated
33       struct:  Copy the host name to 'name' (no longer than 'namelen' bytes).
34       Make it null-terminated. Set 'includeSubDomains' to TRUE or FALSE.  Set
35       'expire'  to  a date stamp or a zero length string for *forever* (wrong
36       date stamp format might cause the name to not get accepted)
37
38       The callback should return CURLSTS_OK if it returns a name and is  pre‐
39       pared  to  be called again (for another host) or CURLSTS_DONE if it has
40       no entry to return. It can also return CURLSTS_FAIL to signal error.
41
42       This option doesn't enable HSTS, you need to  use  CURLOPT_HSTS_CTRL(3)
43       to do that.
44

DEFAULT

46       NULL - no callback.
47

PROTOCOLS

49       This feature is only used for HTTP(S) transfer.
50

EXAMPLE

52       {
53         /* set HSTS read callback */
54         curl_easy_setopt(curl, CURLOPT_HSTSREADFUNCTION, hstsread);
55
56         /* pass in suitable argument to the callback */
57         curl_easy_setopt(curl, CURLOPT_HSTSREADDATA, &hstspreload[0]);
58
59         result = curl_easy_perform(curl);
60       }
61

AVAILABILITY

63       Added in 7.74.0
64

RETURN VALUE

66       This will return CURLE_OK.
67

SEE ALSO

69       CURLOPT_HSTSREADDATA(3), CURLOPT_HSTSWRITEFUNCTION(3), CURLOPT_HSTS(3),
70       CURLOPT_HSTS_CTRL(3),
71
72
73
74
75libcurl 7.76.1                 November 04, 2020   CURLOPT_HSTSREADFUNCTION(3)
Impressum