summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorpauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-01 20:25:32 +0000
committerpauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-01 20:25:32 +0000
commitce178094741bd8bdd6aa3ba741830e1224b93796 (patch)
tree613a3a30dfb6a1b0ab6327229dcf348f1b180a40 /net
parente26dfc310a7a76a65b0106673e124793a02f6c44 (diff)
downloadchromium_src-ce178094741bd8bdd6aa3ba741830e1224b93796.zip
chromium_src-ce178094741bd8bdd6aa3ba741830e1224b93796.tar.gz
chromium_src-ce178094741bd8bdd6aa3ba741830e1224b93796.tar.bz2
Log SPDY request headers in URL_REQUEST events in net-internals.
BUG=135203 TEST= Review URL: https://chromiumcodereview.appspot.com/10824115 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/net_log_event_type_list.h7
-rw-r--r--net/spdy/spdy_http_stream.cc23
2 files changed, 30 insertions, 0 deletions
diff --git a/net/base/net_log_event_type_list.h b/net/base/net_log_event_type_list.h
index cf30a83..819b115 100644
--- a/net/base/net_log_event_type_list.h
+++ b/net/base/net_log_event_type_list.h
@@ -914,6 +914,13 @@ EVENT_TYPE(HTTP_TRANSACTION_SEND_REQUEST)
// }
EVENT_TYPE(HTTP_TRANSACTION_SEND_REQUEST_HEADERS)
+// This event is sent for a HTTP request over a SPDY stream.
+// The following parameters are attached:
+// {
+// "headers": <The list of header:value pairs>,
+// }
+EVENT_TYPE(HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS)
+
// Measures the time to read HTTP response headers from the server.
EVENT_TYPE(HTTP_TRANSACTION_READ_HEADERS)
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index 1f79e64..987f9eb 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);