aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-07-27 18:36:56 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-07-27 18:36:56 +0000
commit06841282097c583a3c0b92790a5553895002bffd (patch)
tree239d6b472ae3eedc8686b2c36599304779404901 /lib
parent9b5c00a664e3d43deaa88a3c1da8cdc51fa4f905 (diff)
- All the quote options (CURLOPT_QUOTE, CURLOPT_POSTQUOTE and
CURLOPT_PREQUOTE) now accept a preceeding asterisk before the command to send when using FTP, as a sign that libcurl shall simply ignore the response from the server instead of treating it as an error. Not treating a 400+ FTP response code as an error means that failed commands will not abort the chain of commands, nor will they cause the connection to get disconnected.
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index ebd971571..4ded990b6 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3323,6 +3323,8 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
*
* Where a 'quote' means a list of custom commands to send to the server.
* The quote list is passed as an argument.
+ *
+ * BLOCKING
*/
static
@@ -3336,14 +3338,27 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote)
item = quote;
while(item) {
if(item->data) {
- FTPSENDF(conn, "%s", item->data);
+ char *cmd = item->data;
+ bool acceptfail = FALSE;
+
+ /* if a command starts with an asterisk, which a legal FTP command never
+ can, the command will be allowed to fail without it causing any
+ aborts or cancels etc. It will cause libcurl to act as if the command
+ is successful, whatever the server reponds. */
+
+ if(cmd[0] == '*') {
+ cmd++;
+ acceptfail = TRUE;
+ }
+
+ FTPSENDF(conn, "%s", cmd);
result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
if(result)
return result;
- if(ftpcode >= 400) {
- failf(conn->data, "QUOT string not accepted: %s", item->data);
+ if(!acceptfail && (ftpcode >= 400)) {
+ failf(conn->data, "QUOT string not accepted: %s", cmd);
return CURLE_QUOTE_ERROR;
}
}