diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ftp.c | 5 | ||||
-rw-r--r-- | lib/urldata.h | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -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: diff --git a/lib/urldata.h b/lib/urldata.h index 3842952fe..0293dd5ad 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -343,6 +343,8 @@ struct FTP { should be FALSE when it gets to Curl_ftp_quit() */ bool cwddone; /* if it has been determined that the proper CWD combo already has been done */ + bool cwdfail; /* set TRUE if a CWD command fails, as then we must prevent + caching the current directory */ char *prevpath; /* conn->path from the previous transfer */ size_t nread_resp; /* number of bytes currently read of a server response */ |