diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 07:28:08 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 07:28:08 +0000 |
commit | 17e486276dbd406991818e1421d9d755cab8b63a (patch) | |
tree | 54c907311bfd07757c5a9ab5bf9aea0fa8f0b71d /net | |
parent | 03a99f910bcf7b5bb1a9f795b5633803644b4794 (diff) | |
download | chromium_src-17e486276dbd406991818e1421d9d755cab8b63a.zip chromium_src-17e486276dbd406991818e1421d9d755cab8b63a.tar.gz chromium_src-17e486276dbd406991818e1421d9d755cab8b63a.tar.bz2 |
Fix FTP directory listing for ftp.cisco.com.
BUG=58963
TEST=net_unittests
Review URL: http://codereview.chromium.org/3774002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/data/ftp/dir-listing-ls-18 | 3 | ||||
-rw-r--r-- | net/data/ftp/dir-listing-ls-18.expected | 26 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_buffer_unittest.cc | 1 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_parser_ls.cc | 11 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_parser_ls_unittest.cc | 6 |
5 files changed, 45 insertions, 2 deletions
diff --git a/net/data/ftp/dir-listing-ls-18 b/net/data/ftp/dir-listing-ls-18 new file mode 100644 index 0000000..a504074 --- /dev/null +++ b/net/data/ftp/dir-listing-ls-18 @@ -0,0 +1,3 @@ +-rw-r--r-- 1 ftpadmin ftpadmin125435904 Apr 9 2008 .pureftpd-upload.47fcbb3c.849.191b.cd40d08a +-rw-r--r-- 1 ftpadmin ftpadmin153198592 Nov 20 2008 .pureftpd-upload.4925a00d.849.668d.9ea5b3ed +-rw-r--r-- 1 ftpadmin ftpadmin 8760 Nov 24 2008 .pureftpd-upload.492b0a03.849.12d.bf5d2bc6 diff --git a/net/data/ftp/dir-listing-ls-18.expected b/net/data/ftp/dir-listing-ls-18.expected new file mode 100644 index 0000000..41ba4c2 --- /dev/null +++ b/net/data/ftp/dir-listing-ls-18.expected @@ -0,0 +1,26 @@ +- +.pureftpd-upload.47fcbb3c.849.191b.cd40d08a +0 +2008 +4 +9 +0 +0 + +- +.pureftpd-upload.4925a00d.849.668d.9ea5b3ed +0 +2008 +11 +20 +0 +0 + +- +.pureftpd-upload.492b0a03.849.12d.bf5d2bc6 +8760 +2008 +11 +24 +0 +0 diff --git a/net/ftp/ftp_directory_listing_buffer_unittest.cc b/net/ftp/ftp_directory_listing_buffer_unittest.cc index ac62587..86fc6e7 100644 --- a/net/ftp/ftp_directory_listing_buffer_unittest.cc +++ b/net/ftp/ftp_directory_listing_buffer_unittest.cc @@ -40,6 +40,7 @@ TEST(FtpDirectoryListingBufferTest, Parse) { "dir-listing-ls-15", "dir-listing-ls-16", "dir-listing-ls-17", + "dir-listing-ls-18", "dir-listing-mlsd-1", "dir-listing-mlsd-2", "dir-listing-netware-1", diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc index b8061a3..9fd2400 100644 --- a/net/ftp/ftp_directory_listing_parser_ls.cc +++ b/net/ftp/ftp_directory_listing_parser_ls.cc @@ -140,8 +140,15 @@ bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) { entry.type = FtpDirectoryListingEntry::FILE; } - if (!base::StringToInt64(columns[2 + column_offset], &entry.size)) - return false; + if (!base::StringToInt64(columns[2 + column_offset], &entry.size)) { + // Some FTP servers do not separate owning group name from file size, + // like "group1234". We still want to display the file name for that entry, + // but can't really get the size (What if the group is named "group1", + // and the size is in fact 234? We can't distinguish between that + // and "group" with size 1234). Use a dummy value for the size. + // TODO(phajdan.jr): Use a value that means "unknown" instead of 0 bytes. + entry.size = 0; + } if (entry.size < 0) return false; if (entry.type != FtpDirectoryListingEntry::FILE) diff --git a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc index 72450d7..4b36544 100644 --- a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc +++ b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc @@ -75,6 +75,12 @@ TEST_F(FtpDirectoryListingParserLsTest, Good) { { "drwxr-xr-x folder 0 Jul 17 2006 online", net::FtpDirectoryListingEntry::DIRECTORY, "online", -1, 2006, 7, 17, 0, 0 }, + + // Tests for "ls -l" style listing with owning group name + // not separated from file size (http://crbug.com/58963). + { "-rw-r--r-- 1 ftpadmin ftpadmin125435904 Apr 9 2008 .pureftpd-upload", + net::FtpDirectoryListingEntry::FILE, ".pureftpd-upload", 0, + 2008, 4, 9, 0, 0 }, }; for (size_t i = 0; i < arraysize(good_cases); i++) { SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, |