1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

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.
This commit is contained in:
Daniel Stenberg 2006-01-10 23:03:22 +00:00
parent bda1e9aeab
commit 4431338691
4 changed files with 22 additions and 5 deletions

16
CHANGES
View File

@ -8,10 +8,20 @@
Daniel (10 January 2006)
- 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.
Daniel (7 January 2006) Daniel (7 January 2006)
- Mike Jean fixed so that the second CONNECT when doing FTP over a HTTP proxy - Michael Jahn fixed so that the second CONNECT when doing FTP over a HTTP
actually used a new connection and not sent the second request on the first proxy actually used a new connection and not sent the second request on the
socket! first socket!
Daniel (6 January 2006) Daniel (6 January 2006)
- Alexander Lazic made the buildconf run the buildconf in the ares dir if that - Alexander Lazic made the buildconf run the buildconf in the ares dir if that

View File

@ -15,6 +15,8 @@ This release includes the following changes:
This release includes the following bugfixes: This release includes the following bugfixes:
o Doing a second request with FTP on the same bath path, would make libcurl
confuse what current working directory it had
o FTP over HTTP proxy now sends the second CONNECT properly o FTP over HTTP proxy now sends the second CONNECT properly
o numerous compiler warnings and build quirks for various compilers have o numerous compiler warnings and build quirks for various compilers have
been addressed been addressed
@ -31,6 +33,6 @@ This release would not have looked like this without help, code, reports and
advice from friends like these: advice from friends like these:
Dov Murik, Jean Jacques Drouin, Andres Garcia, Yang Tse, Gisle Vanem, Dan Dov Murik, Jean Jacques Drouin, Andres Garcia, Yang Tse, Gisle Vanem, Dan
Fandrich, Alexander Lazic, Mike Jean Fandrich, Alexander Lazic, Michael Jahn
Thanks! (and sorry if I forgot to mention someone) Thanks! (and sorry if I forgot to mention someone)

View File

@ -2529,6 +2529,8 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
else { else {
/* return failure */ /* return failure */
failf(data, "Server denied you to change to the given directory"); 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; 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 */ flen = ftp->file?strlen(ftp->file):0; /* file is "raw" already */
dlen = strlen(path)-flen; dlen = strlen(path)-flen;
if(dlen) { if(dlen && !ftp->cwdfail) {
ftp->prevpath = path; ftp->prevpath = path;
if(flen) if(flen)
/* if 'path' is not the whole string */ /* 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() */ /* the ftp struct is already inited in ftp_connect() */
ftp = conn->proto.ftp; ftp = conn->proto.ftp;
ftp->ctl_valid = FALSE; ftp->ctl_valid = FALSE;
ftp->cwdfail = FALSE;
switch(data->set.ftp_filemethod) { switch(data->set.ftp_filemethod) {
case FTPFILE_NOCWD: case FTPFILE_NOCWD:

View File

@ -343,6 +343,8 @@ struct FTP {
should be FALSE when it gets to Curl_ftp_quit() */ should be FALSE when it gets to Curl_ftp_quit() */
bool cwddone; /* if it has been determined that the proper CWD combo bool cwddone; /* if it has been determined that the proper CWD combo
already has been done */ 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 */ char *prevpath; /* conn->path from the previous transfer */
size_t nread_resp; /* number of bytes currently read of a server response */ size_t nread_resp; /* number of bytes currently read of a server response */