GNURLOPT_MAXCONNECTS(3)
π GNURLOPT_MAXCONNECTS(3) π
okay so bestie, this page is from the curl_easy_setopt options manual (manual name folded in near the top, as requested π), and it's lowkey just about setting the maximum connection cache size. no cap. the way that connection pools have main character energy π
β¨ NAME β¨
CURLOPT_MAXCONNECTS β maximum connection cache size. it's giving βhow many persistent connections can we keep cached?β π«Ά
πΈ SYNOPSIS πΈ
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXCONNECTS, long amount);
π¦ DESCRIPTION π¦
okay so you pass a long, bestie. the amount you set is literally the maximum number of simultaneously open persistent connections that libcurl may cache in the pool associated with this handle. pool party, but make it connection-cache. π«Ά
the default is 5, and ngl there isn't much point in changing this value unless you are perfectly aware of how this works and changes libcurl's behaviour. like, fully clued in. periodt. this concerns connections using any of the protocols that support persistent connections.
when reaching the maximum limit, curl closes the oldest one in the cache to prevent increasing the number of open connections. oldest connection gets the goodbye text π
if you already have performed transfers with this curl handle, setting a smaller CURLOPT_MAXCONNECTS(3) than before may cause open connections to get closed unnecessarily. so maybe don't casually shrink it mid-vibe, bestie. π
multi-handle plot twist: if you add this easy handle to a multi handle, this setting is not acknowledged, and you must instead usecurl_multi_setopt(3)and theCURLMOPT_MAXCONNECTS(3)option. iykyk.
π DEFAULT π
5 fr fr.
π PROTOCOLS π
Most.
π§ EXAMPLE π§
this example is iconic, honestly π₯
CURL *curl = curl_easy_init();
if(curl) {
CURLcode ret;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
/* limit the connection cache for this handle to no more than 3 */
curl_easy_setopt(curl, CURLOPT_MAXCONNECTS, 3L);
ret = curl_easy_perform(curl);
}
π AVAILABILITY π
Always.
β RETURN VALUE β
Returns CURLE_OK. vibe check passed, bestie.
π SEE ALSO π
okay that's the page, bestie π β footer tea: source/version libcurl 7.37.0, date 17 Jun 2014, and the page is GNURLOPT_MAXCONNECTS(3). mwah, slay, bye. π
π¦ 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