Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: net/ftp/ftp_directory_listing_parsers.cc

Issue 368006: Fix the "ls -l" FTP LIST format parser to understand correctly (Closed)
Patch Set: make the code more obvious Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ftp/ftp_directory_listing_parsers.h ('k') | net/ftp/ftp_directory_listing_parsers_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_directory_listing_parsers.cc
diff --git a/net/ftp/ftp_directory_listing_parsers.cc b/net/ftp/ftp_directory_listing_parsers.cc
index 5f160e34d871c3ecdc4a47bfd7e080013dd422f0..41493906bdca20887eea6ed28098d2dce8efe96c 100644
--- a/net/ftp/ftp_directory_listing_parsers.cc
+++ b/net/ftp/ftp_directory_listing_parsers.cc
@@ -236,10 +236,18 @@ namespace net {
FtpDirectoryListingParser::~FtpDirectoryListingParser() {
}
-FtpLsDirectoryListingParser::FtpLsDirectoryListingParser() {
+FtpLsDirectoryListingParser::FtpLsDirectoryListingParser()
+ : received_nonempty_line_(false) {
}
bool FtpLsDirectoryListingParser::ConsumeLine(const string16& line) {
+ // Allow empty lines only at the beginning of the listing. For example VMS
+ // systems in Unix emulation mode add an empty line before the first listing
+ // entry.
+ if (line.empty() && !received_nonempty_line_)
+ return true;
+ received_nonempty_line_ = true;
+
std::vector<string16> columns;
SplitString(CollapseWhitespace(line, false), ' ', &columns);
if (columns.size() == 11) {
« no previous file with comments | « net/ftp/ftp_directory_listing_parsers.h ('k') | net/ftp/ftp_directory_listing_parsers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698