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

Side by Side Diff: net/http/http_log_util.cc

Issue 1414313002: Allow dynamic updating of authentication policies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to cbentzel@'s comments. Created 5 years 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 unified diff | Download patch
« no previous file with comments | « net/http/http_auth_unittest.cc ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_log_util.h" 5 #include "net/http/http_log_util.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "net/http/http_auth_challenge_tokenizer.h" 10 #include "net/http/http_auth_challenge_tokenizer.h"
11 #include "net/http/http_auth_scheme.h"
11 #include "net/http/http_util.h" 12 #include "net/http/http_util.h"
12 13
13 namespace net { 14 namespace net {
14 15
15 namespace { 16 namespace {
16 17
17 bool ShouldRedactChallenge(HttpAuthChallengeTokenizer* challenge) { 18 bool ShouldRedactChallenge(HttpAuthChallengeTokenizer* challenge) {
18 // Ignore lines with commas, as they may contain lists of schemes, and 19 // Ignore lines with commas, as they may contain lists of schemes, and
19 // the information we want to hide is Base64 encoded, so has no commas. 20 // the information we want to hide is Base64 encoded, so has no commas.
20 if (challenge->challenge_text().find(',') != std::string::npos) 21 if (challenge->challenge_text().find(',') != std::string::npos)
21 return false; 22 return false;
22 23
23 std::string scheme = base::ToLowerASCII(challenge->scheme()); 24 std::string scheme = base::ToLowerASCII(challenge->scheme());
24 // Invalid input. 25 // Invalid input.
25 if (scheme.empty()) 26 if (scheme.empty())
26 return false; 27 return false;
27 28
28 // Ignore Basic and Digest authentication challenges, as they contain 29 // Ignore Basic and Digest authentication challenges, as they contain
29 // public information. 30 // public information.
30 if (scheme == "basic" || scheme == "digest") 31 if (scheme == kBasicAuthScheme || scheme == kDigestAuthScheme)
31 return false; 32 return false;
32 33
33 return true; 34 return true;
34 } 35 }
35 36
36 } // namespace 37 } // namespace
37 38
38 std::string ElideHeaderValueForNetLog(NetLogCaptureMode capture_mode, 39 std::string ElideHeaderValueForNetLog(NetLogCaptureMode capture_mode,
39 const std::string& header, 40 const std::string& header,
40 const std::string& value) { 41 const std::string& value) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // chrome/browser/resources/net_internals/log_view_painter.js. 81 // chrome/browser/resources/net_internals/log_view_painter.js.
81 if (capture_mode.include_cookies_and_credentials()) { 82 if (capture_mode.include_cookies_and_credentials()) {
82 return debug_data.as_string(); 83 return debug_data.as_string();
83 } 84 }
84 85
85 return std::string("[") + base::SizeTToString(debug_data.size()) + 86 return std::string("[") + base::SizeTToString(debug_data.size()) +
86 std::string(" bytes were stripped]"); 87 std::string(" bytes were stripped]");
87 } 88 }
88 89
89 } // namespace net 90 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_unittest.cc ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698