diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-10 17:17:41 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-10 17:17:41 +0000 |
commit | 685f6cbb6e8ac88c41d178490ed18b1aea6cfba1 (patch) | |
tree | ac4f9dffdb9db61439525ecf14c525f959849db7 /net/ftp | |
parent | f439d53c11de91db1fa86a22b156e14b696f8adb (diff) | |
download | chromium_src-685f6cbb6e8ac88c41d178490ed18b1aea6cfba1.zip chromium_src-685f6cbb6e8ac88c41d178490ed18b1aea6cfba1.tar.gz chromium_src-685f6cbb6e8ac88c41d178490ed18b1aea6cfba1.tar.bz2 |
FTP: fix compatibility problems with MLSD by removing MLSD support.
Some FTP servers send MLSD listings with no facts, just
the file names. This is a valid RFC-3659 listing, but
is useless for web browsers.
In theory we could check whether a server advertises
MLSD support in FEAT response, or use LIST when MLSD
only returns file names, but the extra complexity
is not worth it.
All servers supporting MLSD must also support LIST,
so this should not regress compatibility.
This change also removes the "HPRC" directory listing parser.
Actually, it was just MLSD listing with no facts.
BUG=65328, 65584
TEST=net_unittests, also see the bugs
Review URL: http://codereview.chromium.org/5669001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68859 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp')
-rw-r--r-- | net/ftp/ftp_directory_listing_buffer.cc | 4 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_buffer_unittest.cc | 5 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_parser_hprc.cc | 60 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_parser_hprc.h | 46 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_parser_hprc_unittest.cc | 46 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_parser_mlsd.cc | 146 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_parser_mlsd.h | 37 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_parser_mlsd_unittest.cc | 68 | ||||
-rw-r--r-- | net/ftp/ftp_network_transaction.cc | 47 | ||||
-rw-r--r-- | net/ftp/ftp_network_transaction.h | 4 | ||||
-rw-r--r-- | net/ftp/ftp_network_transaction_unittest.cc | 25 | ||||
-rw-r--r-- | net/ftp/ftp_server_type_histograms.h | 4 |
12 files changed, 6 insertions, 486 deletions
diff --git a/net/ftp/ftp_directory_listing_buffer.cc b/net/ftp/ftp_directory_listing_buffer.cc index f6e8748..58533b8 100644 --- a/net/ftp/ftp_directory_listing_buffer.cc +++ b/net/ftp/ftp_directory_listing_buffer.cc @@ -9,9 +9,7 @@ #include "base/stl_util-inl.h" #include "base/string_util.h" #include "net/base/net_errors.h" -#include "net/ftp/ftp_directory_listing_parser_hprc.h" #include "net/ftp/ftp_directory_listing_parser_ls.h" -#include "net/ftp/ftp_directory_listing_parser_mlsd.h" #include "net/ftp/ftp_directory_listing_parser_netware.h" #include "net/ftp/ftp_directory_listing_parser_vms.h" #include "net/ftp/ftp_directory_listing_parser_windows.h" @@ -21,9 +19,7 @@ namespace net { FtpDirectoryListingBuffer::FtpDirectoryListingBuffer( const base::Time& current_time) : current_parser_(NULL) { - parsers_.insert(new FtpDirectoryListingParserHprc(current_time)); parsers_.insert(new FtpDirectoryListingParserLs(current_time)); - parsers_.insert(new FtpDirectoryListingParserMlsd()); parsers_.insert(new FtpDirectoryListingParserNetware(current_time)); parsers_.insert(new FtpDirectoryListingParserVms()); parsers_.insert(new FtpDirectoryListingParserWindows()); diff --git a/net/ftp/ftp_directory_listing_buffer_unittest.cc b/net/ftp/ftp_directory_listing_buffer_unittest.cc index ceddfc4..cb120a6 100644 --- a/net/ftp/ftp_directory_listing_buffer_unittest.cc +++ b/net/ftp/ftp_directory_listing_buffer_unittest.cc @@ -19,9 +19,6 @@ namespace { TEST(FtpDirectoryListingBufferTest, Parse) { const char* test_files[] = { - "dir-listing-hprc-1", - "dir-listing-hprc-2", - "dir-listing-hprc-3", "dir-listing-ls-1", "dir-listing-ls-1-utf8", "dir-listing-ls-2", @@ -45,8 +42,6 @@ TEST(FtpDirectoryListingBufferTest, Parse) { "dir-listing-ls-20", // TODO(phajdan.jr): should use windows-1251 encoding. "dir-listing-ls-21", // TODO(phajdan.jr): should use windows-1251 encoding. "dir-listing-ls-22", // TODO(phajdan.jr): should use windows-1251 encoding. - "dir-listing-mlsd-1", - "dir-listing-mlsd-2", "dir-listing-netware-1", "dir-listing-netware-2", "dir-listing-vms-1", diff --git a/net/ftp/ftp_directory_listing_parser_hprc.cc b/net/ftp/ftp_directory_listing_parser_hprc.cc deleted file mode 100644 index 621aba1..0000000 --- a/net/ftp/ftp_directory_listing_parser_hprc.cc +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/ftp/ftp_directory_listing_parser_hprc.h" - -#include "base/logging.h" -#include "base/time.h" - -namespace net { - -FtpDirectoryListingParserHprc::FtpDirectoryListingParserHprc( - const base::Time& current_time) - : current_time_(current_time) { -} - -FtpDirectoryListingParserHprc::~FtpDirectoryListingParserHprc() {} - -FtpServerType FtpDirectoryListingParserHprc::GetServerType() const { - return SERVER_HPRC; -} - -bool FtpDirectoryListingParserHprc::ConsumeLine(const string16& line) { - if (line.empty()) - return false; - - // All lines begin with a space. - if (line[0] != ' ') - return false; - - FtpDirectoryListingEntry entry; - entry.name = line.substr(1); - - // We don't know anything beyond the file name, so just pick some arbitrary - // values. - // TODO(phajdan.jr): consider adding an UNKNOWN entry type. - entry.type = FtpDirectoryListingEntry::FILE; - entry.size = 0; - entry.last_modified = current_time_; - - entries_.push(entry); - return true; -} - -bool FtpDirectoryListingParserHprc::OnEndOfInput() { - return true; -} - -bool FtpDirectoryListingParserHprc::EntryAvailable() const { - return !entries_.empty(); -} - -FtpDirectoryListingEntry FtpDirectoryListingParserHprc::PopEntry() { - DCHECK(EntryAvailable()); - FtpDirectoryListingEntry entry = entries_.front(); - entries_.pop(); - return entry; -} - -} // namespace net diff --git a/net/ftp/ftp_directory_listing_parser_hprc.h b/net/ftp/ftp_directory_listing_parser_hprc.h deleted file mode 100644 index d153810..0000000 --- a/net/ftp/ftp_directory_listing_parser_hprc.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_ -#define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_ -#pragma once - -#include <queue> - -#include "base/basictypes.h" -#include "base/time.h" -#include "net/ftp/ftp_directory_listing_parser.h" - -namespace net { - -// Parser for directory listings served by HPRC, -// see http://hprc.external.hp.com/ and http://crbug.com/56547. -class FtpDirectoryListingParserHprc : public FtpDirectoryListingParser { - public: - // Constructor. When we need to provide the last modification time - // that we don't know, |current_time| will be used. This allows passing - // a specific date during testing. - explicit FtpDirectoryListingParserHprc(const base::Time& current_time); - virtual ~FtpDirectoryListingParserHprc(); - - // FtpDirectoryListingParser methods: - virtual FtpServerType GetServerType() const; - virtual bool ConsumeLine(const string16& line); - virtual bool OnEndOfInput(); - virtual bool EntryAvailable() const; - virtual FtpDirectoryListingEntry PopEntry(); - - private: - // Store the current time. We use it in place of last modification time - // that is unknown (the server doesn't send it). - const base::Time current_time_; - - std::queue<FtpDirectoryListingEntry> entries_; - - DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserHprc); -}; - -} // namespace net - -#endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_ diff --git a/net/ftp/ftp_directory_listing_parser_hprc_unittest.cc b/net/ftp/ftp_directory_listing_parser_hprc_unittest.cc deleted file mode 100644 index bd057e9..0000000 --- a/net/ftp/ftp_directory_listing_parser_hprc_unittest.cc +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/ftp/ftp_directory_listing_parser_unittest.h" - -#include "base/format_macros.h" -#include "base/string_util.h" -#include "base/stringprintf.h" -#include "net/ftp/ftp_directory_listing_parser_hprc.h" - -namespace { - -typedef net::FtpDirectoryListingParserTest FtpDirectoryListingParserHprcTest; - -TEST_F(FtpDirectoryListingParserHprcTest, Good) { - const struct SingleLineTestData good_cases[] = { - { " .welcome", - net::FtpDirectoryListingEntry::FILE, ".welcome", 0, - 1994, 11, 15, 12, 45 }, - }; - for (size_t i = 0; i < arraysize(good_cases); i++) { - SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, - good_cases[i].input)); - - net::FtpDirectoryListingParserHprc parser(GetMockCurrentTime()); - RunSingleLineTestCase(&parser, good_cases[i]); - } -} - -TEST_F(FtpDirectoryListingParserHprcTest, Bad) { - const char* bad_cases[] = { - "", - "test", - "-rw-r--r-- 1 ftp ftp 528 Nov 01 2007 README", - "d [RWCEAFMS] ftpadmin 512 Jan 29 2004 pub", - "TEST.DIR;1 1 4-MAR-1999 22:14:34 [UCX$NOBO,ANONYMOUS] (RWE,RWE,RWE,RWE)", - "type=dir;modify=20010414155237;UNIX.mode=0555;unique=6ag5b4e400; etc", - }; - for (size_t i = 0; i < arraysize(bad_cases); i++) { - net::FtpDirectoryListingParserHprc parser(GetMockCurrentTime()); - EXPECT_FALSE(parser.ConsumeLine(UTF8ToUTF16(bad_cases[i]))) << bad_cases[i]; - } -} - -} // namespace diff --git a/net/ftp/ftp_directory_listing_parser_mlsd.cc b/net/ftp/ftp_directory_listing_parser_mlsd.cc deleted file mode 100644 index f2558415..0000000 --- a/net/ftp/ftp_directory_listing_parser_mlsd.cc +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/ftp/ftp_directory_listing_parser_mlsd.h" - -#include <map> -#include <vector> - -#include "base/stl_util-inl.h" -#include "base/string_number_conversions.h" -#include "base/string_split.h" -#include "base/string_util.h" -#include "base/utf_string_conversions.h" - -// You can read the specification of the MLSD format at -// http://tools.ietf.org/html/rfc3659#page-23. - -namespace { - -// The MLSD date listing is specified at -// http://tools.ietf.org/html/rfc3659#page-6. -bool MlsdDateListingToTime(const string16& text, base::Time* time) { - base::Time::Exploded time_exploded = { 0 }; - - // We will only test 12 characters, but RFC-3659 requires 14 (we ignore the - // last two digits, which contain the number of seconds). - if (text.length() < 14) - return false; - - if (!base::StringToInt(text.begin(), text.begin() + 4, &time_exploded.year)) - return false; - if (!base::StringToInt(text.begin() + 4, - text.begin() + 6, - &time_exploded.month)) - return false; - if (!base::StringToInt(text.begin() + 6, - text.begin() + 8, - &time_exploded.day_of_month)) - return false; - if (!base::StringToInt(text.begin() + 8, - text.begin() + 10, - &time_exploded.hour)) - return false; - if (!base::StringToInt(text.begin() + 10, - text.begin() + 12, - &time_exploded.minute)) - return false; - - // We don't know the time zone of the server, so just use local time. - *time = base::Time::FromLocalExploded(time_exploded); - return true; -} - -} // namespace - -namespace net { - -FtpDirectoryListingParserMlsd::FtpDirectoryListingParserMlsd() {} - -FtpDirectoryListingParserMlsd::~FtpDirectoryListingParserMlsd() {} - -FtpServerType FtpDirectoryListingParserMlsd::GetServerType() const { - return SERVER_MLSD; -} - -bool FtpDirectoryListingParserMlsd::ConsumeLine(const string16& line) { - // The first space indicates where the filename begins. - string16::size_type first_space_pos = line.find(' '); - if (first_space_pos == string16::npos || first_space_pos < 1) - return false; - - string16 facts_string = line.substr(0, first_space_pos - 1); - string16 filename = line.substr(first_space_pos + 1); - std::vector<string16> facts_split; - base::SplitString(facts_string, ';', &facts_split); - - const char* keys[] = { - "modify", - "size", - "type", - }; - - std::map<std::string, string16> facts; - for (std::vector<string16>::const_iterator i = facts_split.begin(); - i != facts_split.end(); ++i) { - string16::size_type equal_sign_pos = i->find('='); - if (equal_sign_pos == string16::npos) - return false; - string16 key = i->substr(0, equal_sign_pos); - string16 value = i->substr(equal_sign_pos + 1); - - // If we're interested in a key, record its value. Note that we don't detect - // a case when the server is sending duplicate keys. We're not validating - // the input, just parsing it. - for (size_t j = 0; j < arraysize(keys); j++) - if (LowerCaseEqualsASCII(key, keys[j])) - facts[keys[j]] = value; - } - if (!ContainsKey(facts, "type")) - return false; - - FtpDirectoryListingEntry entry; - entry.name = filename; - - if (LowerCaseEqualsASCII(facts["type"], "dir")) { - entry.type = FtpDirectoryListingEntry::DIRECTORY; - entry.size = -1; - } else if (LowerCaseEqualsASCII(facts["type"], "file")) { - entry.type = FtpDirectoryListingEntry::FILE; - if (!ContainsKey(facts, "size")) - return false; - if (!base::StringToInt64(facts["size"], &entry.size)) - return false; - } else { - // Ignore other types of entries. They are either not interesting for us - // (cdir, pdir), or not regular files (OS-specific types). There is no - // specific type for symlink. Symlinks get a type of their target. - return true; - } - - if (!ContainsKey(facts, "modify")) - return false; - if (!MlsdDateListingToTime(facts["modify"], &entry.last_modified)) - return false; - - entries_.push(entry); - return true; -} - -bool FtpDirectoryListingParserMlsd::OnEndOfInput() { - return true; -} - -bool FtpDirectoryListingParserMlsd::EntryAvailable() const { - return !entries_.empty(); -} - -FtpDirectoryListingEntry FtpDirectoryListingParserMlsd::PopEntry() { - DCHECK(EntryAvailable()); - FtpDirectoryListingEntry entry = entries_.front(); - entries_.pop(); - return entry; -} - -} // namespace net diff --git a/net/ftp/ftp_directory_listing_parser_mlsd.h b/net/ftp/ftp_directory_listing_parser_mlsd.h deleted file mode 100644 index 5c11fa0..0000000 --- a/net/ftp/ftp_directory_listing_parser_mlsd.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_MLSD_H_ -#define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_MLSD_H_ -#pragma once - -#include <queue> - -#include "net/ftp/ftp_directory_listing_parser.h" - -namespace net { - -// Parser for MLSD directory listing (RFC-3659). For more info see -// http://tools.ietf.org/html/rfc3659#page-23. -class FtpDirectoryListingParserMlsd : public FtpDirectoryListingParser { - public: - FtpDirectoryListingParserMlsd(); - virtual ~FtpDirectoryListingParserMlsd(); - - // FtpDirectoryListingParser methods: - virtual FtpServerType GetServerType() const; - virtual bool ConsumeLine(const string16& line); - virtual bool OnEndOfInput(); - virtual bool EntryAvailable() const; - virtual FtpDirectoryListingEntry PopEntry(); - - private: - std::queue<FtpDirectoryListingEntry> entries_; - - DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserMlsd); -}; - -} // namespace net - -#endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_MLSD_H_ diff --git a/net/ftp/ftp_directory_listing_parser_mlsd_unittest.cc b/net/ftp/ftp_directory_listing_parser_mlsd_unittest.cc deleted file mode 100644 index f65abc2..0000000 --- a/net/ftp/ftp_directory_listing_parser_mlsd_unittest.cc +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/ftp/ftp_directory_listing_parser_unittest.h" - -#include "base/format_macros.h" -#include "base/string_util.h" -#include "base/stringprintf.h" -#include "net/ftp/ftp_directory_listing_parser_mlsd.h" - -namespace { - -typedef net::FtpDirectoryListingParserTest FtpDirectoryListingParserMlsdTest; - -TEST_F(FtpDirectoryListingParserMlsdTest, Good) { - const struct SingleLineTestData good_cases[] = { - { "type=file;size=380565;modify=20030606190749; README", - net::FtpDirectoryListingEntry::FILE, "README", 380565, - 2003, 6, 6, 19, 7 }, - { "type=dir;sizd=512;modify=20031021200128; pub", - net::FtpDirectoryListingEntry::DIRECTORY, "pub", -1, - 2003, 10, 21, 20, 1 }, - { "type=dir;sizd=512;modify=20091009080706;UNIX.mode=0755; pub", - net::FtpDirectoryListingEntry::DIRECTORY, "pub", -1, - 2009, 10, 9, 8, 7 }, - { "type=dir;modify=20010414155237;UNIX.mode=0555;unique=6ag5b4e400; etc", - net::FtpDirectoryListingEntry::DIRECTORY, "etc", -1, - 2001, 4, 14, 15, 52 }, - }; - for (size_t i = 0; i < arraysize(good_cases); i++) { - SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, - good_cases[i].input)); - - net::FtpDirectoryListingParserMlsd parser; - RunSingleLineTestCase(&parser, good_cases[i]); - } -} - -TEST_F(FtpDirectoryListingParserMlsdTest, Bad) { - const char* bad_cases[] = { - "", - " ", - " ", - ";", - "; ", - " ;", - " foo", - "garbage", - "total 5", - "type=file;size=380565;modify=20030606190749;README", - "type=file;size=380565;modify=20030606190749;", - "type=file;size=380565;modify=20030606190749", - "size=380565;modify=20030606190749; README", - "type=file;modify=20030606190749; README", - "type=file;size=380565; README", - "type=file; size=380565; modify=20030606190749; README", - " type=file;size=380565;modify=20030606190749; README", - "type=file;size=garbage;modify=20030606190749; README", - "type=file;size=380565;modify=garbage; README", - }; - for (size_t i = 0; i < arraysize(bad_cases); i++) { - net::FtpDirectoryListingParserMlsd parser; - EXPECT_FALSE(parser.ConsumeLine(UTF8ToUTF16(bad_cases[i]))) << bad_cases[i]; - } -} - -} // namespace diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index bfda5bd..0285e08 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -371,9 +371,6 @@ int FtpNetworkTransaction::ProcessCtrlResponse() { case COMMAND_CWD: rv = ProcessResponseCWD(response); break; - case COMMAND_MLSD: - rv = ProcessResponseMLSD(response); - break; case COMMAND_LIST: rv = ProcessResponseLIST(response); break; @@ -394,9 +391,6 @@ int FtpNetworkTransaction::ProcessCtrlResponse() { case COMMAND_RETR: rv = ProcessResponseRETR(response); break; - case COMMAND_MLSD: - rv = ProcessResponseMLSD(response); - break; case COMMAND_LIST: rv = ProcessResponseLIST(response); break; @@ -573,10 +567,6 @@ int FtpNetworkTransaction::DoLoop(int result) { DCHECK(rv == OK); rv = DoCtrlWriteCWD(); break; - case STATE_CTRL_WRITE_MLSD: - DCHECK(rv == 0); - rv = DoCtrlWriteMLSD(); - break; case STATE_CTRL_WRITE_LIST: DCHECK(rv == OK); rv = DoCtrlWriteLIST(); @@ -1073,7 +1063,7 @@ int FtpNetworkTransaction::ProcessResponseCWD(const FtpCtrlResponse& response) { case ERROR_CLASS_INITIATED: return Stop(ERR_INVALID_RESPONSE); case ERROR_CLASS_OK: - next_state_ = STATE_CTRL_WRITE_MLSD; + next_state_ = STATE_CTRL_WRITE_LIST; break; case ERROR_CLASS_INFO_NEEDED: return Stop(ERR_INVALID_RESPONSE); @@ -1104,41 +1094,6 @@ int FtpNetworkTransaction::ProcessResponseCWD(const FtpCtrlResponse& response) { return OK; } -// MLSD command -int FtpNetworkTransaction::DoCtrlWriteMLSD() { - next_state_ = STATE_CTRL_READ; - return SendFtpCommand("MLSD", COMMAND_MLSD); -} - -int FtpNetworkTransaction::ProcessResponseMLSD( - const FtpCtrlResponse& response) { - switch (GetErrorClass(response.status_code)) { - case ERROR_CLASS_INITIATED: - // We want the client to start reading the response at this point. - // It got here either through Start or RestartWithAuth. We want that - // method to complete. Not setting next state here will make DoLoop exit - // and in turn make Start/RestartWithAuth complete. - response_.is_directory_listing = true; - break; - case ERROR_CLASS_OK: - response_.is_directory_listing = true; - next_state_ = STATE_CTRL_WRITE_QUIT; - break; - case ERROR_CLASS_INFO_NEEDED: - return Stop(ERR_INVALID_RESPONSE); - case ERROR_CLASS_TRANSIENT_ERROR: - case ERROR_CLASS_PERMANENT_ERROR: - // Fallback to the LIST command, more widely supported, - // but without a specified output format. - next_state_ = STATE_CTRL_WRITE_LIST; - break; - default: - NOTREACHED(); - return Stop(ERR_UNEXPECTED); - } - return OK; -} - // LIST command int FtpNetworkTransaction::DoCtrlWriteLIST() { std::string command(system_type_ == SYSTEM_TYPE_VMS ? "LIST *.*;0" : "LIST"); diff --git a/net/ftp/ftp_network_transaction.h b/net/ftp/ftp_network_transaction.h index 5bad335..678308a 100644 --- a/net/ftp/ftp_network_transaction.h +++ b/net/ftp/ftp_network_transaction.h @@ -58,7 +58,6 @@ class FtpNetworkTransaction : public FtpTransaction { COMMAND_SIZE, COMMAND_RETR, COMMAND_CWD, - COMMAND_MLSD, COMMAND_LIST, COMMAND_QUIT, }; @@ -142,8 +141,6 @@ class FtpNetworkTransaction : public FtpTransaction { int ProcessResponseSIZE(const FtpCtrlResponse& response); int DoCtrlWriteCWD(); int ProcessResponseCWD(const FtpCtrlResponse& response); - int DoCtrlWriteMLSD(); - int ProcessResponseMLSD(const FtpCtrlResponse& response); int DoCtrlWriteLIST(); int ProcessResponseLIST(const FtpCtrlResponse& response); int DoCtrlWriteQUIT(); @@ -234,7 +231,6 @@ class FtpNetworkTransaction : public FtpTransaction { STATE_CTRL_WRITE_RETR, STATE_CTRL_WRITE_SIZE, STATE_CTRL_WRITE_CWD, - STATE_CTRL_WRITE_MLSD, STATE_CTRL_WRITE_LIST, STATE_CTRL_WRITE_QUIT, // Data connection states: diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc index 1c22c5b..8da3baf 100644 --- a/net/ftp/ftp_network_transaction_unittest.cc +++ b/net/ftp/ftp_network_transaction_unittest.cc @@ -41,7 +41,6 @@ class FtpSocketDataProvider : public DynamicSocketDataProvider { PRE_SIZE, PRE_EPSV, PRE_PASV, - PRE_MLSD, PRE_LIST, PRE_RETR, PRE_CWD, @@ -189,11 +188,7 @@ class FtpSocketDataProviderDirectoryListing : public FtpSocketDataProvider { return Verify("SIZE /\r\n", data, PRE_CWD, "550 I can only retrieve regular files\r\n"); case PRE_CWD: - return Verify("CWD /\r\n", data, PRE_MLSD, "200 OK\r\n"); - case PRE_MLSD: - return Verify("MLSD\r\n", data, PRE_QUIT, - "150 Accepted data connection\r\n" - "226 MLSD complete\r\n"); + return Verify("CWD /\r\n", data, PRE_LIST, "200 OK\r\n"); case PRE_LIST: return Verify("LIST\r\n", data, PRE_QUIT, "200 OK\r\n"); default: @@ -275,10 +270,8 @@ class FtpSocketDataProviderVMSDirectoryListing : public FtpSocketDataProvider { return Verify("SIZE ANONYMOUS_ROOT:[000000]dir\r\n", data, PRE_CWD, "550 I can only retrieve regular files\r\n"); case PRE_CWD: - return Verify("CWD ANONYMOUS_ROOT:[dir]\r\n", data, PRE_MLSD, + return Verify("CWD ANONYMOUS_ROOT:[dir]\r\n", data, PRE_LIST, "200 OK\r\n"); - case PRE_MLSD: - return Verify("MLSD\r\n", data, PRE_LIST, "500 Invalid command\r\n"); case PRE_LIST: return Verify("LIST *.*;0\r\n", data, PRE_QUIT, "200 OK\r\n"); default: @@ -315,10 +308,8 @@ class FtpSocketDataProviderVMSDirectoryListingRootDirectory return Verify("SIZE ANONYMOUS_ROOT\r\n", data, PRE_CWD, "550 I can only retrieve regular files\r\n"); case PRE_CWD: - return Verify("CWD ANONYMOUS_ROOT:[000000]\r\n", data, PRE_MLSD, + return Verify("CWD ANONYMOUS_ROOT:[000000]\r\n", data, PRE_LIST, "200 OK\r\n"); - case PRE_MLSD: - return Verify("MLSD\r\n", data, PRE_LIST, "500 Invalid command\r\n"); case PRE_LIST: return Verify("LIST *.*;0\r\n", data, PRE_QUIT, "200 OK\r\n"); default: @@ -1329,16 +1320,6 @@ TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailCwd) { ERR_FTP_FAILED); } -TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailMlsd) { - FtpSocketDataProviderDirectoryListing ctrl_socket; - TransactionFailHelper(&ctrl_socket, - "ftp://host", - FtpSocketDataProvider::PRE_MLSD, - FtpSocketDataProvider::PRE_LIST, - "500 Unrecognized command\r\n", - OK); -} - TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailList) { FtpSocketDataProviderVMSDirectoryListing ctrl_socket; // Use unallocated 599 FTP error code to make sure it falls into the generic diff --git a/net/ftp/ftp_server_type_histograms.h b/net/ftp/ftp_server_type_histograms.h index 6a856b1..e89ad3d 100644 --- a/net/ftp/ftp_server_type_histograms.h +++ b/net/ftp/ftp_server_type_histograms.h @@ -24,8 +24,8 @@ enum FtpServerType { SERVER_WINDOWS = 10, // Server using Windows listing style. SERVER_VMS = 11, // Server using VMS listing style. SERVER_NETWARE = 12, // Server using Netware listing style. - SERVER_MLSD = 13, // Server using MLSD listing (RFC-3659). - SERVER_HPRC = 14, // Server using HPRC listing (http://crbug.com/56547). + + // Types 13-14 are RESERVED (were earlier used for MLSD listings). NUM_OF_SERVER_TYPES }; |