1CURLOPT_HSTS(3)            curl_easy_setopt options            CURLOPT_HSTS(3)
2
3
4

NAME

6       CURLOPT_HSTS - set HSTS cache file name
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS, char *filename);
12

EXPERIMENTAL

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

DESCRIPTION

20       Make the filename point to a file name to load an existing  HSTS  cache
21       from, and to store the cache in when the easy handle is closed. Setting
22       a file name with this option will also enable HSTS for this handle (the
23       equivalent of setting CURLHSTS_ENABLE with CURLOPT_HSTS_CTRL(3)).
24
25       If  the  given  file  does  not  exist  or  contains no HSTS entries at
26       startup, the HSTS cache will simply start empty. Setting the file  name
27       to  NULL or "" will only enable HSTS without reading from or writing to
28       any file.
29
30       If this option is set multiple times, libcurl will load  cache  entries
31       from  each  given file but will only store the last used name for later
32       writing.
33

FILE FORMAT

35       The HSTS cache is saved to and loaded from a text file with  one  entry
36       per physical line. Each line in the file has the following format:
37
38       [host] [stamp]
39
40       [host] is the domain name for the entry and the name is dot-prefixed if
41       it is a includeSubDomain entry (if the entry is valid for all subdmains
42       to the name as well or only for the exact name).
43
44       [stamp]  is  the  time  (in UTC) when the entry expires and it uses the
45       format "YYYYMMDD HH:MM:SS".
46
47       Lines starting with "#" are treated as comments and are ignored.  There
48       is currently no length or size limit.
49

DEFAULT

51       NULL, no file name
52

PROTOCOLS

54       HTTPS and HTTP
55

EXAMPLE

57       CURL *curl = curl_easy_init();
58       if(curl) {
59         curl_easy_setopt(curl, CURLOPT_HSTS, "/home/user/.hsts-cache");
60         curl_easy_perform(curl);
61       }
62

AVAILABILITY

64       Added in 7.74.0
65

RETURN VALUE

67       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
68       if not.
69

SEE ALSO

71       CURLOPT_HSTS_CTRL(3), CURLOPT_ALTSVC(3), CURLOPT_RESOLVE(3),
72
73
74
75libcurl 7.76.1                 November 13, 2020               CURLOPT_HSTS(3)
Impressum