summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-08-15 18:48:04 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-08-17 10:08:11 +0200
commitc95eff4a11575a5973fad20619ff7ca3989316db (patch)
tree0f6a1755df18b3f5f19d0a30c712687c72cae246 /lib
parent582f2a1308182becb9b4a1fad5ff3eccf8fa21f8 (diff)
downloadcurl-c95eff4a11575a5973fad20619ff7ca3989316db.tar.gz
ftp: fix CWD when doing multicwd then nocwd on same connection
Fixes #1782 Closes #1787 Reported-by: Peter Lamare
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c4
-rw-r--r--lib/ftp.h1
2 files changed, 4 insertions, 1 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 */