GNURLMOPT_...ONNECTIONS(3)
okay so bestie, welcome to GNURLMOPT_...ONNECTIONS(3) from the curl_multi_setopt options manual β today's main character is CURLMOPT_MAX_HOST_CONNECTIONS π
β¨
π NAME π
CURLMOPT_MAX_HOST_CONNECTIONS β set max number of connections to a single host. That's the whole name vibe, no cap.
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLMcode curl_multi_setopt(CURLM *handle,
CURLMOPT_MAX_HOST_CONNECTIONS, long max);
That's the little spell you cast, bestie πͺ
π¦ DESCRIPTION π¦
Pass a long to indicate max. That number becomes the maximum amount of simultaneously open connections to a single host β and yes, a host here is the same as a host name + port number pair, periodt.
For each new session to a host, libcurl will open a new connection up to the limit set by CURLMOPT_MAX_HOST_CONNECTIONS(3). When the limit is reached, the sessions will be pending until a connection becomes available. If CURLMOPT_PIPELINING(3) is enabled, libcurl will try to pipeline if the host is capable of it. slay π₯
The default max value is 0, unlimited. BUT β backwards compatibility era, so listen: setting it to 0 when CURLMOPT_PIPELINING(3) is 1 will not be treated as unlimited. Instead it will open only 1 connection and try to pipeline on it. That's the plot twist, iykyk π
This set limit is also used for proxy connections, and then the proxy is considered to be the host for which this limit counts. proxy said "I'm the main character now" π
π DEFAULT π
0
πΈ PROTOCOLS πΈ
HTTP(S)
π§ EXAMPLE π§
CURLM *m = curl_multi_init();
/* do no more than 2 connections per host */
curl_multi_setopt(m, CURLMOPT_MAX_HOST_CONNECTIONS, 2L);
β AVAILABILITY β
Added in 7.30.0. vintage-ish but still iconic β¨
π RETURN VALUE π
Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. basically a vibe check, CURLMcode style π
π SEE ALSO π
CURLMOPT_MAXCONNECTS(3)CURLMOPT_MAX_TOTAL_CONNECTIONS(3), (yes the original has a trailing comma, bestie β we respect the lore π«Ά)
And that's the whole page. Cute sign-off time: this cutie is from libcurl 7.37.0, dated 17 Jun 2014, page tag GNURLMOPT_...ONNECTIONS(3) β mwah πβ¨
π¦ 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