curl_multi_setopt(3)
π curl_multi_setopt(3) β setting options for a curl multi handle
okay so this is a libcurl manpage, bestie β Library Functions Manual energy, and it's literally all about making your multi handle behave the way you want. sit down, grab a strawberry drink π, we're doing this.
β¨ NAME β¨
curl_multi_setopt β set options for a curl multi handle. that's it, that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLMcode curl_multi_setopt(CURLM *multi, CURLMoption option, parameter);
like, you pass the multi handle, you pass the option, you pass the parameter. iconic signature, no notes. π
π¦ DESCRIPTION π¦
curl_multi_setopt(3) is how you tell a libcurl multi handle how to act. you use the right options and suddenly you're changing libcurl's behavior for that specific multi handle β main character energy for real. β¨
every option gets set with the option followed by its parameter. and the parameter? it's not one thing, bestie, it depends on which option you're using:
- a
long - a function pointer
- an object pointer
- or a
curl_off_t
depending on what that specific option expects. so like, read this manual carefully β ngl bad input values may cause libcurl to behave badly, and we do not want that for you. π
also important: you can only set one option in each function call. one option per call, periodt. π
π OPTIONS π
here's the full roster, alphabetical, no skips, no cuts:
CURLMOPT_CHUNK_LENGTH_PENALTY_SIZEβ deprecated π seeCURLMOPT_CHUNK_LENGTH_PENALTY_SIZE(3)CURLMOPT_CONTENT_LENGTH_PENALTY_SIZEβ deprecated π seeCURLMOPT_CONTENT_LENGTH_PENALTY_SIZE(3)CURLMOPT_MAXCONNECTSβ size of connection cache. seeCURLMOPT_MAXCONNECTS(3)CURLMOPT_MAX_CONCURRENT_STREAMSβ max concurrent streams for http2. seeCURLMOPT_MAX_CONCURRENT_STREAMS(3)CURLMOPT_MAX_HOST_CONNECTIONSβ max number of connections to a single host. seeCURLMOPT_MAX_HOST_CONNECTIONS(3)CURLMOPT_MAX_PIPELINE_LENGTHβ deprecated. seeCURLMOPT_MAX_PIPELINE_LENGTH(3)πCURLMOPT_MAX_TOTAL_CONNECTIONSβ max simultaneously open connections. seeCURLMOPT_MAX_TOTAL_CONNECTIONS(3)CURLMOPT_NETWORK_CHANGEDβ signal that the network has changed. seeCURLMOPT_NETWORK_CHANGED(3)CURLMOPT_NOTIFYDATAβ custom pointer passed to the notify callback. seeCURLMOPT_NOTIFYDATA(3)CURLMOPT_NOTIFYFUNCTIONβ callback that receives notifications. seeCURLMOPT_NOTIFYFUNCTION(3)CURLMOPT_PIPELININGβ enable HTTP multiplexing. seeCURLMOPT_PIPELINING(3)CURLMOPT_PIPELINING_SERVER_BLβ deprecated. seeCURLMOPT_PIPELINING_SERVER_BL(3)πCURLMOPT_PIPELINING_SITE_BLβ deprecated. seeCURLMOPT_PIPELINING_SITE_BL(3)πCURLMOPT_PUSHDATAβ pointer to pass to push callback. seeCURLMOPT_PUSHDATA(3)CURLMOPT_PUSHFUNCTIONβ callback that approves or denies server pushes. seeCURLMOPT_PUSHFUNCTION(3)CURLMOPT_SOCKETDATAβ custom pointer passed to the socket callback. seeCURLMOPT_SOCKETDATA(3)CURLMOPT_SOCKETFUNCTIONβ callback informed about what to wait for. seeCURLMOPT_SOCKETFUNCTION(3)CURLMOPT_TIMERDATAβ custom pointer to pass to timer callback. seeCURLMOPT_TIMERDATA(3)CURLMOPT_TIMERFUNCTIONβ callback to receive timeout values. seeCURLMOPT_TIMERFUNCTION(3)
π PROTOCOLS π
this functionality affects all supported protocols. all of them. every single one. we love an inclusive queen. π
π EXAMPLE π
okay here's a whole little program, and yes we're limiting the simultaneous connections because that's just good manners:
#define MAX_PARALLEL 45
int main(void)
{
CURLM *multi = curl_multi_init();
/* Limit the amount of simultaneous connections curl should allow: */
curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, (long)MAX_PARALLEL);
}
MAX_PARALLEL is 45, in case you were wondering. it's giving "I set boundaries." π«Ά
β AVAILABILITY β
added in curl 7.15.4. vintage but still serving. β¨
π₯ RETURN VALUE π₯
this function returns a CURLMcode indicating success or error.
CURLM_OK(0) β everything was OK, slay π- non-zero β an error occurred, see
libcurl-errors(3)
small but crucial note: it returns a CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl does not know of. so like, vibe check your libcurl version first, bestie. π
π§ SEE ALSO π§
curl_multi_cleanup(3), curl_multi_info_read(3), curl_multi_init(3), curl_multi_socket(3)
and that's the whole page, no cap. go forth and set exactly one option per call π
β with love from the libcurl girlies, dated 2026-10-12 π¦ (yes the source line said libcurl, yes it said 2026-10-12, and yes I remembered it for you π«Ά)
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms