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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 switch (GetErrorClass(response.status_code)) { | 813 switch (GetErrorClass(response.status_code)) { |
814 case ERROR_CLASS_INITIATED: | 814 case ERROR_CLASS_INITIATED: |
815 return Stop(ERR_INVALID_RESPONSE); | 815 return Stop(ERR_INVALID_RESPONSE); |
816 case ERROR_CLASS_OK: { | 816 case ERROR_CLASS_OK: { |
817 // All important info should be on the first line. | 817 // All important info should be on the first line. |
818 std::string line = response.lines[0]; | 818 std::string line = response.lines[0]; |
819 // The response should be ASCII, which allows us to do case-insensitive | 819 // The response should be ASCII, which allows us to do case-insensitive |
820 // comparisons easily. If it is not ASCII, we leave the system type | 820 // comparisons easily. If it is not ASCII, we leave the system type |
821 // as unknown. | 821 // as unknown. |
822 if (base::IsStringASCII(line)) { | 822 if (base::IsStringASCII(line)) { |
823 line = base::StringToLowerASCII(line); | 823 line = base::ToLowerASCII(line); |
824 | 824 |
825 // Remove all whitespace, to correctly handle cases like fancy "V M S" | 825 // Remove all whitespace, to correctly handle cases like fancy "V M S" |
826 // response instead of "VMS". | 826 // response instead of "VMS". |
827 base::RemoveChars(line, base::kWhitespaceASCII, &line); | 827 base::RemoveChars(line, base::kWhitespaceASCII, &line); |
828 | 828 |
829 // The "magic" strings we test for below have been gathered by an | 829 // The "magic" strings we test for below have been gathered by an |
830 // empirical study. VMS needs to come first because some VMS systems | 830 // empirical study. VMS needs to come first because some VMS systems |
831 // also respond with "UNIX emulation", which is not perfect. It is much | 831 // also respond with "UNIX emulation", which is not perfect. It is much |
832 // more reliable to talk to these servers in their native language. | 832 // more reliable to talk to these servers in their native language. |
833 if (line.find("vms") != std::string::npos) { | 833 if (line.find("vms") != std::string::npos) { |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 if (!had_error_type[type]) { | 1373 if (!had_error_type[type]) { |
1374 had_error_type[type] = true; | 1374 had_error_type[type] = true; |
1375 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", | 1375 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", |
1376 type, NUM_OF_NET_ERROR_TYPES); | 1376 type, NUM_OF_NET_ERROR_TYPES); |
1377 } | 1377 } |
1378 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", | 1378 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", |
1379 type, NUM_OF_NET_ERROR_TYPES); | 1379 type, NUM_OF_NET_ERROR_TYPES); |
1380 } | 1380 } |
1381 | 1381 |
1382 } // namespace net | 1382 } // namespace net |
OLD | NEW |