diff options
author | Daniel Stenberg <daniel@haxx.se> | 2009-02-17 09:07:25 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2009-02-17 09:07:25 +0000 |
commit | 8f81fd6be5d3a480eca3f7ebbded5113f66c64be (patch) | |
tree | 278ce60a4c12407b3848b146208385c5aba63a6a /lib/ftp.c | |
parent | 1472be4d3e55e1f3c0c0d1fdbee77a45630f326b (diff) |
- CURLOPT_FTP_CREATE_MISSING_DIRS can now be set to 2 in addition to 1 for
plain FTP connections, and it will then allow MKD to fail once and retry the
CWD afterwards. This is especially useful if you're doing many simultanoes
connections against the same server and they all have this option enabled,
as then CWD may first fail but then another connection does MKD before this
connection and thus MKD fails but trying CWD works! The numbers can
(should?) now be set with the convenience enums now called
CURLFTP_CREATE_DIR and CURLFTP_CREATE_DIR_RETRY.
Tests has proven that if you're making an application that uploads a set of
files to an ftp server, you will get a noticable gain in speed if you're
using multiple connections and this option will be then be very useful.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r-- | lib/ftp.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -828,7 +828,13 @@ static CURLcode ftp_state_cwd(struct connectdata *conn) /* already done and fine */ result = ftp_state_post_cwd(conn); else { - ftpc->count2 = 0; + ftpc->count2 = 0; /* count2 counts failed CWDs */ + + /* count3 is set to allow a MKD to fail once. In the case when first CWD + fails and then MKD fails (due to another session raced it to create the + dir) this then allows for a second try to CWD to it */ + ftpc->count3 = (conn->data->set.ftp_create_missing_dirs==2)?1:0; + if(conn->bits.reuse && ftpc->entrypath) { /* This is a re-used connection. Since we change directory to where the transfer is taking place, we must first get back to the original dir @@ -2834,7 +2840,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) break; case FTP_MKD: - if(ftpcode/100 != 2) { + if((ftpcode/100 != 2) && !ftpc->count3--) { /* failure to MKD the dir */ failf(data, "Failed to MKD dir: %03d", ftpcode); return CURLE_REMOTE_ACCESS_DENIED; |