CURLOPT_HSTS_CTRL.3 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_HSTS_CTRL 3 "January 02, 2023" "libcurl 7.88.1" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_HSTS_CTRL \- control HSTS behavior
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. #define CURLHSTS_ENABLE (1<<0)
  32. #define CURLHSTS_READONLYFILE (1<<1)
  33. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS_CTRL, long bitmask);
  34. .fi
  35. .SH DESCRIPTION
  36. HSTS (HTTP Strict Transport Security) means that an HTTPS server can instruct
  37. the client to not contact it again over clear-text HTTP for a certain period
  38. into the future. libcurl will then automatically redirect HTTP attempts to
  39. such hosts to instead use HTTPS. This is done by libcurl retaining this
  40. knowledge in an in-memory cache.
  41. Populate the long \fIbitmask\fP with the correct set of features to instruct
  42. libcurl how to handle HSTS for the transfers using this handle.
  43. .SH BITS
  44. .IP "CURLHSTS_ENABLE"
  45. Enable the in-memory HSTS cache for this handle.
  46. .IP "CURLHSTS_READONLYFILE"
  47. Make the HSTS file (if specified) read-only - makes libcurl not save the cache
  48. to the file when closing the handle.
  49. .SH DEFAULT
  50. 0. HSTS is disabled by default.
  51. .SH PROTOCOLS
  52. HTTPS and HTTP
  53. .SH EXAMPLE
  54. .nf
  55. CURL *curl = curl_easy_init();
  56. if(curl) {
  57. curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, (long)CURLHSTS_ENABLE);
  58. curl_easy_perform(curl);
  59. }
  60. .fi
  61. .SH AVAILABILITY
  62. Added in 7.74.0
  63. .SH RETURN VALUE
  64. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  65. .SH "SEE ALSO"
  66. .BR CURLOPT_HSTS "(3), " CURLOPT_CONNECT_TO "(3), " CURLOPT_RESOLVE "(3), "
  67. .BR CURLOPT_ALTSVC "(3), "