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

Unified Diff: net/quic/quic_http_stream.cc

Issue 12253020: Enhance net internals/net log output for QUIC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix use after free Created 7 years, 10 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
« no previous file with comments | « net/quic/quic_http_stream.h ('k') | net/quic/quic_http_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_http_stream.cc
diff --git a/net/quic/quic_http_stream.cc b/net/quic/quic_http_stream.cc
index 4439ef73343bfd0d7b492469506fc3747a5ab705..0eaf0a19fdccebed37846255c2dd7314a2a9979d 100644
--- a/net/quic/quic_http_stream.cc
+++ b/net/quic/quic_http_stream.cc
@@ -48,6 +48,7 @@ int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info,
const CompletionCallback& callback) {
CHECK(stream_);
+ stream_net_log_ = stream_net_log;
request_info_ = request_info;
return OK;
@@ -72,12 +73,32 @@ int QuicHttpStream::SendRequest(const HttpRequestHeaders& request_headers,
SpdyFramer::WriteHeaderBlock(&builder, 3, &headers);
scoped_ptr<SpdyFrame> frame(builder.take());
request_ = std::string(frame->data(), len);
+ // Log the actual request with the URL Request's net log.
+ stream_net_log_.AddEvent(
+ NetLog::TYPE_HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS,
+ base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
+ // Also log to the QuicSession's net log.
+ stream_->net_log().AddEvent(
+ NetLog::TYPE_QUIC_HTTP_STREAM_SEND_REQUEST_HEADERS,
+ base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
} else {
std::string path = HttpUtil::PathForRequest(request_info_->url);
std::string first_line = base::StringPrintf("%s %s HTTP/1.1\r\n",
request_info_->method.c_str(),
path.c_str());
request_ = first_line + request_headers.ToString();
+ // Log the actual request with the URL Request's net log.
+ stream_net_log_.AddEvent(
+ NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS,
+ base::Bind(&HttpRequestHeaders::NetLogCallback,
+ base::Unretained(&request_headers),
+ &first_line));
+ // Also log to the QuicSession's net log.
+ stream_->net_log().AddEvent(
+ NetLog::TYPE_QUIC_HTTP_STREAM_SEND_REQUEST_HEADERS,
+ base::Bind(&HttpRequestHeaders::NetLogCallback,
+ base::Unretained(&request_headers),
+ &first_line));
}
// Store the request body.
@@ -458,6 +479,12 @@ int QuicHttpStream::ParseResponseHeaders() {
BufferResponseBody(read_buf_->data(), delta);
}
+ // The URLRequest logs these headers, so only log to the QuicSession's
+ // net log.
+ stream_->net_log().AddEvent(
+ NetLog::TYPE_QUIC_HTTP_STREAM_READ_RESPONSE_HEADERS,
+ base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
+
SpdyHeadersToHttpResponse(headers, 3, response_info_);
// Put the peer's IP address and port into the response.
IPEndPoint address = stream_->GetPeerAddress();
@@ -487,6 +514,13 @@ int QuicHttpStream::ParseResponseHeaders() {
response_info_->vary_data.Init(*request_info_, *response_info_->headers);
response_headers_received_ = true;
+ // The URLRequest logs these headers, so only log to the QuicSession's
+ // net log.
+ stream_->net_log().AddEvent(
+ NetLog::TYPE_QUIC_HTTP_STREAM_READ_RESPONSE_HEADERS,
+ base::Bind(&HttpResponseHeaders::NetLogCallback,
+ response_info_->headers));
+
// Save the remaining received data.
int delta = read_buf_->offset() - end_offset;
if (delta > 0) {
« no previous file with comments | « net/quic/quic_http_stream.h ('k') | net/quic/quic_http_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698