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
12 fresh);
13
15 Pass a long. Set to 1 to make the next transfer use a new (fresh) con‐
16 nection by force instead of trying to re-use an existing one. This
17 option should be used with caution and only if you understand what it
18 does as it may seriously impact performance.
19
20 Related functionality is CURLOPT_FORBID_REUSE(3) which makes sure the
21 connection is closed after use so that it won't be re-used.
22
23 Set fresh to 0 to have libcurl attempt re-using an existing connection
24 (default behavior).
25
27 0
28
30 Most
31
33 {
34 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
35 curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1L);
36 /* this transfer must use a new connection, not reuse an existing */
37 curl_easy_perform(curl);
38 }
39
41 Always
42
44 Returns CURLE_OK
45
47 CURLOPT_FORBID_REUSE(3),
48
49
50
51libcurl 7.61.1 May 31, 2017 CURLOPT_FRESH_CONNECT(3)