summaryrefslogtreecommitdiffstats
path: root/net/ftp
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-03 08:52:15 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-03 08:52:15 +0000
commit031f1cc393cc95708a26f466168999077e1e4d22 (patch)
tree6b53f4c4804f10bef4fcec006f8441dbe12c6a35 /net/ftp
parentfa2416f338e2462084948d20ba7d388fb5bb0204 (diff)
downloadchromium_src-031f1cc393cc95708a26f466168999077e1e4d22.zip
chromium_src-031f1cc393cc95708a26f466168999077e1e4d22.tar.gz
chromium_src-031f1cc393cc95708a26f466168999077e1e4d22.tar.bz2
FTP: Fix a compatibility issue with Plan9
BUG=80970 TEST=Visit ftp://plan9.bell-labs.com/, the directory listing should be displayed. Review URL: http://codereview.chromium.org/6903166 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp')
-rw-r--r--net/ftp/ftp_directory_listing_parser_ls.cc7
-rw-r--r--net/ftp/ftp_directory_listing_parser_ls_unittest.cc11
2 files changed, 11 insertions, 7 deletions
diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc
index f7ad6ac..b256da6 100644
--- a/net/ftp/ftp_directory_listing_parser_ls.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls.cc
@@ -36,10 +36,9 @@ bool LooksLikeUnixPermissionsListing(const string16& text) {
if (text.length() < 10)
return false;
- if (text[0] != 'b' && text[0] != 'c' && text[0] != 'd' &&
- text[0] != 'l' && text[0] != 'p' && text[0] != 's' &&
- text[0] != '-')
- return false;
+ // Do not check the first character (entry type). There are many weird
+ // servers that use special file types (for example Plan9 and append-only
+ // files). Fortunately, the rest of the permission listing is more consistent.
// Do not check the rest of the string. Some servers fail to properly
// separate this column from the next column (number of links), resulting
diff --git a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
index c05e691..43562aa 100644
--- a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
@@ -92,17 +92,22 @@ TEST_F(FtpDirectoryListingParserLsTest, Good) {
// Tests for "ls -l" style listing with group name containing spaces.
{ "drwxrwxr-x 3 %%%% Domain Users 4096 Dec 9 2009 %%%%%",
- net::FtpDirectoryListingEntry::DIRECTORY, "%%%%%", -1,
+ FtpDirectoryListingEntry::DIRECTORY, "%%%%%", -1,
2009, 12, 9, 0, 0 },
// Tests for "ls -l" style listing in Russian locale (note the swapped
// parts order: the day of month is the first, before month).
{ "-rwxrwxr-x 1 ftp ftp 123 23 \xd0\xbc\xd0\xb0\xd0\xb9 2011 test",
- net::FtpDirectoryListingEntry::FILE, "test", 123,
+ FtpDirectoryListingEntry::FILE, "test", 123,
2011, 5, 23, 0, 0 },
{ "drwxrwxr-x 1 ftp ftp 4096 19 \xd0\xbe\xd0\xba\xd1\x82 2011 dir",
- net::FtpDirectoryListingEntry::DIRECTORY, "dir", -1,
+ FtpDirectoryListingEntry::DIRECTORY, "dir", -1,
2011, 10, 19, 0, 0 },
+
+ // Plan9 sends entry type "a" for append-only files.
+ { "ar-xr-xr-x 2 none none 512 Apr 26 17:52 plan9",
+ FtpDirectoryListingEntry::FILE, "plan9", 512,
+ 1994, 4, 26, 17, 52 },
};
for (size_t i = 0; i < arraysize(good_cases); i++) {
SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,