From: Daniel Stenberg Date: Thu, 8 Jun 2023 14:30:31 +0000 (+0200) Subject: examples/ftpuploadresume.c: add use of CURLOPT_ACCEPTTIMEOUT_MS X-Git-Tag: curl-8_2_0~130 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=67e9e90f96ba1a032ba05805d940197a2e32d53f;p=thirdparty%2Fcurl.git examples/ftpuploadresume.c: add use of CURLOPT_ACCEPTTIMEOUT_MS For show Closes #11277 --- diff --git a/docs/examples/ftpuploadresume.c b/docs/examples/ftpuploadresume.c index 26f2f9bf8a..42d31a2bbf 100644 --- a/docs/examples/ftpuploadresume.c +++ b/docs/examples/ftpuploadresume.c @@ -22,7 +22,7 @@ * ***************************************************************************/ /* - * Upload to FTP, resuming failed transfers. + * Upload to FTP, resuming failed transfers. Active mode. * */ @@ -96,8 +96,12 @@ static int upload(CURL *curlhandle, const char *remotepath, curl_easy_setopt(curlhandle, CURLOPT_READFUNCTION, readfunc); curl_easy_setopt(curlhandle, CURLOPT_READDATA, f); - /* disable passive mode */ + /* enable active mode */ curl_easy_setopt(curlhandle, CURLOPT_FTPPORT, "-"); + + /* allow the server no more than 7 seconds to connect back */ + curl_easy_setopt(curlhandle, CURLOPT_ACCEPTTIMEOUT_MS, 7000L); + curl_easy_setopt(curlhandle, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L); curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, 1L);