CURLMOPT_QUICK_EXIT(3)

πŸ“¦
version 8.23.0 Β· 5 versions
, in alpine 3.23, alpine 3.24

πŸ’… CURLMOPT_QUICK_EXIT β€” girl, just leave already πŸƒβ€β™€οΈπŸ’¨

okay so bestie, this is a page out of the Library Functions Manual and it's about one very specific little multi-handle option. real niche. real useful. let's get into it 🫢


✨ NAME ✨

CURLOPT_QUICK_EXIT β€” literally just lets libcurl dip out fast πŸƒβ€β™€οΈ (yes, the manpage's NAME section says CURLOPT_QUICK_EXIT and I'm not gonna gaslight you by "fixing" it β€” that's what's written, so that's what you get πŸ’–)


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_QUICK_EXIT,
                            long value);

πŸ¦‹ DESCRIPTION πŸ¦‹

So you pass a long in as the parameter, right? If that long is 1L, here's the vibe: when libcurl is recovering from a timeout, it's supposed to do all these lengthy cleanups whose whole personality is "we must avoid every kind of leak (threads, etc.)". But with 1L, it skips all that. Because β€” and this is the whole point β€” your caller program is about to call exit() anyway. like. it's over. why are we tidying the apartment when the building's getting demolished 😭

This gets you a swift termination after, say, a DNS timeout β€” by canceling and/or forgetting about a resolver thread. The trade-off? A possible (though short-lived) leak of associated resources. so yeah, tiny mess, but only for a sec 🫢


πŸŽ€ DEFAULT πŸŽ€

20.

that's what the page says, bestie. I'm not gonna editorialize about it. 20. periodt πŸ’…

🌈 PROTOCOLS 🌈

This functionality affects all supported protocols. every single one. no gatekeeping πŸ‘‘


πŸ“ EXAMPLE πŸ“

int main(void)
{
  CURLM *m = curl_multi_init();
  /* do not join threads when cleaning up this multi handle */
  curl_multi_setopt(m, CURLMOPT_QUICK_EXIT, 1L);
}

see that comment? /* do not join threads when cleaning up this multi handle */ β€” that's the whole mood. no thread-joining today, we got places to be πŸ’¨


⭐ AVAILABILITY ⭐

Added in curl 8.20.0. if you're on anything older, this option simply does not exist for you, sorry babe πŸ™ˆ


πŸ’œ RETURN VALUE πŸ’œ

curl_multi_setopt(3) returns a CURLMcode telling you success or error.

  • CURLM_OK (0) β€” everything was OK. we ate. πŸ’…
  • non-zero β€” an error happened 😭

for the full lore on the error codes, see libcurl-errors(3).


🧚 SEE ALSO 🧚


okay that's the whole page, you're basically an expert now 🌟 and for the receipts: this was written for libcurl, dated 2026-10-25, and the manual page is CURLMOPT_QUICK_EXIT(3) β€” same as when we started, but 100% more fun. byeee πŸŽ€πŸ’–πŸ”₯

πŸ“¦ where this page comes from