summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authordavidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 15:44:05 +0000
committerdavidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 15:44:05 +0000
commitb4a916070db5632e52244479ffd5bc717296b8d9 (patch)
treec3c8b16efac6fcc39950f343f4ad5923971a4f3d /net
parent7aa5fe5abe8ee6c59f4a0ad8e5cac1701c4c9af2 (diff)
downloadchromium_src-b4a916070db5632e52244479ffd5bc717296b8d9.zip
chromium_src-b4a916070db5632e52244479ffd5bc717296b8d9.tar.gz
chromium_src-b4a916070db5632e52244479ffd5bc717296b8d9.tar.bz2
Allow removing private data in chrome://net-export.
This introduces a new LogLevel, LOG_STRIP_PRIVATE_DATA, which callbacks within the network stack check to decide whether or not to report redacted data. Unfortunately, this involves duplicating the net-internals implementation, but that implementation isn't easily reusable given chrome://net-exports' constraints. Plumb this state through net-export and adjust the UI and state machine accordingly. Add various tests. This also moves HttpAuth::ChallengeTokenizer to HttpUtil::ChallengeTokenizer as some of the redaction logic reuses the parser. This avoids giving everything a dependency on HttpAuth. BUG=349502 Review URL: https://codereview.chromium.org/182523006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257645 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/net_log.h4
-rw-r--r--net/base/net_log_logger.cc11
-rw-r--r--net/base/net_log_logger.h6
-rw-r--r--net/http/http_auth_challenge_tokenizer.h2
-rw-r--r--net/http/http_log_util.cc81
-rw-r--r--net/http/http_log_util.h24
-rw-r--r--net/http/http_log_util_unittest.cc69
-rw-r--r--net/http/http_request_headers.cc21
-rw-r--r--net/http/http_response_headers.cc17
-rw-r--r--net/net.gyp3
-rw-r--r--net/spdy/spdy_header_block.cc6
-rw-r--r--net/spdy/spdy_http_utils.cc8
-rw-r--r--net/spdy/spdy_http_utils.h4
-rw-r--r--net/spdy/spdy_http_utils_unittest.cc10
-rw-r--r--net/spdy/spdy_session.cc22
15 files changed, 224 insertions, 64 deletions
diff --git a/net/base/net_log.h b/net/base/net_log.h
index e8e7598..b037a33 100644
--- a/net/base/net_log.h
+++ b/net/base/net_log.h
@@ -78,6 +78,10 @@ class NET_EXPORT NetLog {
// parameters for bytes sent/received events.
LOG_ALL_BUT_BYTES,
+ // Log all events, but do not include the actual transferred bytes and
+ // remove cookies and HTTP credentials.
+ LOG_STRIP_PRIVATE_DATA,
+
// Don't log any events.
LOG_NONE,
};
diff --git a/net/base/net_log_logger.cc b/net/base/net_log_logger.cc
index 39db82a..9653e59 100644
--- a/net/base/net_log_logger.cc
+++ b/net/base/net_log_logger.cc
@@ -23,7 +23,7 @@ namespace net {
static const int kLogFormatVersion = 1;
NetLogLogger::NetLogLogger(FILE* file, const base::Value& constants)
- : file_(file), added_events_(false) {
+ : file_(file), log_level_(NetLog::LOG_ALL_BUT_BYTES), added_events_(false) {
DCHECK(file);
// Write constants to the output file. This allows loading files that have
@@ -40,8 +40,13 @@ NetLogLogger::~NetLogLogger() {
fprintf(file_.get(), "]}");
}
+void NetLogLogger::set_log_level(net::NetLog::LogLevel log_level) {
+ DCHECK(!net_log());
+ log_level_ = log_level;
+}
+
void NetLogLogger::StartObserving(net::NetLog* net_log) {
- net_log->AddThreadSafeObserver(this, net::NetLog::LOG_ALL_BUT_BYTES);
+ net_log->AddThreadSafeObserver(this, log_level_);
}
void NetLogLogger::StopObserving() {
@@ -163,6 +168,8 @@ base::DictionaryValue* NetLogLogger::GetConstants() {
dict->SetInteger("LOG_ALL", net::NetLog::LOG_ALL);
dict->SetInteger("LOG_ALL_BUT_BYTES", net::NetLog::LOG_ALL_BUT_BYTES);
+ dict->SetInteger("LOG_STRIP_PRIVATE_DATA",
+ net::NetLog::LOG_STRIP_PRIVATE_DATA);
constants_dict->Set("logLevelType", dict);
}
diff --git a/net/base/net_log_logger.h b/net/base/net_log_logger.h
index 1d0bc5b..c827760 100644
--- a/net/base/net_log_logger.h
+++ b/net/base/net_log_logger.h
@@ -29,6 +29,9 @@ class NET_EXPORT NetLogLogger : public NetLog::ThreadSafeObserver {
NetLogLogger(FILE* file, const base::Value& constants);
virtual ~NetLogLogger();
+ // Sets the log level to log at. Must be called before StartObserving.
+ void set_log_level(NetLog::LogLevel log_level);
+
// Starts observing specified NetLog. Must not already be watching a NetLog.
// Separate from constructor to enforce thread safety.
void StartObserving(NetLog* net_log);
@@ -46,6 +49,9 @@ class NET_EXPORT NetLogLogger : public NetLog::ThreadSafeObserver {
private:
ScopedStdioHandle file_;
+ // The LogLevel to log at.
+ NetLog::LogLevel log_level_;
+
// True if OnAddEntry() has been called at least once.
bool added_events_;
diff --git a/net/http/http_auth_challenge_tokenizer.h b/net/http/http_auth_challenge_tokenizer.h
index 3c93d25..a73f1920 100644
--- a/net/http/http_auth_challenge_tokenizer.h
+++ b/net/http/http_auth_challenge_tokenizer.h
@@ -37,6 +37,8 @@ class NET_EXPORT_PRIVATE HttpAuthChallengeTokenizer {
return std::string(scheme_begin_, scheme_end_);
}
+ std::string::const_iterator params_begin() const { return params_begin_; }
+ std::string::const_iterator params_end() const { return params_end_; }
HttpUtil::NameValuePairsIterator param_pairs() const;
std::string base64_param() const;
diff --git a/net/http/http_log_util.cc b/net/http/http_log_util.cc
new file mode 100644
index 0000000..ab6ebda
--- /dev/null
+++ b/net/http/http_log_util.cc
@@ -0,0 +1,81 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/http/http_log_util.h"
+
+#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
+#include "net/http/http_auth_challenge_tokenizer.h"
+
+namespace net {
+
+namespace {
+
+bool ShouldRedactChallenge(HttpAuthChallengeTokenizer* challenge) {
+ // Ignore lines with commas, as they may contain lists of schemes, and
+ // the information we want to hide is Base64 encoded, so has no commas.
+ if (challenge->challenge_text().find(',') != std::string::npos)
+ return false;
+
+ std::string scheme = StringToLowerASCII(challenge->scheme());
+ // Invalid input.
+ if (scheme.empty())
+ return false;
+
+ // Ignore Basic and Digest authentication challenges, as they contain
+ // public information.
+ if (scheme == "basic" || scheme == "digest")
+ return false;
+
+ return true;
+}
+
+} // namespace
+
+std::string ElideHeaderValueForNetLog(NetLog::LogLevel log_level,
+ const std::string& header,
+ const std::string& value) {
+#if defined(SPDY_PROXY_AUTH_ORIGIN)
+ if (!base::strcasecmp(header.c_str(), "proxy-authorization") ||
+ !base::strcasecmp(header.c_str(), "proxy-authenticate")) {
+ return "[elided]";
+ }
+#endif
+
+ if (log_level < NetLog::LOG_STRIP_PRIVATE_DATA)
+ return value;
+
+ // Note: this logic should be kept in sync with stripCookiesAndLoginInfo in
+ // chrome/browser/resources/net_internals/log_view_painter.js.
+
+ std::string::const_iterator redact_begin = value.begin();
+ std::string::const_iterator redact_end = value.begin();
+ if (!base::strcasecmp(header.c_str(), "set-cookie") ||
+ !base::strcasecmp(header.c_str(), "set-cookie2") ||
+ !base::strcasecmp(header.c_str(), "cookie") ||
+ !base::strcasecmp(header.c_str(), "authorization") ||
+ !base::strcasecmp(header.c_str(), "proxy-authorization")) {
+ redact_begin = value.begin();
+ redact_end = value.end();
+ } else if (!base::strcasecmp(header.c_str(), "www-authenticate") ||
+ !base::strcasecmp(header.c_str(), "proxy-authenticate")) {
+ // Look for authentication information from data received from the server in
+ // multi-round Negotiate authentication.
+ HttpAuthChallengeTokenizer challenge(value.begin(), value.end());
+ if (ShouldRedactChallenge(&challenge)) {
+ redact_begin = challenge.params_begin();
+ redact_end = challenge.params_end();
+ }
+ }
+
+ if (redact_begin == redact_end)
+ return value;
+
+ return std::string(value.begin(), redact_begin) +
+ base::StringPrintf("[%ld bytes were stripped]",
+ static_cast<long>(redact_end - redact_begin)) +
+ std::string(redact_end, value.end());
+}
+
+} // namespace net
diff --git a/net/http/http_log_util.h b/net/http/http_log_util.h
new file mode 100644
index 0000000..f18c6e7
--- /dev/null
+++ b/net/http/http_log_util.h
@@ -0,0 +1,24 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_HTTP_HTTP_LOG_UTIL_
+#define NET_HTTP_HTTP_LOG_UTIL_
+
+#include <string>
+
+#include "net/base/net_export.h"
+#include "net/base/net_log.h"
+
+namespace net {
+
+// Given an HTTP header |header| with value |value|, returns the elided version
+// of the header value at |log_level|.
+NET_EXPORT_PRIVATE std::string ElideHeaderValueForNetLog(
+ NetLog::LogLevel log_level,
+ const std::string& header,
+ const std::string& value);
+
+} // namespace net
+
+#endif // NET_HTTP_HTTP_LOG_UTIL_
diff --git a/net/http/http_log_util_unittest.cc b/net/http/http_log_util_unittest.cc
new file mode 100644
index 0000000..1b8cdf2
--- /dev/null
+++ b/net/http/http_log_util_unittest.cc
@@ -0,0 +1,69 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/http/http_log_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace net {
+
+TEST(HttpLogUtilTest, ElideHeaderValueForNetLog) {
+ // Only elide for appropriate log level.
+ EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA, "Cookie", "name=value"));
+ EXPECT_EQ("name=value", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_ALL_BUT_BYTES, "Cookie", "name=value"));
+
+ // Headers are compared case insensitively.
+ EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA, "cOoKiE", "name=value"));
+
+ // These headers should be completely elided.
+ EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA, "Set-Cookie", "name=value"));
+ EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA, "Set-Cookie2", "name=value"));
+ EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA, "Authorization", "Basic 1234"));
+ EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA,
+ "Proxy-Authorization", "Basic 1234"));
+
+ // Unknown headers should pass through.
+ EXPECT_EQ("value", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA, "Boring", "value"));
+
+ // Basic and Digest auth challenges are public.
+ EXPECT_EQ("Basic realm=test", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA,
+ "WWW-Authenticate", "Basic realm=test"));
+ EXPECT_EQ("Digest realm=test", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA,
+ "WWW-Authenticate", "Digest realm=test"));
+ EXPECT_EQ("Basic realm=test", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA,
+ "Proxy-Authenticate", "Basic realm=test"));
+ EXPECT_EQ("Digest realm=test", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA,
+ "Proxy-Authenticate", "Digest realm=test"));
+
+ // Multi-round mechanisms partially elided.
+ EXPECT_EQ("NTLM [4 bytes were stripped]", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234"));
+ EXPECT_EQ("NTLM [4 bytes were stripped]", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA, "Proxy-Authenticate", "NTLM 1234"));
+
+ // Leave whitespace intact.
+ EXPECT_EQ("NTLM [4 bytes were stripped] ", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234 "));
+
+#if defined(SPDY_PROXY_AUTH_ORIGIN)
+ EXPECT_EQ("[elided]", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_ALL_BUT_BYTES, "Proxy-Authorization", "Basic 1234"));
+#else
+ EXPECT_EQ("Basic 1234", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_ALL_BUT_BYTES, "Proxy-Authorization", "Basic 1234"));
+#endif
+}
+
+} // namspace net
diff --git a/net/http/http_request_headers.cc b/net/http/http_request_headers.cc
index 8c9c428..9348e3e 100644
--- a/net/http/http_request_headers.cc
+++ b/net/http/http_request_headers.cc
@@ -9,20 +9,9 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
+#include "net/http/http_log_util.h"
#include "net/http/http_util.h"
-namespace {
-
-bool ShouldShowHttpHeaderValue(const std::string& header_name) {
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- if (header_name == "Proxy-Authorization")
- return false;
-#endif
- return true;
-}
-
-} // namespace
-
namespace net {
const char HttpRequestHeaders::kGetMethod[] = "GET";
@@ -197,17 +186,17 @@ std::string HttpRequestHeaders::ToString() const {
base::Value* HttpRequestHeaders::NetLogCallback(
const std::string* request_line,
- NetLog::LogLevel /* log_level */) const {
+ NetLog::LogLevel log_level) const {
base::DictionaryValue* dict = new base::DictionaryValue();
dict->SetString("line", *request_line);
base::ListValue* headers = new base::ListValue();
for (HeaderVector::const_iterator it = headers_.begin();
it != headers_.end(); ++it) {
+ std::string log_value = ElideHeaderValueForNetLog(
+ log_level, it->key, it->value);
headers->Append(new base::StringValue(
base::StringPrintf("%s: %s",
- it->key.c_str(),
- (ShouldShowHttpHeaderValue(it->key) ?
- it->value.c_str() : "[elided]"))));
+ it->key.c_str(), log_value.c_str())));
}
dict->Set("headers", headers);
return dict;
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index dbe09a6..f6e3658 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -23,6 +23,7 @@
#include "base/values.h"
#include "net/base/escape.h"
#include "net/http/http_byte_range.h"
+#include "net/http/http_log_util.h"
#include "net/http/http_util.h"
using base::StringPiece;
@@ -115,14 +116,6 @@ void CheckDoesNotHaveEmbededNulls(const std::string& str) {
CHECK(str.find('\0') == std::string::npos);
}
-bool ShouldShowHttpHeaderValue(const std::string& header_name) {
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- if (header_name == "Proxy-Authenticate")
- return false;
-#endif
- return true;
-}
-
} // namespace
const char HttpResponseHeaders::kContentRange[] = "Content-Range";
@@ -1338,7 +1331,7 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position,
}
base::Value* HttpResponseHeaders::NetLogCallback(
- NetLog::LogLevel /* log_level */) const {
+ NetLog::LogLevel log_level) const {
base::DictionaryValue* dict = new base::DictionaryValue();
base::ListValue* headers = new base::ListValue();
headers->Append(new base::StringValue(GetStatusLine()));
@@ -1346,12 +1339,10 @@ base::Value* HttpResponseHeaders::NetLogCallback(
std::string name;
std::string value;
while (EnumerateHeaderLines(&iterator, &name, &value)) {
+ std::string log_value = ElideHeaderValueForNetLog(log_level, name, value);
headers->Append(
new base::StringValue(
- base::StringPrintf("%s: %s",
- name.c_str(),
- (ShouldShowHttpHeaderValue(name) ?
- value.c_str() : "[elided]"))));
+ base::StringPrintf("%s: %s", name.c_str(), log_value.c_str())));
}
dict->Set("headers", headers);
return dict;
diff --git a/net/net.gyp b/net/net.gyp
index 7e20f5f..bd408e2 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -595,6 +595,8 @@
'http/http_content_disposition.h',
'http/http_chunked_decoder.cc',
'http/http_chunked_decoder.h',
+ 'http/http_log_util.cc',
+ 'http/http_log_util.h',
'http/http_network_layer.cc',
'http/http_network_layer.h',
'http/http_network_session.cc',
@@ -1809,6 +1811,7 @@
'http/http_cache_unittest.cc',
'http/http_chunked_decoder_unittest.cc',
'http/http_content_disposition_unittest.cc',
+ 'http/http_log_util_unittest.cc',
'http/http_network_layer_unittest.cc',
'http/http_network_transaction_ssl_unittest.cc',
'http/http_network_transaction_unittest.cc',
diff --git a/net/spdy/spdy_header_block.cc b/net/spdy/spdy_header_block.cc
index ecc22a4..bbe9c716 100644
--- a/net/spdy/spdy_header_block.cc
+++ b/net/spdy/spdy_header_block.cc
@@ -5,13 +5,13 @@
#include "net/spdy/spdy_header_block.h"
#include "base/values.h"
-#include "net/spdy/spdy_http_utils.h"
+#include "net/http/http_log_util.h"
namespace net {
base::Value* SpdyHeaderBlockNetLogCallback(
const SpdyHeaderBlock* headers,
- NetLog::LogLevel /* log_level */) {
+ NetLog::LogLevel log_level) {
base::DictionaryValue* dict = new base::DictionaryValue();
base::DictionaryValue* headers_dict = new base::DictionaryValue();
for (SpdyHeaderBlock::const_iterator it = headers->begin();
@@ -19,7 +19,7 @@ base::Value* SpdyHeaderBlockNetLogCallback(
headers_dict->SetWithoutPathExpansion(
it->first,
new base::StringValue(
- ShouldShowHttpHeaderValue(it->first) ? it->second : "[elided]"));
+ ElideHeaderValueForNetLog(log_level, it->first, it->second)));
}
dict->Set("headers", headers_dict);
return dict;
diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
index da95b51..76a0031 100644
--- a/net/spdy/spdy_http_utils.cc
+++ b/net/spdy/spdy_http_utils.cc
@@ -193,12 +193,4 @@ GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers,
return GURL(url);
}
-bool ShouldShowHttpHeaderValue(const std::string& header_name) {
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- if (header_name == "proxy-authorization")
- return false;
-#endif
- return true;
-}
-
} // namespace net
diff --git a/net/spdy/spdy_http_utils.h b/net/spdy/spdy_http_utils.h
index 6a91c888..34a0fcd 100644
--- a/net/spdy/spdy_http_utils.h
+++ b/net/spdy/spdy_http_utils.h
@@ -42,10 +42,6 @@ GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers,
SpdyMajorVersion protocol_version,
bool pushed);
-// Returns true if the value of this header should be displayed.
-NET_EXPORT_PRIVATE bool ShouldShowHttpHeaderValue(
- const std::string& header_name);
-
NET_EXPORT_PRIVATE SpdyPriority ConvertRequestPriorityToSpdyPriority(
RequestPriority priority,
SpdyMajorVersion protocol_version);
diff --git a/net/spdy/spdy_http_utils_unittest.cc b/net/spdy/spdy_http_utils_unittest.cc
index daac323..d811164 100644
--- a/net/spdy/spdy_http_utils_unittest.cc
+++ b/net/spdy/spdy_http_utils_unittest.cc
@@ -52,16 +52,6 @@ TEST(SpdyHttpUtilsTest, ConvertSpdy3PriorityToRequestPriority) {
}
}
-TEST(SpdyHttpUtilsTest, ShowHttpHeaderValue){
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- EXPECT_FALSE(ShouldShowHttpHeaderValue("proxy-authorization"));
- EXPECT_TRUE(ShouldShowHttpHeaderValue("accept-encoding"));
-#else
- EXPECT_TRUE(ShouldShowHttpHeaderValue("proxy-authorization"));
- EXPECT_TRUE(ShouldShowHttpHeaderValue("accept-encoding"));
-#endif
-}
-
} // namespace
} // namespace net
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index ac30a52..c20d89e 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -29,8 +29,10 @@
#include "net/base/net_log.h"
#include "net/base/net_util.h"
#include "net/cert/asn1_util.h"
+#include "net/http/http_log_util.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties.h"
+#include "net/http/http_util.h"
#include "net/spdy/spdy_buffer_producer.h"
#include "net/spdy/spdy_frame_builder.h"
#include "net/spdy/spdy_http_utils.h"
@@ -54,13 +56,14 @@ const SpdyStreamId kFirstStreamId = 1;
const int kMinPushedStreamLifetimeSeconds = 300;
scoped_ptr<base::ListValue> SpdyHeaderBlockToListValue(
- const SpdyHeaderBlock& headers) {
+ const SpdyHeaderBlock& headers,
+ net::NetLog::LogLevel log_level) {
scoped_ptr<base::ListValue> headers_list(new base::ListValue());
for (SpdyHeaderBlock::const_iterator it = headers.begin();
it != headers.end(); ++it) {
headers_list->AppendString(
it->first + ": " +
- (ShouldShowHttpHeaderValue(it->first) ? it->second : "[elided]"));
+ ElideHeaderValueForNetLog(log_level, it->first, it->second));
}
return headers_list.Pass();
}
@@ -70,9 +73,10 @@ base::Value* NetLogSpdySynStreamSentCallback(const SpdyHeaderBlock* headers,
bool unidirectional,
SpdyPriority spdy_priority,
SpdyStreamId stream_id,
- NetLog::LogLevel /* log_level */) {
+ NetLog::LogLevel log_level) {
base::DictionaryValue* dict = new base::DictionaryValue();
- dict->Set("headers", SpdyHeaderBlockToListValue(*headers).release());
+ dict->Set("headers",
+ SpdyHeaderBlockToListValue(*headers, log_level).release());
dict->SetBoolean("fin", fin);
dict->SetBoolean("unidirectional", unidirectional);
dict->SetInteger("spdy_priority", static_cast<int>(spdy_priority));
@@ -87,9 +91,10 @@ base::Value* NetLogSpdySynStreamReceivedCallback(
SpdyPriority spdy_priority,
SpdyStreamId stream_id,
SpdyStreamId associated_stream,
- NetLog::LogLevel /* log_level */) {
+ NetLog::LogLevel log_level) {
base::DictionaryValue* dict = new base::DictionaryValue();
- dict->Set("headers", SpdyHeaderBlockToListValue(*headers).release());
+ dict->Set("headers",
+ SpdyHeaderBlockToListValue(*headers, log_level).release());
dict->SetBoolean("fin", fin);
dict->SetBoolean("unidirectional", unidirectional);
dict->SetInteger("spdy_priority", static_cast<int>(spdy_priority));
@@ -102,9 +107,10 @@ base::Value* NetLogSpdySynReplyOrHeadersReceivedCallback(
const SpdyHeaderBlock* headers,
bool fin,
SpdyStreamId stream_id,
- NetLog::LogLevel /* log_level */) {
+ NetLog::LogLevel log_level) {
base::DictionaryValue* dict = new base::DictionaryValue();
- dict->Set("headers", SpdyHeaderBlockToListValue(*headers).release());
+ dict->Set("headers",
+ SpdyHeaderBlockToListValue(*headers, log_level).release());
dict->SetBoolean("fin", fin);
dict->SetInteger("stream_id", stream_id);
return dict;