CURLOPT_CA_CACHE_TIMEOUT.3 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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_CA_CACHE_TIMEOUT 3 "January 02, 2023" "libcurl 7.88.1" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_CA_CACHE_TIMEOUT \- life-time for cached certificate stores
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CA_CACHE_TIMEOUT, long age);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a long, this sets the timeout in seconds. This tells libcurl the maximum
  35. time any cached certificate store it has in memory may be kept and reused for
  36. new connections. Once the timeout has expired, a subsequent fetch requiring a
  37. certificate store will have to build a new one.
  38. Building a certificate store from a \fICURLOPT_CAINFO\fP file is a slow
  39. operation so curl may cache the generated certificate store internally to speed
  40. up future connections.
  41. Set to zero to completely disable caching, or set to -1 to retain the cached
  42. store remain forever. By default, libcurl caches this info for 24 hours.
  43. .SH DEFAULT
  44. 86400 (24 hours)
  45. .SH PROTOCOLS
  46. All
  47. .SH EXAMPLE
  48. .nf
  49. CURL *curl = curl_easy_init();
  50. if(curl) {
  51. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
  52. /* only reuse certificate stores for a short time */
  53. curl_easy_setopt(curl, CURLOPT_CA_CACHE_TIMEOUT, 60L);
  54. ret = curl_easy_perform(curl);
  55. /* in this second request, the cache will not be used if more than
  56. sixty seconds have passed since the previous connection */
  57. ret = curl_easy_perform(curl);
  58. curl_easy_cleanup(curl);
  59. }
  60. .fi
  61. .SH AVAILABILITY
  62. This option was added in curl 7.87.0.
  63. Currently the only SSL backend to implement this certificate store caching
  64. functionality is the OpenSSL (and forks) backend.
  65. .SH RETURN VALUE
  66. Returns CURLE_OK
  67. .SH "SEE ALSO"
  68. .BR CURLOPT_CAINFO "(3), "
  69. .BR CURLOPT_CAINFO_BLOB "(3), " CURLOPT_CAPATH "(3), "
  70. .BR CURLOPT_SSL_VERIFYPEER "(3), " CURLOPT_SSL_VERIFYHOST "(3), "