OLD | NEW |
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_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 if (closing_paren_pos == std::string::npos) | 175 if (closing_paren_pos == std::string::npos) |
176 return false; | 176 return false; |
177 if (closing_paren_pos <= paren_pos) | 177 if (closing_paren_pos <= paren_pos) |
178 return false; | 178 return false; |
179 | 179 |
180 line = line.substr(paren_pos + 1, closing_paren_pos - paren_pos - 1); | 180 line = line.substr(paren_pos + 1, closing_paren_pos - paren_pos - 1); |
181 } | 181 } |
182 | 182 |
183 // Split the line into comma-separated pieces and extract | 183 // Split the line into comma-separated pieces and extract |
184 // the last two. | 184 // the last two. |
185 std::vector<std::string> pieces; | 185 std::vector<base::StringPiece> pieces = base::SplitStringPiece( |
186 base::SplitString(line, ',', &pieces); | 186 line, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
187 if (pieces.size() != 6) | 187 if (pieces.size() != 6) |
188 return false; | 188 return false; |
189 | 189 |
190 // Ignore the IP address supplied in the response. We are always going | 190 // Ignore the IP address supplied in the response. We are always going |
191 // to connect back to the same server to prevent FTP PASV port scanning. | 191 // to connect back to the same server to prevent FTP PASV port scanning. |
192 int p0, p1; | 192 int p0, p1; |
193 if (!base::StringToInt(pieces[4], &p0)) | 193 if (!base::StringToInt(pieces[4], &p0)) |
194 return false; | 194 return false; |
195 if (!base::StringToInt(pieces[5], &p1)) | 195 if (!base::StringToInt(pieces[5], &p1)) |
196 return false; | 196 return false; |
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 if (!had_error_type[type]) { | 1372 if (!had_error_type[type]) { |
1373 had_error_type[type] = true; | 1373 had_error_type[type] = true; |
1374 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", | 1374 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", |
1375 type, NUM_OF_NET_ERROR_TYPES); | 1375 type, NUM_OF_NET_ERROR_TYPES); |
1376 } | 1376 } |
1377 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", | 1377 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", |
1378 type, NUM_OF_NET_ERROR_TYPES); | 1378 type, NUM_OF_NET_ERROR_TYPES); |
1379 } | 1379 } |
1380 | 1380 |
1381 } // namespace net | 1381 } // namespace net |
OLD | NEW |