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
12 close);
13
15 Pass a long. Set close to 1 to make libcurl explicitly close the con‐
16 nection when done with the transfer. Normally, libcurl keeps all con‐
17 nections alive when done with one transfer in case a succeeding one
18 follows that can re-use them. This option should be used with caution
19 and only if you understand what it does as it can seriously impact per‐
20 formance.
21
22 Set to 0 to have libcurl keep the connection open for possible later
23 re-use (default behavior).
24
26 0
27
29 Most
30
32 {
33 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
34 curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
35 curl_easy_perform(curl);
36
37 /* this second transfer may not reuse the same connection */
38 curl_easy_perform(curl);
39 }
40
42 Always
43
45 Returns CURLE_OK
46
48 CURLOPT_FRESH_CONNECT(3), CURLOPT_MAXCONNECTS(3),
49
50
51
52libcurl 7.71.1 May 31, 2017 CURLOPT_FORBID_REUSE(3)