CURLOPT_HSTS.3 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 2020 - 2021, 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. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_HSTS 3 "5 Feb 2019" "libcurl 7.74.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_HSTS \- HSTS cache file name
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS, char *filename);
  30. .fi
  31. .SH DESCRIPTION
  32. Make the \fIfilename\fP point to a file name to load an existing HSTS cache
  33. from, and to store the cache in when the easy handle is closed. Setting a file
  34. name with this option will also enable HSTS for this handle (the equivalent of
  35. setting \fICURLHSTS_ENABLE\fP with \fICURLOPT_HSTS_CTRL(3)\fP).
  36. If the given file does not exist or contains no HSTS entries at startup, the
  37. HSTS cache will simply start empty. Setting the file name to NULL or "" will
  38. only enable HSTS without reading from or writing to any file.
  39. If this option is set multiple times, libcurl will load cache entries from
  40. each given file but will only store the last used name for later writing.
  41. .SH "FILE FORMAT"
  42. The HSTS cache is saved to and loaded from a text file with one entry per
  43. physical line. Each line in the file has the following format:
  44. [host] [stamp]
  45. [host] is the domain name for the entry and the name is dot-prefixed if it is
  46. a includeSubDomain entry (if the entry is valid for all subdmains to the name
  47. as well or only for the exact name).
  48. [stamp] is the time (in UTC) when the entry expires and it uses the format
  49. \&"YYYYMMDD HH:MM:SS".
  50. Lines starting with "#" are treated as comments and are ignored. There is
  51. currently no length or size limit.
  52. .SH DEFAULT
  53. NULL, no file name
  54. .SH PROTOCOLS
  55. HTTPS and HTTP
  56. .SH EXAMPLE
  57. .nf
  58. CURL *curl = curl_easy_init();
  59. if(curl) {
  60. curl_easy_setopt(curl, CURLOPT_HSTS, "/home/user/.hsts-cache");
  61. curl_easy_perform(curl);
  62. }
  63. .fi
  64. .SH AVAILABILITY
  65. Added in 7.74.0
  66. .SH RETURN VALUE
  67. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  68. .SH "SEE ALSO"
  69. .BR CURLOPT_HSTS_CTRL "(3), " CURLOPT_ALTSVC "(3), " CURLOPT_RESOLVE "(3), "