GNURLOPT_FTP_RESPONSE_TIMEOUT(3)
π GNURLOPT_FTP_RESPONSE_TIMEOUT(3) β or, "how long do we wait for the FTP server to text back"
okay so this is a page from the curl_easy_setopt options manual, bestie, and it's about one very specific little knob. buckle up π
β¨ NAME β¨
CURLOPT_FTP_RESPONSE_TIMEOUT β literally just "how long am I allowed to wait for an FTP response before I declare this session deceased" π
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_RESPONSE_TIMEOUT,
long timeout);
yes, it takes a long. yes, you pass it to curl_easy_setopt. slay. β¨
β¨ DESCRIPTION β¨
So you pass a long, right? And what that does is make libcurl set a timeout period β in seconds β on how much time the server is allowed to take to send back a response message for a command. and if it doesn't text back within that window? the session is considered dead. that's it. that's the whole vibe check π
and here's the important part, iykyk: while libcurl is sitting there waiting for a response, this value overrides CURLOPT_TIMEOUT(3). so it's not adding to it, it's straight up taking over. main character energy fr fr π
the manual also says (and this is genuinely good advice) that if you're using this in conjunction with CURLOPT_TIMEOUT(3), you should set CURLOPT_FTP_RESPONSE_TIMEOUT(3) to a value smaller than CURLOPT_TIMEOUT(3). do with that what you will π«Ά
β¨ DEFAULT β¨
None β no default, no vibes, nothing set unless you set it πΈ
β¨ PROTOCOLS β¨
FTP β that's it. that's the list. ftp only bestie π¦
β¨ EXAMPLE β¨
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/slow.txt");
/* wait no more than 23 seconds */
curl_easy_setopt(curl, CURLOPT_FTP_RESPONSE_TIMEOUT, 23L);
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
look at that 23L. twenty-three seconds of patience and not one more, we are not waiting around for slow.txt π
β¨ AVAILABILITY β¨
Added in 7.10.8 β she's been iconic for a minute π
β¨ RETURN VALUE β¨
- Returns
CURLE_OKif FTP is supported π - Returns
CURLE_UNKNOWN_OPTIONif not π - Returns
CURLE_BAD_FUNCTION_ARGUMENTif you set it to a negative value, or to a value that β when converted to milliseconds β is too large. so like, don't do that. seriously. no cap.
β¨ SEE ALSO β¨
okay that's the whole page, bestie β go forth and set your FTP response timeouts responsibly π§π
psst: the lowkey important takeaway is that this only kicks in while waiting for a response, and it overridesCURLOPT_TIMEOUT(3)during that wait. keep yourCURLOPT_FTP_RESPONSE_TIMEOUT(3)smaller than yourCURLOPT_TIMEOUT(3)and you're golden β¨
signed off with love from libcurl 7.37.0, dated 19 Jun 2014 β a vintage era, honestly, and this page still ate π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, 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