CURLOPT_SERVER_RESPONSE_TIMEOUT(3)

πŸ’… CURLOPT_SERVER_RESPONSE_TIMEOUT(3) πŸ’…

okay bestie, so this is a page from the Library Functions Manual and it's literally about the CURLOPT_SERVER_RESPONSE_TIMEOUT option β€” no cap, it's the time you're allowed to wait for a server response ✨


πŸŽ€ NAME πŸŽ€

CURLOPT_SERVER_RESPONSE_TIMEOUT β€” how long you're allowed to sit there waiting for a server to respond, basically the "how long do I leave them on read" setting 😭


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVER_RESPONSE_TIMEOUT,
                          long timeout);

🌸 DESCRIPTION 🌸

okay so you pass a long here. it tells libcurl: after you've sent a command, don't wait longer than timeout seconds for a response πŸ•. if nothing comes back within that window, the connection is considered dead and the transfer fails β€” like, fully over, the vibe check did not pass πŸ’€.

and listen, if you're also using CURLOPT_TIMEOUT(3), the recommendation is to set CURLOPT_SERVER_RESPONSE_TIMEOUT(3) to something smaller than CURLOPT_TIMEOUT(3). nesting those timeouts correctly is the move 🫢


πŸ‘‘ DEFAULT πŸ‘‘

60 seconds ⏳ (yes, a whole minute, she's patient)


🌈 PROTOCOLS 🌈

this functionality affects ftp, imap, pop3, scp, sftp and smtp πŸ¦‹


πŸ“ EXAMPLE πŸ“

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/slow.txt");
    /* wait no more than 23 seconds */
    curl_easy_setopt(curl, CURLOPT_SERVER_RESPONSE_TIMEOUT, 23L);
    result = curl_easy_perform(curl);

    curl_easy_cleanup(curl);
  }
}

look at her go, setting the timeout to 23L because 23 is that number πŸ’–


🧚 HISTORY 🧚

this option was formerly known as CURLOPT_FTP_RESPONSE_TIMEOUT β€” she rebranded, iconic behavior πŸ‘‘


⭐ AVAILABILITY ⭐

added in curl 7.20.0 πŸŽ€


πŸ’œ RETURN VALUE πŸ’œ

curl_easy_setopt(3) returns a CURLcode indicating success or error πŸ’…

CURLE_OK (0) means everything was OK β€” slay πŸŽ‰ β€” and non-zero means an error occurred, so go check libcurl-errors(3) for the tea πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie 🫢 this gem is from libcurl, dated 2026-10-12 β€” go forth and set your timeouts responsibly, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from