aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-04-09 16:54:52 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-04-09 16:54:52 +0200
commit02892e4fd8c1faff74edd2ce7e232b0c8442c5c9 (patch)
tree0a1c7ce3e1ea0181bd1bf382388b738f2b5d573d /lib/ftp.c
parent10977f57de0d2426f479ef4d36f8a203488fdda7 (diff)
FTP quote commands prefixed with '*' now can fail without aborting
Prefixing the FTP quote commands with an asterisk really only worked for the postquote actions. This is now fixed and test case 227 has been extended to verify.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 0ec524336..f821d124d 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1424,6 +1424,12 @@ static CURLcode ftp_state_quote(struct connectdata *conn,
break;
}
+ /*
+ * This state uses:
+ * 'count1' to iterate over the commands to send
+ * 'count2' to store wether to allow commands to fail
+ */
+
if(init)
ftpc->count1 = 0;
else
@@ -1438,7 +1444,15 @@ static CURLcode ftp_state_quote(struct connectdata *conn,
i++;
}
if(item) {
- PPSENDF(&ftpc->pp, "%s", item->data);
+ char *cmd = item->data;
+ if(cmd[0] == '*') {
+ cmd++;
+ ftpc->count2 = 1; /* the sent command is allowed to fail */
+ }
+ else
+ ftpc->count2 = 0; /* failure means cancel operation */
+
+ PPSENDF(&ftpc->pp, "%s", cmd);
state(conn, instate);
quote = TRUE;
}
@@ -2658,7 +2672,8 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
case FTP_POSTQUOTE:
case FTP_RETR_PREQUOTE:
case FTP_STOR_PREQUOTE:
- if(ftpcode >= 400) {
+ if((ftpcode >= 400) && !ftpc->count2) {
+ /* failure reponse code, and not allowed to fail */
failf(conn->data, "QUOT command failed with %03d", ftpcode);
return CURLE_QUOTE_ERROR;
}