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

Unified Diff: net/ftp/ftp_network_transaction.cc

Issue 2528713002: Fix some FTP DCHECKs on 1xx responses. (Closed)
Patch Set: Remove defaul cases Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/ftp/ftp_network_transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_network_transaction.cc
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index 8ecde3104de06e93f15218764c8ae756c40a1f6a..b34511fa1527419f37ca87b059dd02b2fa7040b1 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -753,6 +753,8 @@ int FtpNetworkTransaction::DoCtrlWriteUSER() {
int FtpNetworkTransaction::ProcessResponseUSER(
const FtpCtrlResponse& response) {
switch (GetErrorClass(response.status_code)) {
+ case ERROR_CLASS_INITIATED:
+ return Stop(ERR_INVALID_RESPONSE);
case ERROR_CLASS_OK:
next_state_ = STATE_CTRL_WRITE_SYST;
break;
@@ -763,9 +765,6 @@ int FtpNetworkTransaction::ProcessResponseUSER(
case ERROR_CLASS_PERMANENT_ERROR:
response_.needs_auth = true;
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
return OK;
}
@@ -784,6 +783,8 @@ int FtpNetworkTransaction::DoCtrlWritePASS() {
int FtpNetworkTransaction::ProcessResponsePASS(
const FtpCtrlResponse& response) {
switch (GetErrorClass(response.status_code)) {
+ case ERROR_CLASS_INITIATED:
+ return Stop(ERR_INVALID_RESPONSE);
case ERROR_CLASS_OK:
next_state_ = STATE_CTRL_WRITE_SYST;
break;
@@ -793,9 +794,6 @@ int FtpNetworkTransaction::ProcessResponsePASS(
case ERROR_CLASS_PERMANENT_ERROR:
response_.needs_auth = true;
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
return OK;
}
@@ -853,9 +851,6 @@ int FtpNetworkTransaction::ProcessResponseSYST(
// Server does not recognize the SYST command so proceed.
next_state_ = STATE_CTRL_WRITE_PWD;
break;
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
return OK;
}
@@ -898,9 +893,6 @@ int FtpNetworkTransaction::ProcessResponsePWD(const FtpCtrlResponse& response) {
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
case ERROR_CLASS_PERMANENT_ERROR:
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
return OK;
}
@@ -934,9 +926,6 @@ int FtpNetworkTransaction::ProcessResponseTYPE(
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
case ERROR_CLASS_PERMANENT_ERROR:
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
return OK;
}
@@ -972,9 +961,6 @@ int FtpNetworkTransaction::ProcessResponseEPSV(
use_epsv_ = false;
next_state_ = STATE_CTRL_WRITE_PASV;
return OK;
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
return OK;
}
@@ -1009,9 +995,6 @@ int FtpNetworkTransaction::ProcessResponsePASV(
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
case ERROR_CLASS_PERMANENT_ERROR:
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
return OK;
}
@@ -1045,9 +1028,6 @@ int FtpNetworkTransaction::ProcessResponseRETR(
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
case ERROR_CLASS_PERMANENT_ERROR:
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
return OK;
@@ -1091,9 +1071,6 @@ int FtpNetworkTransaction::ProcessResponseSIZE(
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
}
break;
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
// If the resource is known beforehand to be a file, RETR should be issued,
@@ -1137,9 +1114,6 @@ int FtpNetworkTransaction::ProcessResponseCWD(const FtpCtrlResponse& response) {
return ProcessResponseCWDNotADirectory();
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
return OK;
@@ -1197,9 +1171,6 @@ int FtpNetworkTransaction::ProcessResponseLIST(
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
case ERROR_CLASS_PERMANENT_ERROR:
return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
- default:
- NOTREACHED();
- return Stop(ERR_UNEXPECTED);
}
return OK;
}
« 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