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

Unified Diff: net/http/http_stream_parser.cc

Issue 6881106: Treat ERR_CONNECTION_CLOSED as end-of-data marker for downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comment & decreased logging verbosity. Created 9 years, 8 months 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/http/http_stream_parser.cc
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index eb1ed35225acc7ca55385fefa18c1ebe7f95c9ae..777a591ff20d267d0037fa02eeb683ae7ab6fba9 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -69,6 +69,9 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
make_scoped_refptr(new NetLogHttpRequestParameter(
request_line, headers)));
}
+ VLOG(20) << __FUNCTION__ << "()"
+ << " request_line = \"" << request_line << "\""
+ << " headers = \"" << headers.ToString() << "\"";
response_ = response;
// Put the peer's IP address and port into the response.
@@ -556,6 +559,19 @@ int HttpStreamParser::DoReadBodyComplete(int result) {
return result;
}
+static std::string GetResponseHeaderLines(const HttpResponseHeaders& headers) {
darin (slow to review) 2011/05/16 17:47:16 it is usually bad form to stick a non-class functi
ahendrickson 2011/05/16 19:37:40 Moved to the top of the file.
+ std::string raw_headers = headers.raw_headers();
+ const char* null_separated_headers = raw_headers.c_str();
+ const char* header_line = null_separated_headers;
+ std::string cr_separated_headers;
+ while (header_line[0] != 0) {
+ cr_separated_headers += header_line;
+ cr_separated_headers += "\n";
+ header_line += strlen(header_line) + 1;
+ }
+ return cr_separated_headers;
+}
+
int HttpStreamParser::ParseResponseHeaders() {
int end_offset = -1;
@@ -619,6 +635,11 @@ int HttpStreamParser::DoParseResponseHeaders(int end_offset) {
response_->headers = headers;
response_->vary_data.Init(*request_, *response_->headers);
+ VLOG(20) << __FUNCTION__ << "()"
+ << " content_length = \""
+ << response_->headers->GetContentLength() << "\n\""
+ << " headers = \"" << GetResponseHeaderLines(*response_->headers)
+ << "\"";
return OK;
}

Powered by Google App Engine
This is Rietveld 408576698