diff options
author | Daniel Stenberg <daniel@haxx.se> | 2009-07-27 18:36:56 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2009-07-27 18:36:56 +0000 |
commit | 06841282097c583a3c0b92790a5553895002bffd (patch) | |
tree | 239d6b472ae3eedc8686b2c36599304779404901 /lib | |
parent | 9b5c00a664e3d43deaa88a3c1da8cdc51fa4f905 (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.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -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; } } |