aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-01-10 23:03:22 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-01-10 23:03:22 +0000
commit4431338691ff5167e453b1407eeeefcc0a515dbe (patch)
tree964b7bf589684ca0f61101e4a519c83766ee8de1 /lib/ftp.c
parentbda1e9aeab019d003036a3ec24193605bc191b3a (diff)
When using a bad path over FTP, as in when libcurl couldn't CWD into all
given subdirs, libcurl would still "remember" the full path as if it is the current directory libcurl is in so that the next curl_easy_perform() would get really confused if it tried the same path again - as it would not issue any CWD commands at all, assuming it is already in the "proper" dir. Starting now, a failed CWD command sets a flag that prevents the path to be "remembered" after returning.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 6c35ce215..6bf96cde9 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2529,6 +2529,8 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
else {
/* return failure */
failf(data, "Server denied you to change to the given directory");
+ ftp->cwdfail = TRUE; /* don't remember this path as we failed
+ to enter it */
return CURLE_FTP_ACCESS_DENIED;
}
}
@@ -2815,7 +2817,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
flen = ftp->file?strlen(ftp->file):0; /* file is "raw" already */
dlen = strlen(path)-flen;
- if(dlen) {
+ if(dlen && !ftp->cwdfail) {
ftp->prevpath = path;
if(flen)
/* if 'path' is not the whole string */
@@ -3664,6 +3666,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
/* the ftp struct is already inited in ftp_connect() */
ftp = conn->proto.ftp;
ftp->ctl_valid = FALSE;
+ ftp->cwdfail = FALSE;
switch(data->set.ftp_filemethod) {
case FTPFILE_NOCWD: