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

Unified Diff: net/spdy/spdy_http_stream.cc

Issue 10824115: Log SPDY request headers in URL_REQUEST events in net-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch from const reference to const pointer passing to logging callback Created 8 years, 5 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/base/net_log_event_type_list.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_http_stream.cc
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index 1f79e6413b7813ccd6e63317950ae61b6f70e196..987f9eb0b4db60d2f503ec4aec7dd85a51d57bac 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -12,9 +12,12 @@
#include "base/bind_helpers.h"
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/stringprintf.h"
+#include "base/values.h"
#include "net/base/address_list.h"
#include "net/base/host_port_pair.h"
#include "net/base/load_flags.h"
+#include "net/base/net_log.h"
#include "net/base/net_util.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_request_info.h"
@@ -25,6 +28,23 @@
namespace net {
+namespace {
+
+Value* NetLogSpdySendRequestCallback(const SpdyHeaderBlock* headers,
+ NetLog::LogLevel /* log_level */) {
+ DictionaryValue* dict = new DictionaryValue();
+ ListValue* headers_list = new ListValue();
+ for (SpdyHeaderBlock::const_iterator it = headers->begin();
+ it != headers->end(); ++it) {
+ headers_list->Append(new StringValue(base::StringPrintf(
+ "%s: %s", it->first.c_str(), it->second.c_str())));
+ }
+ dict->Set("headers", headers_list);
+ return dict;
+}
+
+} // namespace
+
SpdyHttpStream::SpdyHttpStream(SpdySession* spdy_session,
bool direct)
: ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
@@ -198,6 +218,9 @@ int SpdyHttpStream::SendRequest(const HttpRequestHeaders& request_headers,
CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers,
headers.get(), stream_->GetProtocolVersion(),
direct_);
+ stream_->net_log().AddEvent(
+ NetLog::TYPE_HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS,
+ base::Bind(&NetLogSpdySendRequestCallback, headers.get()));
stream_->set_spdy_headers(headers.Pass());
stream_->SetRequestTime(request_time);
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698