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

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

Issue 11364204: FTP: fix compatibility with mod_ftp's LISTisNLST option. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/ftp/ftp_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/ftp/ftp_network_transaction.h" 5 #include "net/ftp/ftp_network_transaction.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 // type is. It could still be file, and SIZE could fail because of 1142 // type is. It could still be file, and SIZE could fail because of
1143 // an access error (http://crbug.com/56734). Try RETR just to be sure. 1143 // an access error (http://crbug.com/56734). Try RETR just to be sure.
1144 resource_type_ = RESOURCE_TYPE_FILE; 1144 resource_type_ = RESOURCE_TYPE_FILE;
1145 next_state_ = STATE_CTRL_WRITE_RETR; 1145 next_state_ = STATE_CTRL_WRITE_RETR;
1146 1146
1147 return OK; 1147 return OK;
1148 } 1148 }
1149 1149
1150 // LIST command 1150 // LIST command
1151 int FtpNetworkTransaction::DoCtrlWriteLIST() { 1151 int FtpNetworkTransaction::DoCtrlWriteLIST() {
1152 std::string command(system_type_ == SYSTEM_TYPE_VMS ? "LIST *.*;0" : "LIST"); 1152 // Use the -l option for mod_ftp configured in LISTIsNLST mode: the option
1153 // forces LIST output instead of NLST (which would be ambiguous for us
1154 // to parse).
1155 std::string command("LIST -l");
1156 if (system_type_ == SYSTEM_TYPE_VMS)
1157 command = "LIST *.*;0";
1158
1153 next_state_ = STATE_CTRL_READ; 1159 next_state_ = STATE_CTRL_READ;
1154 return SendFtpCommand(command, command, COMMAND_LIST); 1160 return SendFtpCommand(command, command, COMMAND_LIST);
1155 } 1161 }
1156 1162
1157 int FtpNetworkTransaction::ProcessResponseLIST( 1163 int FtpNetworkTransaction::ProcessResponseLIST(
1158 const FtpCtrlResponse& response) { 1164 const FtpCtrlResponse& response) {
1159 switch (GetErrorClass(response.status_code)) { 1165 switch (GetErrorClass(response.status_code)) {
1160 case ERROR_CLASS_INITIATED: 1166 case ERROR_CLASS_INITIATED:
1161 // We want the client to start reading the response at this point. 1167 // We want the client to start reading the response at this point.
1162 // It got here either through Start or RestartWithAuth. We want that 1168 // It got here either through Start or RestartWithAuth. We want that
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 if (!had_error_type[type]) { 1354 if (!had_error_type[type]) {
1349 had_error_type[type] = true; 1355 had_error_type[type] = true;
1350 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", 1356 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened",
1351 type, NUM_OF_NET_ERROR_TYPES); 1357 type, NUM_OF_NET_ERROR_TYPES);
1352 } 1358 }
1353 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", 1359 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount",
1354 type, NUM_OF_NET_ERROR_TYPES); 1360 type, NUM_OF_NET_ERROR_TYPES);
1355 } 1361 }
1356 1362
1357 } // namespace net 1363 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/ftp/ftp_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698