1CURLOPT_HSTS_CTRL(3) curl_easy_setopt options CURLOPT_HSTS_CTRL(3)
2
3
4
6 CURLOPT_HSTS_CTRL - control HSTS behavior
7
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
17 Warning: this feature is early code and is marked as experimental. It
18 can only be enabled by explicitly telling configure with --enable-hsts.
19 You are advised to not ship this in production before the experimental
20 label is removed.
21
23 HSTS (HTTP Strict Transport Security) means that an HTTPS server can
24 instruct the client to not contact it again over clear-text HTTP for a
25 certain period into the future. libcurl will then automatically redi‐
26 rect HTTP attempts to such hosts to instead use HTTPS. This is done by
27 libcurl retaining this knowledge in an in-memory cache.
28
29 Populate the long bitmask with the correct set of features to instruct
30 libcurl how to handle HSTS for the transfers using this handle.
31
33 CURLHSTS_ENABLE
34 Enable the in-memory HSTS cache for this handle.
35
36 CURLHSTS_READONLYFILE
37 Make the HSTS file (if specified) read-only - makes libcurl not
38 save the cache to the file when closing the handle.
39
41 0. HSTS is disabled by default.
42
44 HTTPS and HTTP
45
47 CURL *curl = curl_easy_init();
48 if(curl) {
49 curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
50 curl_easy_perform(curl);
51 }
52
54 Added in 7.74.0
55
57 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
58 if not.
59
61 CURLOPT_HSTS(3), CURLOPT_CONNECT_TO(3), CURLOPT_RESOLVE(3), CUR‐
62 LOPT_ALTSVC(3),
63
64
65
66libcurl 7.76.1 November 04, 2020 CURLOPT_HSTS_CTRL(3)