1CURLOPT_CA_CACHE_TIMEOUT(3)curl_easy_setopt optionsCURLOPT_CA_CACHE_TIMEOUT(3)
2
3
4
6 CURLOPT_CA_CACHE_TIMEOUT - life-time for cached certificate stores
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CA_CACHE_TIMEOUT, long age);
12
14 Pass a long, this sets the timeout in seconds. This tells libcurl the
15 maximum time any cached certificate store it has in memory may be kept
16 and reused for new connections. Once the timeout has expired, a subse‐
17 quent fetch requiring a certificate store will have to build a new one.
18
19 Building a certificate store from a CURLOPT_CAINFO file is a slow oper‐
20 ation so curl may cache the generated certificate store internally to
21 speed up future connections.
22
23 Set to zero to completely disable caching, or set to -1 to retain the
24 cached store remain forever. By default, libcurl caches this info for
25 24 hours.
26
28 86400 (24 hours)
29
31 All
32
34 CURL *curl = curl_easy_init();
35 if(curl) {
36 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
37
38 /* only reuse certificate stores for a short time */
39 curl_easy_setopt(curl, CURLOPT_CA_CACHE_TIMEOUT, 60L);
40
41 ret = curl_easy_perform(curl);
42
43 /* in this second request, the cache will not be used if more than
44 sixty seconds have passed since the previous connection */
45 ret = curl_easy_perform(curl);
46
47 curl_easy_cleanup(curl);
48 }
49
51 This option was added in curl 7.87.0.
52
53 Currently the only SSL backend to implement this certificate store
54 caching functionality is the OpenSSL (and forks) backend.
55
57 Returns CURLE_OK
58
60 CURLOPT_CAINFO(3), CURLOPT_CAINFO_BLOB(3), CURLOPT_CAPATH(3), CUR‐
61 LOPT_SSL_VERIFYPEER(3), CURLOPT_SSL_VERIFYHOST(3),
62
63
64
65libcurl 8.0.1 January 02, 2023 CURLOPT_CA_CACHE_TIMEOUT(3)