1CURLOPT_FRESH_CONNECT(3) curl_easy_setopt options CURLOPT_FRESH_CONNECT(3)
2
3
4
6 CURLOPT_FRESH_CONNECT - force a new connection to be used
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FRESH_CONNECT, long fresh);
12
14 Pass a long. Set to 1 to make the next transfer use a new (fresh) con‐
15 nection by force instead of trying to re-use an existing one. This op‐
16 tion should be used with caution and only if you understand what it
17 does as it may seriously impact performance.
18
19 Related functionality is CURLOPT_FORBID_REUSE(3) which makes sure the
20 connection is closed after use so that it will not be re-used.
21
22 Set fresh to 0 to have libcurl attempt re-using an existing connection
23 (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_FRESH_CONNECT, 1L);
35 /* this transfer must use a new connection, not reuse an existing */
36 curl_easy_perform(curl);
37 }
38
40 Always
41
43 Returns CURLE_OK
44
46 CURLOPT_FORBID_REUSE(3),
47
48
49
50libcurl 8.0.1 January 02, 2023 CURLOPT_FRESH_CONNECT(3)