OLD | NEW |
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 Loading... |
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 |
OLD | NEW |