diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-09 19:38:56 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-09 19:38:56 +0000 |
commit | fd22a6b3b7f664968509559b179673859f11b60e (patch) | |
tree | a898d9a4b56b57cb9f4843e508142fe2e8da8376 /net/ftp/ftp_network_transaction.cc | |
parent | fc48aa2703cfc9e4dca98031671fd5e7af05d8b5 (diff) | |
download | chromium_src-fd22a6b3b7f664968509559b179673859f11b60e.zip chromium_src-fd22a6b3b7f664968509559b179673859f11b60e.tar.gz chromium_src-fd22a6b3b7f664968509559b179673859f11b60e.tar.bz2 |
Return ERR_FILE_NOT_FOUND from FtpNetworkTransaction when we can.
This way it provides more specific error code for the user.
TEST=Covered by net_unittests.
http://crbug.com/20405
Review URL: http://codereview.chromium.org/197050
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp/ftp_network_transaction.cc')
-rw-r--r-- | net/ftp/ftp_network_transaction.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index c5c9daf..cf4a773 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -828,8 +828,12 @@ int FtpNetworkTransaction::ProcessResponseRETR( return Stop(ERR_FAILED); return ERR_FAILED; // TODO(ibrar): Retry here. case ERROR_CLASS_PERMANENT_ERROR: - if (retr_failed_) + // Code 550 means "Failed to open file". Other codes are unrelated, + // like "Not logged in" etc. + if (response.status_code != 550) return Stop(ERR_FAILED); + + DCHECK(!retr_failed_); // Should not get here twice. retr_failed_ = true; next_state_ = STATE_CTRL_WRITE_PASV; break; @@ -901,6 +905,13 @@ int FtpNetworkTransaction::ProcessResponseCWD(const FtpCtrlResponse& response) { case ERROR_CLASS_TRANSIENT_ERROR: return Stop(ERR_FAILED); case ERROR_CLASS_PERMANENT_ERROR: + if (retr_failed_ && response.status_code == 550) { + // Both RETR and CWD failed with codes 550. That means that the path + // we're trying to access is not a file, and not a directory. The most + // probable interpretation is that it doesn't exist (with FTP we can't + // be sure). + return Stop(ERR_FILE_NOT_FOUND); + } return Stop(ERR_FAILED); default: NOTREACHED(); |