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

Unified Diff: net/ftp/ftp_util.cc

Issue 11418296: FTP: misc fixes resulting from my testing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixes Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_vms.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_util.cc
diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc
index f6bdf2f83db9de6946abef3e940b0ec81c3a6c84..febb35036e1e29830442bdb6ca1761fbdbfa8e63 100644
--- a/net/ftp/ftp_util.cc
+++ b/net/ftp/ftp_util.cc
@@ -203,8 +203,15 @@ bool FtpUtil::LsDateListingToTime(const string16& month, const string16& day,
base::Time* result) {
base::Time::Exploded time_exploded = { 0 };
- if (!AbbreviatedMonthToNumber(month, &time_exploded.month))
- return false;
+ if (!AbbreviatedMonthToNumber(month, &time_exploded.month)) {
+ // Work around garbage sent by some servers in the same column
+ // as the month. Take just last 3 characters of the string.
+ if (month.length() < 3 ||
+ !AbbreviatedMonthToNumber(month.substr(month.length() - 3),
+ &time_exploded.month)) {
+ return false;
+ }
+ }
if (!base::StringToInt(day, &time_exploded.day_of_month))
return false;
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_vms.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698