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

Issue 4182002: FTP: fix directory listing parser for ftp://ftp.dd-wrt.com/others/juno6/ (Closed)

Created:
10 years, 1 month ago by Paweł Hajdan Jr.
Modified:
9 years, 7 months ago
Reviewers:
eroman, wtc
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

FTP: fix directory listing parser for ftp://ftp.dd-wrt.com/others/juno6/ Now the "ls -l" parser ignores lines with empty file names instead of failing. BUG=60065 TEST=net_unittests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=64208

Patch Set 1 #

Patch Set 2 : typo #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+42 lines, -7 lines) Patch
A net/data/ftp/dir-listing-ls-19 View 1 chunk +2 lines, -0 lines 1 comment Download
A net/data/ftp/dir-listing-ls-19.expected View 1 chunk +8 lines, -0 lines 0 comments Download
M net/ftp/ftp_directory_listing_buffer_unittest.cc View 1 chunk +1 line, -0 lines 0 comments Download
M net/ftp/ftp_directory_listing_parser_ls.cc View 1 2 chunks +9 lines, -1 line 2 comments Download
M net/ftp/ftp_directory_listing_parser_ls_unittest.cc View 2 chunks +22 lines, -6 lines 2 comments Download

Messages

Total messages: 4 (0 generated)
Paweł Hajdan Jr.
10 years, 1 month ago (2010-10-26 14:11:14 UTC) #1
Paweł Hajdan Jr.
ping
10 years, 1 month ago (2010-10-27 09:36:22 UTC) #2
wtc
LGTM. http://codereview.chromium.org/4182002/diff/3001/4001 File net/data/ftp/dir-listing-ls-19 (right): http://codereview.chromium.org/4182002/diff/3001/4001#newcode1 net/data/ftp/dir-listing-ls-19:1: drwxr-xr-x 2 0 0 4096 Mar 18 2007 ...
10 years, 1 month ago (2010-10-28 01:05:41 UTC) #3
Paweł Hajdan Jr.
10 years, 1 month ago (2010-10-28 07:15:34 UTC) #4
http://codereview.chromium.org/4182002/diff/3001/4004
File net/ftp/ftp_directory_listing_parser_ls.cc (right):

http://codereview.chromium.org/4182002/diff/3001/4004#newcode130
net/ftp/ftp_directory_listing_parser_ls.cc:130: if (columns.size() < 6U +
column_offset)
On 2010/10/28 01:05:41, wtc wrote:
> It would be nice to document what are the 6 columns that
> should normally be there.

Good idea, done.

http://codereview.chromium.org/4182002/diff/3001/4005
File net/ftp/ftp_directory_listing_parser_ls_unittest.cc (right):

http://codereview.chromium.org/4182002/diff/3001/4005#newcode109
net/ftp/ftp_directory_listing_parser_ls_unittest.cc:109:
EXPECT_TRUE(parser.ConsumeLine(UTF8ToUTF16(ignored_cases[i])));
On 2010/10/28 01:05:41, wtc wrote:
> In the original code, we EXPECT_FALSE here (see line 124 of
> the original code).  Why do we EXPECT_TRUE now?  Just curious.

When ConsumeLine returns false, it means that the parser doesn't recognize the
listing format. In this case we do recognize the format, but the line is
useless. Note that this test also verifies that the parser does not generate any
listing entries for the input.

Previously, the parser was failing on the input with empty file names, and that
was the root cause of the bug.

I prefer to explicitly ignore lines that we want to ignore rather than all lines
that we don't recognize (that's what Firefox does), because it can lead to
silently "eating" some listing lines. We had a bug earlier (fixed now), that
Chrome was failing to parse the listing with an error (and a link to the raw
listing), while Firefox was silently ignoring and not displaying some lines,
making the problem much harder to detect.

Powered by Google App Engine
This is Rietveld 408576698