CURLOPT_CA_CACHE_TIMEOUT.3 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .\" generated by cd2nroff 0.1 from CURLOPT_CA_CACHE_TIMEOUT.md
  2. .TH CURLOPT_CA_CACHE_TIMEOUT 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_CA_CACHE_TIMEOUT \- life\-time for cached certificate stores
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CA_CACHE_TIMEOUT, long age);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long, this sets the timeout in seconds. This tells libcurl the maximum
  12. time any cached CA certificate store it has in memory may be kept and reused
  13. for new connections. Once the timeout has expired, a subsequent fetch
  14. requiring a CA certificate has to reload it.
  15. Building a CA certificate store from a \fICURLOPT_CAINFO(3)\fP file is a slow
  16. operation so curl may cache the generated certificate store internally to
  17. speed up future connections.
  18. Set the timeout to zero to completely disable caching, or set to \-1 to retain
  19. the cached store remain forever. By default, libcurl caches this info for 24
  20. hours.
  21. .SH DEFAULT
  22. 86400 (24 hours)
  23. .SH PROTOCOLS
  24. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  25. This option works only with the following TLS backends:
  26. GnuTLS, OpenSSL, Schannel and wolfSSL
  27. .SH EXAMPLE
  28. .nf
  29. int main(void)
  30. {
  31. CURL *curl = curl_easy_init();
  32. if(curl) {
  33. CURLcode res;
  34. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
  35. /* only reuse certificate stores for a short time */
  36. curl_easy_setopt(curl, CURLOPT_CA_CACHE_TIMEOUT, 60L);
  37. res = curl_easy_perform(curl);
  38. /* in this second request, the cache is not used if more than
  39. sixty seconds passed since the previous connection */
  40. res = curl_easy_perform(curl);
  41. curl_easy_cleanup(curl);
  42. }
  43. }
  44. .fi
  45. .SH HISTORY
  46. This option is supported by OpenSSL and its forks (since 7.87.0), Schannel
  47. (since 8.5.0), wolfSSL (since 8.9.0) and GnuTLS (since 8.9.0).
  48. .SH AVAILABILITY
  49. Added in curl 7.87.0
  50. .SH RETURN VALUE
  51. Returns CURLE_OK
  52. .SH SEE ALSO
  53. .BR CURLOPT_CAINFO (3),
  54. .BR CURLOPT_CAINFO_BLOB (3),
  55. .BR CURLOPT_CAPATH (3),
  56. .BR CURLOPT_SSL_VERIFYHOST (3),
  57. .BR CURLOPT_SSL_VERIFYPEER (3)