From 7472ede32ae5a1c80928e03ef8fd836630eb6ac8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 20 Jan 2005 22:22:12 +0000 Subject: [PATCH] Philippe Hameau found out that -Q "+[command]" didn't work, although some code was written for it. I fixed and added test case 227 to verify it. The curl.1 man page didn't mention the '+' so I added it. --- CHANGES | 5 +++++ RELEASE-NOTES | 3 ++- docs/curl.1 | 12 ++++++----- src/main.c | 8 +++++--- tests/data/Makefile.am | 2 +- tests/data/test227 | 46 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 tests/data/test227 diff --git a/CHANGES b/CHANGES index 5959147f6..24db8ef7b 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,11 @@ Changelog +Daniel (20 January 2005) +- Philippe Hameau found out that -Q "+[command]" didn't work, although some + code was written for it. I fixed and added test case 227 to verify it. + The curl.1 man page didn't mention the '+' so I added it. + Daniel (19 January 2005) - Stephan Bergmann made libcurl return CURLE_URL_MALFORMAT if an FTP URL contains %0a or %0d in the user, password or CWD parts. (A future fix would diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e622bdd9f..47b789a38 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -10,6 +10,7 @@ Curl and libcurl 7.12.4 This release includes the following changes: + o -Q "+[command]" was added o src/getpass.c license issue sorted (code was rewritten) o curl -w now supports 'http_connect' for the proxy's response to CONNECT o introducing "curl-config --protocols" @@ -42,6 +43,6 @@ advice from friends like these: Werner Koch, Gisle Vanem, Alex Neblett, Kai Sommerfeld, Marty Kuhrt, Hzhijun, Pavel Orehov, Bruce Mitchener, Cyrill Osterwalder, Dan Torop, Martijn Koster, Alex aka WindEagle, Cody Jones, Samuel Díaz García, - Stephan Bergmann + Stephan Bergmann, Philippe Hameau Thanks! (and sorry if I forgot to mention someone) diff --git a/docs/curl.1 b/docs/curl.1 index 9c9b16cfa..f9faadbda 100644 --- a/docs/curl.1 +++ b/docs/curl.1 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. +.\" * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -21,7 +21,7 @@ .\" * $Id$ .\" ************************************************************************** .\" -.TH curl 1 "7 Dec 2004" "Curl 7.12.3" "Curl Manual" +.TH curl 1 "20 Jan 2005" "Curl 7.12.4" "Curl Manual" .SH NAME curl \- transfer a URL .SH SYNOPSIS @@ -677,9 +677,11 @@ If used as the first parameter on the command line, the \fI$HOME/.curlrc\fP file will not be read and used as a config file. .IP "-Q/--quote " (FTP) Send an arbitrary command to the remote FTP server. Quote commands are -sent BEFORE the transfer is taking place. To make commands take place after a -successful transfer, prefix them with a dash '-'. You may specify any amount -of commands to be run before and after the transfer. If the server returns +sent BEFORE the transfer is taking place (just after the initial PWD command +to be exact). To make commands take place after a successful transfer, prefix +them with a dash '-'. To make commands get sent after libcurl has changed +working directory, just before the transfer command(s), prefix the command +with '+'. You may specify any amount of commands. If the server returns failure for one of the commands, the entire operation will be aborted. You must send syntactically correct FTP commands as RFC959 defines. diff --git a/src/main.c b/src/main.c index ad3a5f4cd..bcf2cd2b4 100644 --- a/src/main.c +++ b/src/main.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -2784,8 +2784,9 @@ static void free_config_fields(struct Configurable *config) free(config->cookiejar); curl_slist_free_all(config->quote); /* checks for config->quote == NULL */ - curl_slist_free_all(config->postquote); /* */ - curl_slist_free_all(config->headers); /* */ + curl_slist_free_all(config->prequote); + curl_slist_free_all(config->postquote); + curl_slist_free_all(config->headers); } #if defined(WIN32) && !defined(__CYGWIN32__) @@ -3490,6 +3491,7 @@ operate(struct Configurable *config, int argc, char *argv[]) curl_easy_setopt(curl, CURLOPT_CRLF, config->crlf); curl_easy_setopt(curl, CURLOPT_QUOTE, config->quote); curl_easy_setopt(curl, CURLOPT_POSTQUOTE, config->postquote); + curl_easy_setopt(curl, CURLOPT_PREQUOTE, config->prequote); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, config->headerfile?&heads:NULL); curl_easy_setopt(curl, CURLOPT_COOKIEFILE, config->cookiefile); diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 8267d7ab1..4f8b3d670 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -31,7 +31,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \ test517 test518 test210 test211 test212 test220 test221 test222 \ test223 test224 test206 test207 test208 test209 test213 test240 \ test241 test242 test519 test214 test215 test216 test217 test218 \ - test199 test225 test226 + test199 test225 test226 test227 # The following tests have been removed from the dist since they no longer # work. We need to fix the test suite's FTPS server first, then bring them diff --git a/tests/data/test227 b/tests/data/test227 new file mode 100644 index 000000000..34331d4cf --- /dev/null +++ b/tests/data/test227 @@ -0,0 +1,46 @@ +# Server-side + + +data + to + see +that FTP +works + so does it? + + + +# Client-side + + +ftp + + +FTP with quote ops + + +ftp://%HOSTIP:%FTPPORT/227 -Q "NOOP 1" -Q "+NOOP 2" -Q "-NOOP 3" + + + +REPLY EPSV 500 no such command + + + +# Verify data after the test has been "shot" + + +USER anonymous +PASS curl_by_daniel@haxx.se +PWD +NOOP 1 +EPSV +PASV +TYPE I +NOOP 2 +SIZE 227 +RETR 227 +NOOP 3 +QUIT + +