]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
- All the quote options (CURLOPT_QUOTE, CURLOPT_POSTQUOTE and
authorDaniel Stenberg <daniel@haxx.se>
Mon, 27 Jul 2009 18:36:56 +0000 (18:36 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 27 Jul 2009 18:36:56 +0000 (18:36 +0000)
  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.

CHANGES
RELEASE-NOTES
lib/ftp.c

diff --git a/CHANGES b/CHANGES
index 0b5ec2536cb2f6841d5e4e39a203b8f00543a013..52995a6bf3d5f1e0a633642489a1238af718596b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,11 +6,21 @@
 
                                   Changelog
 
+Daniel Stenberg (27 Jul 2009)
+- 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.
+
 Daniel Stenberg (26 Jul 2009)
-- Bug report #2825989 (http://curl.haxx.se/bug/view.cgi?id=2825989) pointed
-  out that OpenSSL-powered libcurl didn't support the SHA-2 digest algorithm,
-  and provided the solution too: to use OpenSSL_add_all_algorithms() instead
-  of the older SSLeay_* alternative.
+- Johan van Selst posted bug report #2825989
+  (http://curl.haxx.se/bug/view.cgi?id=2825989) pointing out that
+  OpenSSL-powered libcurl didn't support the SHA-2 digest algorithm, and
+  provided the solution too: to use OpenSSL_add_all_algorithms() in addition
+  to the older SSLeay_* alternative. OpenSSL_add_all_algorithms was added in
+  OpenSSL 0.9.5
 
 Daniel Stenberg (23 Jul 2009)
 - Added CURLOPT_SSH_KNOWNHOSTS, CURLOPT_SSH_KEYFUNCTION, CURLOPT_SSH_KEYDATA.
index 5f68c1bc501705e7cf9f04f688d408c14c2a33e7..1b94e20c1d6e8104f8e1e696150ae13ab71e3198 100644 (file)
@@ -11,6 +11,8 @@ This release includes the following changes:
 
  o CURLOPT_FTPPORT (and curl's -P/--ftpport) support port ranges
  o Added CURLOPT_SSH_KNOWNHOSTS, CURLOPT_SSH_KEYFUNCTION, CURLOPT_SSH_KEYDATA
+ o CURLOPT_QUOTE, CURLOPT_POSTQUOTE and CURLOPT_PREQUOTE can be told to ignore
+   error responses when used with FTP
 
 This release includes the following bugfixes:
 
@@ -48,6 +50,6 @@ advice from friends like these:
  Andre Guibert de Bruet, Mike Crowe, Claes Jakobsson, John E. Malmberg,
  Aaron Oneal, Igor Novoseltsev, Eric Wong, Bill Hoffman, Daniel Steinberg,
  Fabian Keil, Michal Marek, Reuven Wachtfogel, Markus Koetter,
- Constantine Sapuntzakis, David Binderman
+ Constantine Sapuntzakis, David Binderman, Johan van Selst
 
         Thanks! (and sorry if I forgot to mention someone)
index ebd971571bac0fde9140cda160dfda3d4e5ce5a3..4ded990b690f06cc855f54b925b063bff50b16b7 100644 (file)
--- 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;
       }
     }