CURLOPT_HSTS.3 3.2 KB

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