1CURLOPT_MAXAGE_CONN(3)     curl_easy_setopt options     CURLOPT_MAXAGE_CONN(3)
2
3
4

NAME

6       CURLOPT_MAXAGE_CONN - max idle time allowed for reusing a connection
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_easy_setopt(CURL *handle, CURLOPT_MAXAGE_CONN, long max‐
12       age);
13

DESCRIPTION

15       Pass a long as parameter containing maxage - the maximum time  in  sec‐
16       onds that you allow an existing connection to have to be considered for
17       reuse for this request.
18
19       The "connection cache" that holds previously used connections.  When  a
20       new request is to be done, it will consider any connection that matches
21       for reuse. The CURLOPT_MAXAGE_CONN(3) limit prevents libcurl from  try‐
22       ing  very  old connections for reuse, since old connections have a high
23       risk of not working and thus trying them  is  a  performance  loss  and
24       sometimes service loss due to the difficulties to figure out the situa‐
25       tion. If a connection is found in the cache that is older than this set
26       maxage, it will instead be closed.
27

DEFAULT

29       Default maxage is 118 seconds.
30

PROTOCOLS

32       All
33

EXAMPLE

35       CURL *curl = curl_easy_init();
36       if(curl) {
37         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
38
39         /* only allow 30 seconds idle time */
40         curl_easy_setopt(curl, CURLOPT_MAXAGE_CONN, 30L);
41
42         curl_easy_perform(curl);
43       }
44

AVAILABILITY

46       Added in libcurl 7.65.0
47

RETURN VALUE

49       Returns CURLE_OK.
50

SEE ALSO

52       CURLOPT_TIMEOUT(3), CURLOPT_FORBID_REUSE(3), CURLOPT_FRESH_CONNECT(3),
53
54
55
56libcurl 7.71.1                  April 14, 2019          CURLOPT_MAXAGE_CONN(3)
Impressum