| 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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 if (!IsValidFTPCommandString(command)) | 746 if (!IsValidFTPCommandString(command)) |
| 747 return Stop(ERR_MALFORMED_IDENTITY); | 747 return Stop(ERR_MALFORMED_IDENTITY); |
| 748 | 748 |
| 749 next_state_ = STATE_CTRL_READ; | 749 next_state_ = STATE_CTRL_READ; |
| 750 return SendFtpCommand(command, "USER ***", COMMAND_USER); | 750 return SendFtpCommand(command, "USER ***", COMMAND_USER); |
| 751 } | 751 } |
| 752 | 752 |
| 753 int FtpNetworkTransaction::ProcessResponseUSER( | 753 int FtpNetworkTransaction::ProcessResponseUSER( |
| 754 const FtpCtrlResponse& response) { | 754 const FtpCtrlResponse& response) { |
| 755 switch (GetErrorClass(response.status_code)) { | 755 switch (GetErrorClass(response.status_code)) { |
| 756 case ERROR_CLASS_INITIATED: |
| 757 return Stop(ERR_INVALID_RESPONSE); |
| 756 case ERROR_CLASS_OK: | 758 case ERROR_CLASS_OK: |
| 757 next_state_ = STATE_CTRL_WRITE_SYST; | 759 next_state_ = STATE_CTRL_WRITE_SYST; |
| 758 break; | 760 break; |
| 759 case ERROR_CLASS_INFO_NEEDED: | 761 case ERROR_CLASS_INFO_NEEDED: |
| 760 next_state_ = STATE_CTRL_WRITE_PASS; | 762 next_state_ = STATE_CTRL_WRITE_PASS; |
| 761 break; | 763 break; |
| 762 case ERROR_CLASS_TRANSIENT_ERROR: | 764 case ERROR_CLASS_TRANSIENT_ERROR: |
| 763 case ERROR_CLASS_PERMANENT_ERROR: | 765 case ERROR_CLASS_PERMANENT_ERROR: |
| 764 response_.needs_auth = true; | 766 response_.needs_auth = true; |
| 765 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 767 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 766 default: | |
| 767 NOTREACHED(); | |
| 768 return Stop(ERR_UNEXPECTED); | |
| 769 } | 768 } |
| 770 return OK; | 769 return OK; |
| 771 } | 770 } |
| 772 | 771 |
| 773 // PASS command. | 772 // PASS command. |
| 774 int FtpNetworkTransaction::DoCtrlWritePASS() { | 773 int FtpNetworkTransaction::DoCtrlWritePASS() { |
| 775 std::string command = "PASS " + base::UTF16ToUTF8(credentials_.password()); | 774 std::string command = "PASS " + base::UTF16ToUTF8(credentials_.password()); |
| 776 | 775 |
| 777 if (!IsValidFTPCommandString(command)) | 776 if (!IsValidFTPCommandString(command)) |
| 778 return Stop(ERR_MALFORMED_IDENTITY); | 777 return Stop(ERR_MALFORMED_IDENTITY); |
| 779 | 778 |
| 780 next_state_ = STATE_CTRL_READ; | 779 next_state_ = STATE_CTRL_READ; |
| 781 return SendFtpCommand(command, "PASS ***", COMMAND_PASS); | 780 return SendFtpCommand(command, "PASS ***", COMMAND_PASS); |
| 782 } | 781 } |
| 783 | 782 |
| 784 int FtpNetworkTransaction::ProcessResponsePASS( | 783 int FtpNetworkTransaction::ProcessResponsePASS( |
| 785 const FtpCtrlResponse& response) { | 784 const FtpCtrlResponse& response) { |
| 786 switch (GetErrorClass(response.status_code)) { | 785 switch (GetErrorClass(response.status_code)) { |
| 786 case ERROR_CLASS_INITIATED: |
| 787 return Stop(ERR_INVALID_RESPONSE); |
| 787 case ERROR_CLASS_OK: | 788 case ERROR_CLASS_OK: |
| 788 next_state_ = STATE_CTRL_WRITE_SYST; | 789 next_state_ = STATE_CTRL_WRITE_SYST; |
| 789 break; | 790 break; |
| 790 case ERROR_CLASS_INFO_NEEDED: | 791 case ERROR_CLASS_INFO_NEEDED: |
| 791 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 792 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 792 case ERROR_CLASS_TRANSIENT_ERROR: | 793 case ERROR_CLASS_TRANSIENT_ERROR: |
| 793 case ERROR_CLASS_PERMANENT_ERROR: | 794 case ERROR_CLASS_PERMANENT_ERROR: |
| 794 response_.needs_auth = true; | 795 response_.needs_auth = true; |
| 795 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 796 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 796 default: | |
| 797 NOTREACHED(); | |
| 798 return Stop(ERR_UNEXPECTED); | |
| 799 } | 797 } |
| 800 return OK; | 798 return OK; |
| 801 } | 799 } |
| 802 | 800 |
| 803 // SYST command. | 801 // SYST command. |
| 804 int FtpNetworkTransaction::DoCtrlWriteSYST() { | 802 int FtpNetworkTransaction::DoCtrlWriteSYST() { |
| 805 std::string command = "SYST"; | 803 std::string command = "SYST"; |
| 806 next_state_ = STATE_CTRL_READ; | 804 next_state_ = STATE_CTRL_READ; |
| 807 return SendFtpCommand(command, command, COMMAND_SYST); | 805 return SendFtpCommand(command, command, COMMAND_SYST); |
| 808 } | 806 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 break; | 844 break; |
| 847 } | 845 } |
| 848 case ERROR_CLASS_INFO_NEEDED: | 846 case ERROR_CLASS_INFO_NEEDED: |
| 849 return Stop(ERR_INVALID_RESPONSE); | 847 return Stop(ERR_INVALID_RESPONSE); |
| 850 case ERROR_CLASS_TRANSIENT_ERROR: | 848 case ERROR_CLASS_TRANSIENT_ERROR: |
| 851 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 849 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 852 case ERROR_CLASS_PERMANENT_ERROR: | 850 case ERROR_CLASS_PERMANENT_ERROR: |
| 853 // Server does not recognize the SYST command so proceed. | 851 // Server does not recognize the SYST command so proceed. |
| 854 next_state_ = STATE_CTRL_WRITE_PWD; | 852 next_state_ = STATE_CTRL_WRITE_PWD; |
| 855 break; | 853 break; |
| 856 default: | |
| 857 NOTREACHED(); | |
| 858 return Stop(ERR_UNEXPECTED); | |
| 859 } | 854 } |
| 860 return OK; | 855 return OK; |
| 861 } | 856 } |
| 862 | 857 |
| 863 // PWD command. | 858 // PWD command. |
| 864 int FtpNetworkTransaction::DoCtrlWritePWD() { | 859 int FtpNetworkTransaction::DoCtrlWritePWD() { |
| 865 std::string command = "PWD"; | 860 std::string command = "PWD"; |
| 866 next_state_ = STATE_CTRL_READ; | 861 next_state_ = STATE_CTRL_READ; |
| 867 return SendFtpCommand(command, command, COMMAND_PWD); | 862 return SendFtpCommand(command, command, COMMAND_PWD); |
| 868 } | 863 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 891 current_remote_directory_ = line; | 886 current_remote_directory_ = line; |
| 892 next_state_ = STATE_CTRL_WRITE_TYPE; | 887 next_state_ = STATE_CTRL_WRITE_TYPE; |
| 893 break; | 888 break; |
| 894 } | 889 } |
| 895 case ERROR_CLASS_INFO_NEEDED: | 890 case ERROR_CLASS_INFO_NEEDED: |
| 896 return Stop(ERR_INVALID_RESPONSE); | 891 return Stop(ERR_INVALID_RESPONSE); |
| 897 case ERROR_CLASS_TRANSIENT_ERROR: | 892 case ERROR_CLASS_TRANSIENT_ERROR: |
| 898 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 893 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 899 case ERROR_CLASS_PERMANENT_ERROR: | 894 case ERROR_CLASS_PERMANENT_ERROR: |
| 900 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 895 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 901 default: | |
| 902 NOTREACHED(); | |
| 903 return Stop(ERR_UNEXPECTED); | |
| 904 } | 896 } |
| 905 return OK; | 897 return OK; |
| 906 } | 898 } |
| 907 | 899 |
| 908 // TYPE command. | 900 // TYPE command. |
| 909 int FtpNetworkTransaction::DoCtrlWriteTYPE() { | 901 int FtpNetworkTransaction::DoCtrlWriteTYPE() { |
| 910 std::string command = "TYPE "; | 902 std::string command = "TYPE "; |
| 911 if (data_type_ == DATA_TYPE_ASCII) { | 903 if (data_type_ == DATA_TYPE_ASCII) { |
| 912 command += "A"; | 904 command += "A"; |
| 913 } else if (data_type_ == DATA_TYPE_IMAGE) { | 905 } else if (data_type_ == DATA_TYPE_IMAGE) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 927 return Stop(ERR_INVALID_RESPONSE); | 919 return Stop(ERR_INVALID_RESPONSE); |
| 928 case ERROR_CLASS_OK: | 920 case ERROR_CLASS_OK: |
| 929 next_state_ = STATE_CTRL_WRITE_SIZE; | 921 next_state_ = STATE_CTRL_WRITE_SIZE; |
| 930 break; | 922 break; |
| 931 case ERROR_CLASS_INFO_NEEDED: | 923 case ERROR_CLASS_INFO_NEEDED: |
| 932 return Stop(ERR_INVALID_RESPONSE); | 924 return Stop(ERR_INVALID_RESPONSE); |
| 933 case ERROR_CLASS_TRANSIENT_ERROR: | 925 case ERROR_CLASS_TRANSIENT_ERROR: |
| 934 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 926 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 935 case ERROR_CLASS_PERMANENT_ERROR: | 927 case ERROR_CLASS_PERMANENT_ERROR: |
| 936 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 928 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 937 default: | |
| 938 NOTREACHED(); | |
| 939 return Stop(ERR_UNEXPECTED); | |
| 940 } | 929 } |
| 941 return OK; | 930 return OK; |
| 942 } | 931 } |
| 943 | 932 |
| 944 // EPSV command | 933 // EPSV command |
| 945 int FtpNetworkTransaction::DoCtrlWriteEPSV() { | 934 int FtpNetworkTransaction::DoCtrlWriteEPSV() { |
| 946 const std::string command = "EPSV"; | 935 const std::string command = "EPSV"; |
| 947 next_state_ = STATE_CTRL_READ; | 936 next_state_ = STATE_CTRL_READ; |
| 948 return SendFtpCommand(command, command, COMMAND_EPSV); | 937 return SendFtpCommand(command, command, COMMAND_EPSV); |
| 949 } | 938 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 965 next_state_ = STATE_DATA_CONNECT; | 954 next_state_ = STATE_DATA_CONNECT; |
| 966 break; | 955 break; |
| 967 } | 956 } |
| 968 case ERROR_CLASS_INFO_NEEDED: | 957 case ERROR_CLASS_INFO_NEEDED: |
| 969 return Stop(ERR_INVALID_RESPONSE); | 958 return Stop(ERR_INVALID_RESPONSE); |
| 970 case ERROR_CLASS_TRANSIENT_ERROR: | 959 case ERROR_CLASS_TRANSIENT_ERROR: |
| 971 case ERROR_CLASS_PERMANENT_ERROR: | 960 case ERROR_CLASS_PERMANENT_ERROR: |
| 972 use_epsv_ = false; | 961 use_epsv_ = false; |
| 973 next_state_ = STATE_CTRL_WRITE_PASV; | 962 next_state_ = STATE_CTRL_WRITE_PASV; |
| 974 return OK; | 963 return OK; |
| 975 default: | |
| 976 NOTREACHED(); | |
| 977 return Stop(ERR_UNEXPECTED); | |
| 978 } | 964 } |
| 979 return OK; | 965 return OK; |
| 980 } | 966 } |
| 981 | 967 |
| 982 // PASV command | 968 // PASV command |
| 983 int FtpNetworkTransaction::DoCtrlWritePASV() { | 969 int FtpNetworkTransaction::DoCtrlWritePASV() { |
| 984 std::string command = "PASV"; | 970 std::string command = "PASV"; |
| 985 next_state_ = STATE_CTRL_READ; | 971 next_state_ = STATE_CTRL_READ; |
| 986 return SendFtpCommand(command, command, COMMAND_PASV); | 972 return SendFtpCommand(command, command, COMMAND_PASV); |
| 987 } | 973 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1002 data_connection_port_ = static_cast<uint16_t>(port); | 988 data_connection_port_ = static_cast<uint16_t>(port); |
| 1003 next_state_ = STATE_DATA_CONNECT; | 989 next_state_ = STATE_DATA_CONNECT; |
| 1004 break; | 990 break; |
| 1005 } | 991 } |
| 1006 case ERROR_CLASS_INFO_NEEDED: | 992 case ERROR_CLASS_INFO_NEEDED: |
| 1007 return Stop(ERR_INVALID_RESPONSE); | 993 return Stop(ERR_INVALID_RESPONSE); |
| 1008 case ERROR_CLASS_TRANSIENT_ERROR: | 994 case ERROR_CLASS_TRANSIENT_ERROR: |
| 1009 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 995 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 1010 case ERROR_CLASS_PERMANENT_ERROR: | 996 case ERROR_CLASS_PERMANENT_ERROR: |
| 1011 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 997 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 1012 default: | |
| 1013 NOTREACHED(); | |
| 1014 return Stop(ERR_UNEXPECTED); | |
| 1015 } | 998 } |
| 1016 return OK; | 999 return OK; |
| 1017 } | 1000 } |
| 1018 | 1001 |
| 1019 // RETR command | 1002 // RETR command |
| 1020 int FtpNetworkTransaction::DoCtrlWriteRETR() { | 1003 int FtpNetworkTransaction::DoCtrlWriteRETR() { |
| 1021 std::string command = "RETR " + GetRequestPathForFtpCommand(false); | 1004 std::string command = "RETR " + GetRequestPathForFtpCommand(false); |
| 1022 next_state_ = STATE_CTRL_READ; | 1005 next_state_ = STATE_CTRL_READ; |
| 1023 return SendFtpCommand(command, command, COMMAND_RETR); | 1006 return SendFtpCommand(command, command, COMMAND_RETR); |
| 1024 } | 1007 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1038 break; | 1021 break; |
| 1039 case ERROR_CLASS_OK: | 1022 case ERROR_CLASS_OK: |
| 1040 next_state_ = STATE_CTRL_WRITE_QUIT; | 1023 next_state_ = STATE_CTRL_WRITE_QUIT; |
| 1041 break; | 1024 break; |
| 1042 case ERROR_CLASS_INFO_NEEDED: | 1025 case ERROR_CLASS_INFO_NEEDED: |
| 1043 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 1026 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 1044 case ERROR_CLASS_TRANSIENT_ERROR: | 1027 case ERROR_CLASS_TRANSIENT_ERROR: |
| 1045 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 1028 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 1046 case ERROR_CLASS_PERMANENT_ERROR: | 1029 case ERROR_CLASS_PERMANENT_ERROR: |
| 1047 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 1030 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 1048 default: | |
| 1049 NOTREACHED(); | |
| 1050 return Stop(ERR_UNEXPECTED); | |
| 1051 } | 1031 } |
| 1052 | 1032 |
| 1053 return OK; | 1033 return OK; |
| 1054 } | 1034 } |
| 1055 | 1035 |
| 1056 // SIZE command | 1036 // SIZE command |
| 1057 int FtpNetworkTransaction::DoCtrlWriteSIZE() { | 1037 int FtpNetworkTransaction::DoCtrlWriteSIZE() { |
| 1058 std::string command = "SIZE " + GetRequestPathForFtpCommand(false); | 1038 std::string command = "SIZE " + GetRequestPathForFtpCommand(false); |
| 1059 next_state_ = STATE_CTRL_READ; | 1039 next_state_ = STATE_CTRL_READ; |
| 1060 return SendFtpCommand(command, command, COMMAND_SIZE); | 1040 return SendFtpCommand(command, command, COMMAND_SIZE); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1084 case ERROR_CLASS_TRANSIENT_ERROR: | 1064 case ERROR_CLASS_TRANSIENT_ERROR: |
| 1085 break; | 1065 break; |
| 1086 case ERROR_CLASS_PERMANENT_ERROR: | 1066 case ERROR_CLASS_PERMANENT_ERROR: |
| 1087 // It's possible that SIZE failed because the path is a directory. | 1067 // It's possible that SIZE failed because the path is a directory. |
| 1088 // TODO(xunjieli): https://crbug.com/526724: Add a test for this case. | 1068 // TODO(xunjieli): https://crbug.com/526724: Add a test for this case. |
| 1089 if (resource_type_ == RESOURCE_TYPE_UNKNOWN && | 1069 if (resource_type_ == RESOURCE_TYPE_UNKNOWN && |
| 1090 response.status_code != 550) { | 1070 response.status_code != 550) { |
| 1091 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 1071 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 1092 } | 1072 } |
| 1093 break; | 1073 break; |
| 1094 default: | |
| 1095 NOTREACHED(); | |
| 1096 return Stop(ERR_UNEXPECTED); | |
| 1097 } | 1074 } |
| 1098 | 1075 |
| 1099 // If the resource is known beforehand to be a file, RETR should be issued, | 1076 // If the resource is known beforehand to be a file, RETR should be issued, |
| 1100 // otherwise do CWD which will detect the resource type. | 1077 // otherwise do CWD which will detect the resource type. |
| 1101 if (resource_type_ == RESOURCE_TYPE_FILE) | 1078 if (resource_type_ == RESOURCE_TYPE_FILE) |
| 1102 EstablishDataConnection(STATE_CTRL_WRITE_RETR); | 1079 EstablishDataConnection(STATE_CTRL_WRITE_RETR); |
| 1103 else | 1080 else |
| 1104 next_state_ = STATE_CTRL_WRITE_CWD; | 1081 next_state_ = STATE_CTRL_WRITE_CWD; |
| 1105 return OK; | 1082 return OK; |
| 1106 } | 1083 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1130 // to RFC 959) instead of 550. | 1107 // to RFC 959) instead of 550. |
| 1131 if (response.status_code == 451) | 1108 if (response.status_code == 451) |
| 1132 return ProcessResponseCWDNotADirectory(); | 1109 return ProcessResponseCWDNotADirectory(); |
| 1133 | 1110 |
| 1134 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 1111 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 1135 case ERROR_CLASS_PERMANENT_ERROR: | 1112 case ERROR_CLASS_PERMANENT_ERROR: |
| 1136 if (response.status_code == 550) | 1113 if (response.status_code == 550) |
| 1137 return ProcessResponseCWDNotADirectory(); | 1114 return ProcessResponseCWDNotADirectory(); |
| 1138 | 1115 |
| 1139 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 1116 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 1140 default: | |
| 1141 NOTREACHED(); | |
| 1142 return Stop(ERR_UNEXPECTED); | |
| 1143 } | 1117 } |
| 1144 | 1118 |
| 1145 return OK; | 1119 return OK; |
| 1146 } | 1120 } |
| 1147 | 1121 |
| 1148 int FtpNetworkTransaction::ProcessResponseCWDNotADirectory() { | 1122 int FtpNetworkTransaction::ProcessResponseCWDNotADirectory() { |
| 1149 if (resource_type_ == RESOURCE_TYPE_DIRECTORY) { | 1123 if (resource_type_ == RESOURCE_TYPE_DIRECTORY) { |
| 1150 // We're assuming that the resource is a directory, but the server | 1124 // We're assuming that the resource is a directory, but the server |
| 1151 // says it's not true. The most probable interpretation is that it | 1125 // says it's not true. The most probable interpretation is that it |
| 1152 // doesn't exist (with FTP we can't be sure). | 1126 // doesn't exist (with FTP we can't be sure). |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 case ERROR_CLASS_OK: | 1164 case ERROR_CLASS_OK: |
| 1191 response_.is_directory_listing = true; | 1165 response_.is_directory_listing = true; |
| 1192 next_state_ = STATE_CTRL_WRITE_QUIT; | 1166 next_state_ = STATE_CTRL_WRITE_QUIT; |
| 1193 break; | 1167 break; |
| 1194 case ERROR_CLASS_INFO_NEEDED: | 1168 case ERROR_CLASS_INFO_NEEDED: |
| 1195 return Stop(ERR_INVALID_RESPONSE); | 1169 return Stop(ERR_INVALID_RESPONSE); |
| 1196 case ERROR_CLASS_TRANSIENT_ERROR: | 1170 case ERROR_CLASS_TRANSIENT_ERROR: |
| 1197 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 1171 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 1198 case ERROR_CLASS_PERMANENT_ERROR: | 1172 case ERROR_CLASS_PERMANENT_ERROR: |
| 1199 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); | 1173 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); |
| 1200 default: | |
| 1201 NOTREACHED(); | |
| 1202 return Stop(ERR_UNEXPECTED); | |
| 1203 } | 1174 } |
| 1204 return OK; | 1175 return OK; |
| 1205 } | 1176 } |
| 1206 | 1177 |
| 1207 // QUIT command | 1178 // QUIT command |
| 1208 int FtpNetworkTransaction::DoCtrlWriteQUIT() { | 1179 int FtpNetworkTransaction::DoCtrlWriteQUIT() { |
| 1209 std::string command = "QUIT"; | 1180 std::string command = "QUIT"; |
| 1210 next_state_ = STATE_CTRL_READ; | 1181 next_state_ = STATE_CTRL_READ; |
| 1211 return SendFtpCommand(command, command, COMMAND_QUIT); | 1182 return SendFtpCommand(command, command, COMMAND_QUIT); |
| 1212 } | 1183 } |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 if (!had_error_type[type]) { | 1343 if (!had_error_type[type]) { |
| 1373 had_error_type[type] = true; | 1344 had_error_type[type] = true; |
| 1374 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", | 1345 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", |
| 1375 type, NUM_OF_NET_ERROR_TYPES); | 1346 type, NUM_OF_NET_ERROR_TYPES); |
| 1376 } | 1347 } |
| 1377 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", | 1348 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", |
| 1378 type, NUM_OF_NET_ERROR_TYPES); | 1349 type, NUM_OF_NET_ERROR_TYPES); |
| 1379 } | 1350 } |
| 1380 | 1351 |
| 1381 } // namespace net | 1352 } // namespace net |
| OLD | NEW |