1CURLOPT_FORBID_REUSE(3) curl_easy_setopt options CURLOPT_FORBID_REUSE(3)
2
3
4
6 CURLOPT_FORBID_REUSE - make connection get closed at once after use
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FORBID_REUSE, long close);
12
14 Pass a long. Set close to 1 to make libcurl explicitly close the con‐
15 nection when done with the transfer. Normally, libcurl keeps all con‐
16 nections alive when done with one transfer in case a succeeding one
17 follows that can re-use them. This option should be used with caution
18 and only if you understand what it does as it can seriously impact per‐
19 formance.
20
21 Set to 0 to have libcurl keep the connection open for possible later
22 re-use (default behavior).
23
25 0
26
28 Most
29
31 {
32 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
33 curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
34 curl_easy_perform(curl);
35
36 /* this second transfer may not reuse the same connection */
37 curl_easy_perform(curl);
38 }
39
41 Always
42
44 Returns CURLE_OK
45
47 CURLOPT_FRESH_CONNECT(3), CURLOPT_MAXCONNECTS(3), CURLOPT_MAXLIFE‐
48 TIME_CONN(3),
49
50
51
52libcurl 7.85.0 May 17, 2022 CURLOPT_FORBID_REUSE(3)