GNURLOPT_FORBID_REUSE(3)

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

🌸 GNURLOPT_FORBID_REUSE(3) 🌸

okay bestie, welcome to the curl_easy_setopt options corner β€” this page is GNURLOPT_FORBID_REUSE(3), and the whole vibe is β€œclose that connection at once after use.” πŸ’… no cap.


πŸ’– NAME πŸ’–

CURLOPT_FORBID_REUSE β€” make connection get closed at once after use.

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FORBID_REUSE, long
close);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first thing: pass a long. Set close to 1 and libcurl will explicitly close the connection when it’s done with the transfer. Normally, libcurl keeps all connections alive when it’s done with one transfer, in case a succeeding one follows that can re-use them. πŸ‘€

⚠️ real talk: this option should be used with caution and only if you understand what it does β€” it can seriously impact performance. Don’t just flip it on for funsies, bestie.

Set it to 0 and libcurl keeps the connection open for possible later re-use β€” that’s the default behavior. πŸ’–

πŸŽ€ DEFAULT πŸŽ€

0 β€” the default is literally keep the connection open for possible later re-use.

🌈 PROTOCOLS 🌈

Most β€” that’s it, that’s the protocol note. periodt.

πŸ”₯ EXAMPLE πŸ”₯

here’s the exact code vibe, no cap:

{
  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
  curl_easy_perform(curl);

  /* this second transfer may not reuse the same connection */
  curl_easy_perform(curl);
}

⭐ AVAILABILITY ⭐

Always β€” she’s always available. ✨

πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK β€” that’s the whole note.

🫢 SEE ALSO 🫢

go sip these cross-references, iykyk:


xoxo, your Unix bestie πŸ’… β€” this page is from libcurl 7.37.0, dated 17 Jun 2014, and its manual name is GNURLOPT_FORBID_REUSE(3). πŸŽ€

πŸ“¦ where this page comes from