GNURLOPT_C...TIMEOUT_MS(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… 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