| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 base::StringPiece epsv_line(response.lines[0]); | 128 base::StringPiece epsv_line(response.lines[0]); |
| 129 size_t start = epsv_line.find('('); | 129 size_t start = epsv_line.find('('); |
| 130 // If the line doesn't have a '(' or doesn't have enough characters after the | 130 // If the line doesn't have a '(' or doesn't have enough characters after the |
| 131 // first '(', fail. | 131 // first '(', fail. |
| 132 if (start == base::StringPiece::npos || epsv_line.length() - start < 7) | 132 if (start == base::StringPiece::npos || epsv_line.length() - start < 7) |
| 133 return false; | 133 return false; |
| 134 | 134 |
| 135 char separator = epsv_line[start + 1]; | 135 char separator = epsv_line[start + 1]; |
| 136 | 136 |
| 137 // Make sure we have "(<d><d><d>...", where <d> is not a number. | 137 // Make sure we have "(<d><d><d>...", where <d> is not a number. |
| 138 if (isdigit(separator) || epsv_line[start + 2] != separator || | 138 if ((separator >= '0' && separator <= '9') || |
| 139 epsv_line[start + 3] != separator) { | 139 epsv_line[start + 2] != separator || epsv_line[start + 3] != separator) { |
| 140 return false; | 140 return false; |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Skip over those characters. | 143 // Skip over those characters. |
| 144 start += 4; | 144 start += 4; |
| 145 | 145 |
| 146 // Make sure there's a terminal <d>. | 146 // Make sure there's a terminal <d>. |
| 147 size_t end = epsv_line.find(separator, start); | 147 size_t end = epsv_line.find(separator, start); |
| 148 if (end == base::StringPiece::npos) | 148 if (end == base::StringPiece::npos) |
| 149 return false; | 149 return false; |
| (...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 if (!had_error_type[type]) { | 1361 if (!had_error_type[type]) { |
| 1362 had_error_type[type] = true; | 1362 had_error_type[type] = true; |
| 1363 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", | 1363 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", |
| 1364 type, NUM_OF_NET_ERROR_TYPES); | 1364 type, NUM_OF_NET_ERROR_TYPES); |
| 1365 } | 1365 } |
| 1366 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", | 1366 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", |
| 1367 type, NUM_OF_NET_ERROR_TYPES); | 1367 type, NUM_OF_NET_ERROR_TYPES); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 } // namespace net | 1370 } // namespace net |
| OLD | NEW |