GNURLOPT_FRESH_CONNECT(3)
π GNURLOPT_FRESH_CONNECT(3) π
okay so this is one of those curl_easy_setopt options from the gnurl/curl family β literally the friend that says "no, we're not reusing that connection, we're getting a FRESH one." it lives in the curl_easy_setopt options section of the manual, and bestie, it's a whole vibe. π¦
β¨ NAME β¨
CURLOPT_FRESH_CONNECT β force a new connection to be used. periodt. no hand-me-downs, no recycled sockets, brand new connection energy only π
πΈ SYNOPSIS πΈ
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FRESH_CONNECT, long
fresh);
π DESCRIPTION π
You pass a long, bestie. Set it to 1 and the next transfer gets a new (fresh) connection by force instead of trying to re-use an existing one. like, it's not asking politely, it's demanding a fresh one π
Also β real talk β this option should be used with caution and only if you understand what it does, because it may seriously impact performance. like, highkey devastating for your perf if you don't know what you're doing π
Related functionality is CURLOPT_FORBID_REUSE(3), which makes sure the connection is closed after use so that it won't be re-used. different vibe, complementary energy π«Ά
And if you set fresh to 0, you're telling libcurl to attempt re-using an existing connection (that's the default behavior β the chill, no-drama path β¨).
π DEFAULT π
0
(the re-use-friendly default, as it should be π)
π§ PROTOCOLS π§
Most
π₯ EXAMPLE π₯
{
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1L);
/* this transfer must use a new connection, not reuse an existing */
curl_easy_perform(curl);
}
look at that comment, it's literally narrating the assignment. iconic. β
π¦ AVAILABILITY π¦
Always β she's been here the whole time, no cap π
π RETURN VALUE π
Returns CURLE_OK
π SEE ALSO π
and that's the whole page, bestie!! π written under the libcurl 7.37.0 banner, dated 17 Jun 2014, in the GNURLOPT_FRESH_CONNECT(3) section of the gnurl curl_easy_setopt options manual. go forth and force your fresh connections responsibly πβ¨π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms