]> granicus.if.org Git - curl/commitdiff
curl: make --ftp-create-dirs retry on failure
authorDaniel Stenberg <daniel@haxx.se>
Fri, 22 Apr 2016 13:25:13 +0000 (15:25 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 22 Apr 2016 13:25:13 +0000 (15:25 +0200)
The underlying libcurl option used for this feature is
CURLOPT_FTP_CREATE_MISSING_DIRS which has the ability to retry the dir
creation, but it was never set to do that by the command line tool.

Now it does.

Bug: https://curl.haxx.se/mail/archive-2016-04/0021.html
Reported-by: John Wanghui
Help-by: Leif W
src/tool_operate.c

index 948a2f314765d0d2cc7204c38c90a5435e9cecfd..d56cab5fbf7f7405d048edd24c909d88adea59a4 100644 (file)
@@ -1180,9 +1180,12 @@ static CURLcode operate_do(struct GlobalConfig *global,
           my_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L);
         }
 
-        /* new in curl 7.10.7, extended in 7.19.4 but this only sets 0 or 1 */
+        /* new in curl 7.10.7, extended in 7.19.4. Modified to use
+           CREATE_DIR_RETRY in 7.49.0 */
         my_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
-                  config->ftp_create_dirs?1L:0L);
+                  (long)(config->ftp_create_dirs?
+                         CURLFTP_CREATE_DIR_RETRY:
+                         CURLFTP_CREATE_DIR_NONE));
 
         /* new in curl 7.10.8 */
         if(config->max_filesize)