GNURLOPT_FRESH_CONNECT(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… 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