[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 24/256: ftp: fix CWD when doing multicwd then nocwd
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 24/256: ftp: fix CWD when doing multicwd then nocwd on same connection |
Date: |
Fri, 06 Oct 2017 19:41:55 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit c95eff4a11575a5973fad20619ff7ca3989316db
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue Aug 15 18:48:04 2017 +0200
ftp: fix CWD when doing multicwd then nocwd on same connection
Fixes #1782
Closes #1787
Reported-by: Peter Lamare
---
lib/ftp.c | 4 +++-
lib/ftp.h | 1 +
tests/data/Makefile.inc | 2 +-
tests/data/test1149 | 64 +++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/lib/ftp.c b/lib/ftp.c
index 481b14a88..06c196462 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3197,6 +3197,7 @@ static CURLcode ftp_done(struct connectdata *conn,
CURLcode status,
size_t flen = ftpc->file?strlen(ftpc->file):0; /* file is "raw" already */
size_t dlen = strlen(path)-flen;
if(!ftpc->cwdfail) {
+ ftpc->prevmethod = data->set.ftp_filemethod;
if(dlen && (data->set.ftp_filemethod != FTPFILE_NOCWD)) {
ftpc->prevpath = path;
if(flen)
@@ -4305,7 +4306,8 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
dlen -= ftpc->file?strlen(ftpc->file):0;
if((dlen == strlen(ftpc->prevpath)) &&
- !strncmp(path, ftpc->prevpath, dlen)) {
+ !strncmp(path, ftpc->prevpath, dlen) &&
+ (ftpc->prevmethod == data->set.ftp_filemethod)) {
infof(data, "Request has same path as previous transfer\n");
ftpc->cwddone = TRUE;
}
diff --git a/lib/ftp.h b/lib/ftp.h
index 9c6c2c8de..e4aa63f17 100644
--- a/lib/ftp.h
+++ b/lib/ftp.h
@@ -135,6 +135,7 @@ struct ftp_conn {
caching the current directory */
bool wait_data_conn; /* this is set TRUE if data connection is waited */
char *prevpath; /* conn->path from the previous transfer */
+ curl_ftpfile prevmethod; /* ftp method in previous transfer */
char transfertype; /* set by ftp_transfertype for use by Curl_client_write()a
and others (A/I or zero) */
int count1; /* general purpose counter for the state machine */
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index 88e5e2a9a..575cf48cc 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -120,7 +120,7 @@ test1112 test1113 test1114 test1115 test1116 test1117
test1118 test1119 \
test1120 test1121 test1122 test1123 test1124 test1125 test1126 test1127 \
test1128 test1129 test1130 test1131 test1132 test1133 test1134 test1135 \
test1136 test1137 test1138 test1139 test1140 test1141 test1142 test1143 \
-test1144 test1145 test1146 test1147 test1148 \
+test1144 test1145 test1146 test1147 test1148 test1149 \
test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \
test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \
test1216 test1217 test1218 test1219 \
diff --git a/tests/data/test1149 b/tests/data/test1149
new file mode 100644
index 000000000..ae081a8a9
--- /dev/null
+++ b/tests/data/test1149
@@ -0,0 +1,64 @@
+# based on test1010
+<testcase>
+<info>
+<keywords>
+FTP
+PASV
+LIST
+</keywords>
+</info>
+#
+# Server-side
+<reply>
+# When doing LIST, we get the default list output hard-coded in the test
+# FTP server
+<datacheck mode="text">
+total 20
+drwxr-xr-x 8 98 98 512 Oct 22 13:06 .
+drwxr-xr-x 8 98 98 512 Oct 22 13:06 ..
+drwxr-xr-x 2 98 98 512 May 2 1996 .NeXT
+-r--r--r-- 1 0 1 35 Jul 16 1996 README
+lrwxrwxrwx 1 0 1 7 Dec 9 1999 bin -> usr/bin
+dr-xr-xr-x 2 0 1 512 Oct 1 1997 dev
+drwxrwxrwx 2 98 98 512 May 29 16:04 download.html
+dr-xr-xr-x 2 0 1 512 Nov 30 1995 etc
+drwxrwxrwx 2 98 1 512 Oct 30 14:33 pub
+dr-xr-xr-x 5 0 1 512 Oct 1 1997 usr
+</datacheck>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+ftp
+</server>
+ <name>
+FTP dir list multicwd then again nocwd
+ </name>
+ <command>
+ftp://%HOSTIP:%FTPPORT/list/this/path/1149/ --ftp-method multicwd --next
ftp://%HOSTIP:%FTPPORT/list/this/path/1149/ --ftp-method nocwd
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<protocol>
+USER anonymous
+PASS address@hidden
+PWD
+CWD list
+CWD this
+CWD path
+CWD 1149
+EPSV
+TYPE A
+LIST
+CWD /
+EPSV
+LIST list/this/path/1149/
+QUIT
+</protocol>
+</verify>
+</testcase>
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 40/256: tftp: fix memory leak on too long filename, (continued)
- [GNUnet-SVN] [gnurl] 40/256: tftp: fix memory leak on too long filename, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 50/256: config-tpf: define SIZEOF_LONG, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 23/256: CURLOPT_SSH_COMPRESSION.3: enable with 1L, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 27/256: config-win32: define SIZEOF_CURL_OFF_T, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 16/256: travis: add metalink to some osx builds, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 10/256: progress: Track total times following redirects, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 22/256: compressed-ssh.d: "Added: 7.56.0", gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 52/256: CURLOPT_USERPWD.3: see also CURLOPT_PROXYUSERPWD, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 15/256: coverage: Use two coveralls commands to get lib/vtls results, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 31/256: http: Don't wait on CONNECT when there is no proxy, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 24/256: ftp: fix CWD when doing multicwd then nocwd on same connection,
gnunet <=
- [GNUnet-SVN] [gnurl] 26/256: cmake: sizeof curl_off_t, remove unused detections, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 28/256: lib557: no longer use CURL_SIZEOF_* defines, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 51/256: imap: support PREAUTH, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 32/256: curl/system.h: check for __ppc__ as well, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 34/256: http2_recv: return error better on fatal h2 errors, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 39/256: runtests: fixed case insensitive matching of keywords, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 41/256: curl/system.h: fix build for hppa, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 38/256: tests: Make sure libtests call curl_global_cleanup(), gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 53/256: imap: use defined names for response codes, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 33/256: KNOWN_BUGS: HTTP test server 'connection-monitor' problems, gnunet, 2017/10/06