GNURLOPT_C...TIMEOUT_MS(3)
π NAME π
Okay so this is the GNURLOPT_C...TIMEOUT_MS(3) page from the curl_easy_setopt options manual, and it's all about CURLOPT_CONNECTTIMEOUT_MS β literally the timeout for the connect phase. π¦
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT_MS, long
timeout);
π DESCRIPTION π
You pass a long. It should contain the maximum time, in milliseconds, that you allow the connection phase to the server to take. This only limits the connection phase β it has no impact once it has connected. Set it to zero to switch to the default built-in connection timeout β 300 seconds. Also see the CURLOPT_TIMEOUT_MS(3) option, bestie.
In unix-like systems, this might cause signals to be used unless CURLOPT_NOSIGNAL(3) is set. Not me reminding you about signal vibes π.
If both CURLOPT_CONNECTTIMEOUT(3) and CURLOPT_CONNECTTIMEOUT_MS(3) are set, the value set last will be used. That's the rule, no cap.
πΈ DEFAULT πΈ
The default is literally 300000. Slay.
π¦ PROTOCOLS π¦
All β every protocol, periodt.
π₯ EXAMPLE π₯
Here's the iconic little example, bestie:
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* complete connection within 10000 milliseconds */
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 10000L);
curl_easy_perform(curl);
}
π AVAILABILITY π
Always β it's always there, iykyk.
π RETURN VALUE π
Returns CURLE_OK. That's it. Iconic.
π SEE ALSO π
That's the whole page, bestie π This one is from libcurl 7.37.0, dated 17 Jun 2014, and the manual name near the top was curl_easy_setopt options β okay bye, go set your timeouts responsibly π«Άβ¨
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, 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