GNURLOPT_FORBID_REUSE(3)
πΈ 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
- 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