CURLOPT_QUICK_EXIT(3)

πŸ’… CURLOPT_QUICK_EXIT

okay so bestie, this one's from the libcurl crew β€” it lives in the Library Functions Manual section, and it's genuinely one of those tiny options that saves your whole vibe when you're bailing out of a program. no cap. 🫢


✨ NAME ✨

CURLOPT_QUICK_EXIT β€” literally just lets libcurl dip out fast πŸ’¨


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUICK_EXIT,
                          long value);

πŸŽ€ DESCRIPTION πŸŽ€

So you pass a long as the parameter, and when it's 1L it means: when libcurl is recovering from a timeout, skip the lengthy cleanups. Those cleanups exist to avoid all kinds of leaks (threads and stuff, iykyk), but here's the thing β€” the caller program is about to call exit() anyway, so who even cares 😭

This is what gives you a swift termination after, say, a DNS timeout β€” by canceling and/or forgetting about a resolver thread. iconic behaviour, honestly. the trade-off? a possible (though short-lived) leak of associated resources. so like… a tiny mess, but it's not gonna linger. πŸ™ˆ


⭐ DEFAULT ⭐

0


πŸ¦‹ PROTOCOLS πŸ¦‹

This functionality affects all supported protocols β€” every single one, bestie. πŸ‘‘


πŸ”₯ EXAMPLE πŸ”₯

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_QUICK_EXIT, 1L);
    result = curl_easy_perform(curl);
  }
}

🌈 AVAILABILITY 🌈

Added in curl 7.87.0 β€” so if your curl is older than that, this option is a no-show, sorry babe πŸ’€


πŸ’œ RETURN VALUE πŸ’œ

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK bestie πŸŽ‰ β€” non-zero means an error occurred, so go check libcurl-errors(3).


🌸 SEE ALSO 🌸


k that's the whole page, mwah πŸ’‹ β€” brought to you by libcurl, dated 2026-10-12, straight out of the CURLOPT_QUICK_EXIT(3) manual. go forth and exit quickly, queen πŸ§šβ€β™€οΈβœ¨

πŸ“¦ where this page comes from