| 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_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "net/http/http_auth_challenge_tokenizer.h" | 9 #include "net/http/http_auth_challenge_tokenizer.h" |
| 10 #include "net/http/http_util.h" | 10 #include "net/http/http_util.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 bool ShouldRedactChallenge(HttpAuthChallengeTokenizer* challenge) { | 16 bool ShouldRedactChallenge(HttpAuthChallengeTokenizer* challenge) { |
| 17 // Ignore lines with commas, as they may contain lists of schemes, and | 17 // Ignore lines with commas, as they may contain lists of schemes, and |
| 18 // the information we want to hide is Base64 encoded, so has no commas. | 18 // the information we want to hide is Base64 encoded, so has no commas. |
| 19 if (challenge->challenge_text().find(',') != std::string::npos) | 19 if (challenge->challenge_text().find(',') != std::string::npos) |
| 20 return false; | 20 return false; |
| 21 | 21 |
| 22 std::string scheme = StringToLowerASCII(challenge->scheme()); | 22 std::string scheme = base::StringToLowerASCII(challenge->scheme()); |
| 23 // Invalid input. | 23 // Invalid input. |
| 24 if (scheme.empty()) | 24 if (scheme.empty()) |
| 25 return false; | 25 return false; |
| 26 | 26 |
| 27 // Ignore Basic and Digest authentication challenges, as they contain | 27 // Ignore Basic and Digest authentication challenges, as they contain |
| 28 // public information. | 28 // public information. |
| 29 if (scheme == "basic" || scheme == "digest") | 29 if (scheme == "basic" || scheme == "digest") |
| 30 return false; | 30 return false; |
| 31 | 31 |
| 32 return true; | 32 return true; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (redact_begin == redact_end) | 91 if (redact_begin == redact_end) |
| 92 return value; | 92 return value; |
| 93 | 93 |
| 94 return std::string(value.begin(), redact_begin) + | 94 return std::string(value.begin(), redact_begin) + |
| 95 base::StringPrintf("[%ld bytes were stripped]", | 95 base::StringPrintf("[%ld bytes were stripped]", |
| 96 static_cast<long>(redact_end - redact_begin)) + | 96 static_cast<long>(redact_end - redact_begin)) + |
| 97 std::string(redact_end, value.end()); | 97 std::string(redact_end, value.end()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace net | 100 } // namespace net |
| OLD | NEW |