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

Unified Diff: net/ftp/ftp_ctrl_response_buffer.cc

Issue 467032: net/ftp: Fix control response parsing for a corner cases where the first line... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | « net/ftp/ftp_ctrl_response_buffer.h ('k') | net/ftp/ftp_ctrl_response_buffer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_ctrl_response_buffer.cc
===================================================================
--- net/ftp/ftp_ctrl_response_buffer.cc (revision 33979)
+++ net/ftp/ftp_ctrl_response_buffer.cc (working copy)
@@ -21,22 +21,7 @@
ParsedLine line = lines_.front();
lines_.pop();
- if (line_buf_.empty()) {
- if (!line.is_complete)
- return ERR_INVALID_RESPONSE;
-
- response_buf_.status_code = line.status_code;
- if (line.is_multiline) {
- line_buf_ = line.status_text;
- } else {
- response_buf_.lines.push_back(line.status_text);
- responses_.push(response_buf_);
-
- // Prepare to handle following lines.
- response_buf_ = FtpCtrlResponse();
- line_buf_.clear();
- }
- } else {
+ if (multiline_) {
if (!line.is_complete || line.status_code != response_buf_.status_code) {
line_buf_.append(line.raw_text);
continue;
@@ -54,7 +39,24 @@
// Prepare to handle following lines.
response_buf_ = FtpCtrlResponse();
line_buf_.clear();
+ multiline_ = false;
}
+ } else {
+ if (!line.is_complete)
+ return ERR_INVALID_RESPONSE;
+
+ response_buf_.status_code = line.status_code;
+ if (line.is_multiline) {
+ line_buf_ = line.status_text;
+ multiline_ = true;
+ } else {
+ response_buf_.lines.push_back(line.status_text);
+ responses_.push(response_buf_);
+
+ // Prepare to handle following lines.
+ response_buf_ = FtpCtrlResponse();
+ line_buf_.clear();
+ }
}
}
Property changes on: net/ftp/ftp_ctrl_response_buffer.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « net/ftp/ftp_ctrl_response_buffer.h ('k') | net/ftp/ftp_ctrl_response_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698