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

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 issues with tracking number of bytes received & decompressed. Created 9 years, 7 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..a6f9c2e3ebddd6d5a2908ea921a614b146d9d705 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -19,6 +19,20 @@
#include "net/socket/ssl_client_socket.h"
#include "net/socket/client_socket_handle.h"
+static std::string GetResponseHeaderLines(
rvargas (doing something else) 2011/05/19 19:30:36 nit: can you use an anonymous namespace instead?
ahendrickson 2011/05/19 22:29:34 Done.
+ const net::HttpResponseHeaders& headers) {
+ 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;
rvargas (doing something else) 2011/05/19 19:30:36 It probably doesn't matter too much, but it looks
+ }
+ return cr_separated_headers;
+}
+
namespace net {
HttpStreamParser::HttpStreamParser(ClientSocketHandle* connection,
@@ -69,6 +83,9 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
make_scoped_refptr(new NetLogHttpRequestParameter(
request_line, headers)));
}
+ VLOG(20) << __FUNCTION__ << "()"
rvargas (doing something else) 2011/05/19 19:30:36 This looks odd. Could you use DVLOG instead?. Havi
ahendrickson 2011/05/19 22:29:34 Switched to DVLOG. 20 is the number we use for de
+ << " request_line = \"" << request_line << "\""
+ << " headers = \"" << headers.ToString() << "\"";
response_ = response;
// Put the peer's IP address and port into the response.
@@ -619,6 +636,11 @@ int HttpStreamParser::DoParseResponseHeaders(int end_offset) {
response_->headers = headers;
response_->vary_data.Init(*request_, *response_->headers);
+ VLOG(20) << __FUNCTION__ << "()"
rvargas (doing something else) 2011/05/19 19:30:36 same here (and other places)
ahendrickson 2011/05/19 22:29:34 Done.
+ << " content_length = \""
+ << response_->headers->GetContentLength() << "\n\""
+ << " headers = \"" << GetResponseHeaderLines(*response_->headers)
+ << "\"";
return OK;
}

Powered by Google App Engine
This is Rietveld 408576698