summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbengr@chromium.org <bengr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-04 17:15:46 +0000
committerbengr@chromium.org <bengr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-04 17:15:46 +0000
commit1573cf1afe8c0ddbd8c4a64fdc78b7c487371e70 (patch)
tree51d69aaa601f1ce87adeb9014a42636108fe434d
parentca89aca0bae172ea76102f0b8d40177066c0d092 (diff)
downloadchromium_src-1573cf1afe8c0ddbd8c4a64fdc78b7c487371e70.zip
chromium_src-1573cf1afe8c0ddbd8c4a64fdc78b7c487371e70.tar.gz
chromium_src-1573cf1afe8c0ddbd8c4a64fdc78b7c487371e70.tar.bz2
Merge 248566 "Elide proxy authentication headers"
> Elide proxy authentication headers > > The change prevents the data reduction proxy's authentication > headers from being exposed in net logs and dev tools. > > BUG=179382 > > Review URL: https://codereview.chromium.org/149703005 TBR=bengr@chromium.org Review URL: https://codereview.chromium.org/135163007 git-svn-id: svn://svn.chromium.org/chrome/branches/1750/src@248738 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/http/http_request_headers.cc21
-rw-r--r--net/http/http_response_headers.cc16
2 files changed, 30 insertions, 7 deletions
diff --git a/net/http/http_request_headers.cc b/net/http/http_request_headers.cc
index bf557df..8c9c428 100644
--- a/net/http/http_request_headers.cc
+++ b/net/http/http_request_headers.cc
@@ -11,6 +11,18 @@
#include "base/values.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";
@@ -191,10 +203,11 @@ base::Value* HttpRequestHeaders::NetLogCallback(
base::ListValue* headers = new base::ListValue();
for (HeaderVector::const_iterator it = headers_.begin();
it != headers_.end(); ++it) {
- headers->Append(
- new base::StringValue(base::StringPrintf("%s: %s",
- it->key.c_str(),
- it->value.c_str())));
+ headers->Append(new base::StringValue(
+ base::StringPrintf("%s: %s",
+ it->key.c_str(),
+ (ShouldShowHttpHeaderValue(it->key) ?
+ it->value.c_str() : "[elided]"))));
}
dict->Set("headers", headers);
return dict;
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 9d95153..289facd 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -113,6 +113,14 @@ 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
struct HttpResponseHeaders::ParsedHeader {
@@ -1309,9 +1317,11 @@ base::Value* HttpResponseHeaders::NetLogCallback(
std::string value;
while (EnumerateHeaderLines(&iterator, &name, &value)) {
headers->Append(
- new base::StringValue(base::StringPrintf("%s: %s",
- name.c_str(),
- value.c_str())));
+ new base::StringValue(
+ base::StringPrintf("%s: %s",
+ name.c_str(),
+ (ShouldShowHttpHeaderValue(name) ?
+ value.c_str() : "[elided]"))));
}
dict->Set("headers", headers);
return dict;