From 67e9e90f96ba1a032ba05805d940197a2e32d53f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 8 Jun 2023 16:30:31 +0200 Subject: [PATCH] examples/ftpuploadresume.c: add use of CURLOPT_ACCEPTTIMEOUT_MS For show Closes #11277 --- docs/examples/ftpuploadresume.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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);