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

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

Issue 1224553010: Replace base::str[n]casecmp with helper functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months 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/dns/dns_response.cc ('k') | net/http/http_request_headers.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_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"
(...skipping 27 matching lines...) Expand all
38 const std::string& header, 38 const std::string& header,
39 const std::string& value) { 39 const std::string& value) {
40 std::string::const_iterator redact_begin = value.begin(); 40 std::string::const_iterator redact_begin = value.begin();
41 std::string::const_iterator redact_end = value.begin(); 41 std::string::const_iterator redact_end = value.begin();
42 42
43 if (redact_begin == redact_end && 43 if (redact_begin == redact_end &&
44 !capture_mode.include_cookies_and_credentials()) { 44 !capture_mode.include_cookies_and_credentials()) {
45 // Note: this logic should be kept in sync with stripCookiesAndLoginInfo in 45 // Note: this logic should be kept in sync with stripCookiesAndLoginInfo in
46 // chrome/browser/resources/net_internals/log_view_painter.js. 46 // chrome/browser/resources/net_internals/log_view_painter.js.
47 47
48 if (!base::strcasecmp(header.c_str(), "set-cookie") || 48 if (base::EqualsCaseInsensitiveASCII(header, "set-cookie") ||
49 !base::strcasecmp(header.c_str(), "set-cookie2") || 49 base::EqualsCaseInsensitiveASCII(header, "set-cookie2") ||
50 !base::strcasecmp(header.c_str(), "cookie") || 50 base::EqualsCaseInsensitiveASCII(header, "cookie") ||
51 !base::strcasecmp(header.c_str(), "authorization") || 51 base::EqualsCaseInsensitiveASCII(header, "authorization") ||
52 !base::strcasecmp(header.c_str(), "proxy-authorization")) { 52 base::EqualsCaseInsensitiveASCII(header, "proxy-authorization")) {
53 redact_begin = value.begin(); 53 redact_begin = value.begin();
54 redact_end = value.end(); 54 redact_end = value.end();
55 } else if (!base::strcasecmp(header.c_str(), "www-authenticate") || 55 } else if (base::EqualsCaseInsensitiveASCII(header, "www-authenticate") ||
56 !base::strcasecmp(header.c_str(), "proxy-authenticate")) { 56 base::EqualsCaseInsensitiveASCII(header, "proxy-authenticate")) {
57 // Look for authentication information from data received from the server 57 // Look for authentication information from data received from the server
58 // in multi-round Negotiate authentication. 58 // in multi-round Negotiate authentication.
59 HttpAuthChallengeTokenizer challenge(value.begin(), value.end()); 59 HttpAuthChallengeTokenizer challenge(value.begin(), value.end());
60 if (ShouldRedactChallenge(&challenge)) { 60 if (ShouldRedactChallenge(&challenge)) {
61 redact_begin = challenge.params_begin(); 61 redact_begin = challenge.params_begin();
62 redact_end = challenge.params_end(); 62 redact_end = challenge.params_end();
63 } 63 }
64 } 64 }
65 } 65 }
66 66
67 if (redact_begin == redact_end) 67 if (redact_begin == redact_end)
68 return value; 68 return value;
69 69
70 return std::string(value.begin(), redact_begin) + 70 return std::string(value.begin(), redact_begin) +
71 base::StringPrintf("[%ld bytes were stripped]", 71 base::StringPrintf("[%ld bytes were stripped]",
72 static_cast<long>(redact_end - redact_begin)) + 72 static_cast<long>(redact_end - redact_begin)) +
73 std::string(redact_end, value.end()); 73 std::string(redact_end, value.end());
74 } 74 }
75 75
76 } // namespace net 76 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/dns_response.cc ('k') | net/http/http_request_headers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698