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

NAME

6       CURLOPT_HSTS - HSTS cache file name
7

SYNOPSIS

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

DESCRIPTION

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

FILE FORMAT

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

DEFAULT

45       NULL, no file name
46

PROTOCOLS

48       HTTPS and HTTP
49

EXAMPLE

51       CURL *curl = curl_easy_init();
52       if(curl) {
53         curl_easy_setopt(curl, CURLOPT_HSTS, "/home/user/.hsts-cache");
54         curl_easy_perform(curl);
55       }
56

AVAILABILITY

58       Added in 7.74.0
59

RETURN VALUE

61       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
62       if not.
63

SEE ALSO

65       CURLOPT_HSTS_CTRL(3), CURLOPT_ALTSVC(3), CURLOPT_RESOLVE(3),
66
67
68
69libcurl 7.82.0                September 08, 2021               CURLOPT_HSTS(3)
Impressum