diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-21 23:33:30 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-21 23:33:30 +0000 |
commit | 967dd54183a539e2c178fed766c48a61f407f8ff (patch) | |
tree | 53207cd58c8dca16834aa2503bcdd10d6802162f /net/flip/flip_session.cc | |
parent | aa064319d1a628a63f2854d3dd6bc58cdffc72ba (diff) | |
download | chromium_src-967dd54183a539e2c178fed766c48a61f407f8ff.zip chromium_src-967dd54183a539e2c178fed766c48a61f407f8ff.tar.gz chromium_src-967dd54183a539e2c178fed766c48a61f407f8ff.tar.bz2 |
Add some diagnostics for dumping the headers that the client
sends to the server so that others can more easily debug.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/414078
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32764 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/flip/flip_session.cc')
-rw-r--r-- | net/flip/flip_session.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/net/flip/flip_session.cc b/net/flip/flip_session.cc index 9b1a772..7ce6da8 100644 --- a/net/flip/flip_session.cc +++ b/net/flip/flip_session.cc @@ -23,6 +23,29 @@ #include "net/socket/ssl_client_socket.h" #include "net/tools/dump_cache/url_to_filename_encoder.h" +namespace { + +// Diagnostics function to dump the headers of a request. +// TODO(mbelshe): Remove this function. +void DumpFlipHeaders(const flip::FlipHeaderBlock& headers) { + // Because this function gets called on every request, + // take extra care to optimize it away if logging is turned off. + if (logging::LOG_INFO < logging::GetMinLogLevel()) + return; + + flip::FlipHeaderBlock::const_iterator it = headers.begin(); + while (it != headers.end()) { + std::string val = (*it).second; + std::string::size_type pos = 0; + while ((pos = val.find('\0', pos)) != val.npos) + val[pos] = '\n'; + LOG(INFO) << (*it).first << "==" << val; + ++it; + } +} + +} // namespace + namespace net { // static @@ -206,6 +229,8 @@ int FlipSession::CreateStream(FlipDelegate* delegate) { LOG(INFO) << "FETCHING: " << delegate->request()->url.spec(); + LOG(INFO) << "FLIP SYN_STREAM HEADERS ----------------------------------"; + DumpFlipHeaders(headers); // Schedule to write to the socket after we've made it back // to the message loop so that we can aggregate multiple @@ -220,6 +245,8 @@ int FlipSession::CreateStream(FlipDelegate* delegate) { int FlipSession::WriteStreamData(flip::FlipStreamId stream_id, net::IOBuffer* data, int len) { + LOG(INFO) << "Writing Stream Data for stream " << stream_id << " (" << len + << " bytes)"; const int kMss = 1430; // This is somewhat arbitrary and not really fixed, // but it will always work reasonably with ethernet. // Chop the world into 2-packet chunks. This is somewhat arbitrary, but @@ -630,6 +657,9 @@ void FlipSession::OnSyn(const flip::FlipSynStreamControlFrame* frame, return; } + LOG(INFO) << "FLIP SYN_REPLY RESPONSE HEADERS -----------------------"; + DumpFlipHeaders(*headers); + // Activate a stream and parse the headers. FlipStream* stream = ActivateStream(stream_id, NULL); stream->OnReply(headers); |