CURLOPT_HSTS_CTRL.3 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .\" generated by cd2nroff 0.1 from CURLOPT_HSTS_CTRL.md
  2. .TH CURLOPT_HSTS_CTRL 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_HSTS_CTRL \- control HSTS behavior
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. #define CURLHSTS_ENABLE (1<<0)
  9. #define CURLHSTS_READONLYFILE (1<<1)
  10. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS_CTRL, long bitmask);
  11. .fi
  12. .SH DESCRIPTION
  13. HSTS (HTTP Strict Transport Security) means that an HTTPS server can instruct
  14. the client to not contact it again over clear\-text HTTP for a certain period
  15. into the future. libcurl then automatically redirects HTTP attempts to such
  16. hosts to instead use HTTPS. This is done by libcurl retaining this knowledge
  17. in an in\-memory cache.
  18. Populate the long \fIbitmask\fP with the correct set of features to instruct
  19. libcurl how to handle HSTS for the transfers using this handle.
  20. .SH BITS
  21. .IP CURLHSTS_ENABLE
  22. Enable the in\-memory HSTS cache for this handle.
  23. .IP CURLHSTS_READONLYFILE
  24. Make the HSTS file (if specified) read\-only \- makes libcurl not save the cache
  25. to the file when closing the handle.
  26. .SH DEFAULT
  27. 0
  28. .SH PROTOCOLS
  29. This functionality affects http only
  30. .SH EXAMPLE
  31. .nf
  32. int main(void)
  33. {
  34. CURL *curl = curl_easy_init();
  35. if(curl) {
  36. curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, (long)CURLHSTS_ENABLE);
  37. curl_easy_perform(curl);
  38. }
  39. }
  40. .fi
  41. .SH AVAILABILITY
  42. Added in curl 7.74.0
  43. .SH RETURN VALUE
  44. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  45. .SH SEE ALSO
  46. .BR CURLOPT_ALTSVC (3),
  47. .BR CURLOPT_CONNECT_TO (3),
  48. .BR CURLOPT_HSTS (3),
  49. .BR CURLOPT_RESOLVE (3)