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

Unified Diff: net/ftp/ftp_network_transaction.cc

Issue 2532873003: Fix hitting a DCHECK in FtpNetworkTransaction on extra responses. (Closed)
Patch Set: Add bonus test 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
Index: net/ftp/ftp_network_transaction.cc
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index b34511fa1527419f37ca87b059dd02b2fa7040b1..b5efb077482b5f7680b0dc4f3e3e2e8c7910a014 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -417,7 +417,9 @@ int FtpNetworkTransaction::ProcessCtrlResponse() {
}
// We may get multiple responses for some commands,
- // see http://crbug.com/18036.
+ // see http://crbug.com/18036. Consume all responses, regardless of whether
+ // they make sense. On unexpected responses, SendFtpCommand expects all data
+ // to have already been consumed, even when sending the QUIT command.
mmenke 2016/11/28 17:28:22 Another option would be to skip that DCHECK in cas
while (ctrl_response_buffer_->ResponseAvailable() && rv == OK) {
response = ctrl_response_buffer_->PopResponse();
@@ -430,7 +432,8 @@ int FtpNetworkTransaction::ProcessCtrlResponse() {
break;
default:
// Multiple responses for other commands are invalid.
- return Stop(ERR_INVALID_RESPONSE);
+ rv = Stop(ERR_INVALID_RESPONSE);
eroman 2016/11/28 17:51:24 I am not sure I understand this code flow. rv wil
mmenke 2016/11/28 18:21:01 Stop sets the next state to send the quit message,
+ break;
}
}
« no previous file with comments | « no previous file | net/ftp/ftp_network_transaction_unittest.cc » ('j') | net/ftp/ftp_network_transaction_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698