CURLOPT_HSTS.3 2.9 KB

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