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

Side by Side Diff: net/ftp/ftp_directory_listing_parser_hprc.cc

Issue 5669001: FTP: fix compatibility problems with MLSD by removing MLSD support. (Closed)
Patch Set: Created 10 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/ftp/ftp_directory_listing_parser_hprc.h"
6
7 #include "base/logging.h"
8 #include "base/time.h"
9
10 namespace net {
11
12 FtpDirectoryListingParserHprc::FtpDirectoryListingParserHprc(
13 const base::Time& current_time)
14 : current_time_(current_time) {
15 }
16
17 FtpDirectoryListingParserHprc::~FtpDirectoryListingParserHprc() {}
18
19 FtpServerType FtpDirectoryListingParserHprc::GetServerType() const {
20 return SERVER_HPRC;
21 }
22
23 bool FtpDirectoryListingParserHprc::ConsumeLine(const string16& line) {
24 if (line.empty())
25 return false;
26
27 // All lines begin with a space.
28 if (line[0] != ' ')
29 return false;
30
31 FtpDirectoryListingEntry entry;
32 entry.name = line.substr(1);
33
34 // We don't know anything beyond the file name, so just pick some arbitrary
35 // values.
36 // TODO(phajdan.jr): consider adding an UNKNOWN entry type.
37 entry.type = FtpDirectoryListingEntry::FILE;
38 entry.size = 0;
39 entry.last_modified = current_time_;
40
41 entries_.push(entry);
42 return true;
43 }
44
45 bool FtpDirectoryListingParserHprc::OnEndOfInput() {
46 return true;
47 }
48
49 bool FtpDirectoryListingParserHprc::EntryAvailable() const {
50 return !entries_.empty();
51 }
52
53 FtpDirectoryListingEntry FtpDirectoryListingParserHprc::PopEntry() {
54 DCHECK(EntryAvailable());
55 FtpDirectoryListingEntry entry = entries_.front();
56 entries_.pop();
57 return entry;
58 }
59
60 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698