diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 00:50:36 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 00:50:36 +0000 |
commit | 4b5afdaae88eac9c94cbc870499845696ccfb47a (patch) | |
tree | 5e2b0d09fa753331a041ae4f445fe993c51b9dfd /net/ftp/ftp_network_transaction.cc | |
parent | ffa7c166bb7637fb05c8726aedc92ea92fe628ee (diff) | |
download | chromium_src-4b5afdaae88eac9c94cbc870499845696ccfb47a.zip chromium_src-4b5afdaae88eac9c94cbc870499845696ccfb47a.tar.gz chromium_src-4b5afdaae88eac9c94cbc870499845696ccfb47a.tar.bz2 |
FTP: fix navigation to systems with broken EPSV support.
Added error code check in DoDataConnectComplete, which falls back
to PASV if the connection with EPSV has timed out, and stops the transaction
in case of any other error.
BUG=48285
TEST=navigate to ftp.apc.com, it should succeed and display a directory listing
Review URL: http://codereview.chromium.org/3033028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp/ftp_network_transaction.cc')
-rw-r--r-- | net/ftp/ftp_network_transaction.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index f6b7203..471e8c9 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -1187,7 +1187,22 @@ int FtpNetworkTransaction::DoDataConnect() { } int FtpNetworkTransaction::DoDataConnectComplete(int result) { + if (result == ERR_CONNECTION_TIMED_OUT && use_epsv_) { + // It's possible we hit a broken server, sadly. Fall back to PASV. + // TODO(phajdan.jr): remember it for future transactions with this server. + // TODO(phajdan.jr): write a test for this code path. + use_epsv_ = false; + next_state_ = STATE_CTRL_WRITE_PASV; + return OK; + } + + // Only record the connection error after we've applied all our fallbacks. + // We want to capture the final error, one we're not going to recover from. RecordDataConnectionError(result); + + if (result != OK) + return Stop(result); + next_state_ = STATE_CTRL_WRITE_SIZE; return OK; } |