Name
easy:SetOpt_HSTSWriteFunction -- write callback for HSTS hosts (V2.0)
Synopsis
easy:SetOpt_HSTSWriteFunction(hstswrite[, userdata])
Function
Pass a callback function. This callback function gets called by libcurl repeatedly to allow the application to store the in-memory HSTS cache when libcurl is about to discard it.

The callback function receives two parameters. If you pass the optional userdata argument, the value you pass in userdata will be passed to your callback function as a third parameter. The userdata parameter can be of any type.

The callback function looks like this:

 
res = hstswrite(sts, count[, userdata])

The first two parameters are tables. The sts table contains the following fields:

Name
The host name.
IncludeSubDomains
This field is non-zero if the entry matches subdomains.
Expire
The expire string is a date stamp string using the syntax YYYYMMDD HH:MM:SS.

The count table contains the following fields:

Index
The provided entry's index or count.
Total
Total number of entries to save.

The callback should return #CURLSTS_OK if it succeeded and is prepared to be called again (for another host) or #CURLSTS_DONE if there's nothing more to do. It can also return #CURLSTS_FAIL to signal error.

This option does not enable HSTS, you need to use #CURLOPT_HSTS_CTRL to do that.

Inputs
hstswrite
callback function
userdata
optional: user data to pass to callback function

Show TOC