1CURLOPT_UPKEEP_INTERVAL_MS(3c)url_easy_setopt optionCsURLOPT_UPKEEP_INTERVAL_MS(3)
2
3
4
6 CURLOPT_UPKEEP_INTERVAL_MS - connection upkeep interval
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPKEEP_INTERVAL_MS,
12 long upkeep_interval_ms);
13
15 Some protocols have "connection upkeep" mechanisms. These mechanisms
16 usually send some traffic on existing connections in order to keep them
17 alive; this can prevent connections from being closed due to overzeal‐
18 ous firewalls, for example.
19
20 The user needs to explicitly call curl_easy_upkeep(3) in order to per‐
21 form the upkeep work.
22
23 Currently the only protocol with a connection upkeep mechanism is
24 HTTP/2: when the connection upkeep interval is exceeded and
25 curl_easy_upkeep(3) is called, an HTTP/2 PING frame is sent on the con‐
26 nection.
27
28
30 CURL_UPKEEP_INTERVAL_DEFAULT (currently defined as 60000L, which is 60
31 seconds)
32
34 CURL *curl = curl_easy_init();
35 if(curl) {
36 /* Make a connection to an HTTP/2 server. */
37 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
38
39 /* Set the interval to 30000ms / 30s */
40 curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L);
41
42 curl_easy_perform(curl);
43
44 /* Perform more work here. */
45
46 /* While the connection is being held open, curl_easy_upkeep() can be
47 called. If curl_easy_upkeep() is called and the time since the last
48 upkeep exceeds the interval, then an HTTP/2 PING is sent. */
49 curl_easy_upkeep(curl);
50
51 /* Perform more work here. */
52
53 /* always cleanup */
54 curl_easy_cleanup(curl);
55 }
56
58 Added in 7.62.0
59
61 Returns CURLE_OK
62
63
64
65libcurl 7.76.1 November 04, 2020 CURLOPT_UPKEEP_INTERVAL_MS(3)