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

NAME

6       CURLOPT_HSTS_CTRL - control HSTS behavior
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       #define CURLHSTS_ENABLE       (1<<0)
12       #define CURLHSTS_READONLYFILE (1<<1)
13
14       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS_CTRL, long bitmask);
15

DESCRIPTION

17       HSTS  (HTTP  Strict  Transport Security) means that an HTTPS server can
18       instruct the client to not contact it again over clear-text HTTP for  a
19       certain  period  into the future. libcurl will then automatically redi‐
20       rect HTTP attempts to such hosts to instead use HTTPS. This is done  by
21       libcurl retaining this knowledge in an in-memory cache.
22
23       Populate  the long bitmask with the correct set of features to instruct
24       libcurl how to handle HSTS for the transfers using this handle.
25

BITS

27       CURLHSTS_ENABLE
28              Enable the in-memory HSTS cache for this handle.
29
30       CURLHSTS_READONLYFILE
31              Make the HSTS file (if specified) read-only - makes libcurl  not
32              save the cache to the file when closing the handle.
33

DEFAULT

35       0. HSTS is disabled by default.
36

PROTOCOLS

38       HTTPS and HTTP
39

EXAMPLE

41       CURL *curl = curl_easy_init();
42       if(curl) {
43         curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
44         curl_easy_perform(curl);
45       }
46

AVAILABILITY

48       Added in 7.74.0
49

RETURN VALUE

51       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
52       if not.
53

SEE ALSO

55       CURLOPT_HSTS(3),   CURLOPT_CONNECT_TO(3),   CURLOPT_RESOLVE(3),    CUR‐
56       LOPT_ALTSVC(3),
57
58
59
60libcurl 7.85.0                   May 17, 2022             CURLOPT_HSTS_CTRL(3)
Impressum