Name
easy:SetOpt_HSTSReadFunction -- read callback for HSTS hosts (V2.0)
Synopsis
easy:SetOpt_HSTSReadFunction(hstsread[, userdata])
Function
Pass a callback function. This callback function gets called by libcurl repeatedly when it populates the in-memory HSTS cache. If you pass the optional userdata argument, the value you pass in userdata will be passed to your callback function as a parameter. The userdata parameter can be of any type.

The callback function looks like this:

 
res, name, includeSubDomains, expire = hstsread([userdata])

You can see that your callback has to return four values:

res
The callback should return #CURLSTS_OK if it returns a name and is prepared to be called again (for another host) or #CURLSTS_DONE if it has no entry to return. It can also return #CURLSTS_FAIL to signal error. Returning #CURLSTS_FAIL will stop the transfer from being performed and make #CURLE_ABORTED_BY_CALLBACK get returned.

name
The host name.

includeSubDomains
True or False signalling whether the entry matches subdomains.

expire
An expire date stamp or a zero length string for forever. (wrong date stamp format might cause the name to not get accepted). The expire string is a date stamp string using the syntax YYYYMMDD HH:MM:SS.

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

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

Show TOC