]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
examples/ftpuploadresume.c: add use of CURLOPT_ACCEPTTIMEOUT_MS
authorDaniel Stenberg <daniel@haxx.se>
Thu, 8 Jun 2023 14:30:31 +0000 (16:30 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 8 Jun 2023 21:37:43 +0000 (23:37 +0200)
For show

Closes #11277

docs/examples/ftpuploadresume.c

index 26f2f9bf8a807a54d4c8f5c875e15f9615743f6b..42d31a2bbfbdeb4b23b6a3b2cdb0a1798c045ec5 100644 (file)
@@ -22,7 +22,7 @@
  *
  ***************************************************************************/
 /* <DESC>
- * Upload to FTP, resuming failed transfers.
+ * Upload to FTP, resuming failed transfers. Active mode.
  * </DESC>
  */
 
@@ -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);