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

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

Issue 1360253002: Log GOAWAY frame debug data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #12. Created 5 years, 2 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/http/http_log_util.h ('k') | net/http/http_log_util_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_util.h" 8 #include "base/strings/string_util.h"
8 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
9 #include "net/http/http_auth_challenge_tokenizer.h" 10 #include "net/http/http_auth_challenge_tokenizer.h"
10 #include "net/http/http_util.h" 11 #include "net/http/http_util.h"
11 12
12 namespace net { 13 namespace net {
13 14
14 namespace { 15 namespace {
15 16
16 bool ShouldRedactChallenge(HttpAuthChallengeTokenizer* challenge) { 17 bool ShouldRedactChallenge(HttpAuthChallengeTokenizer* challenge) {
(...skipping 18 matching lines...) Expand all
35 } // namespace 36 } // namespace
36 37
37 std::string ElideHeaderValueForNetLog(NetLogCaptureMode capture_mode, 38 std::string ElideHeaderValueForNetLog(NetLogCaptureMode capture_mode,
38 const std::string& header, 39 const std::string& header,
39 const std::string& value) { 40 const std::string& value) {
40 std::string::const_iterator redact_begin = value.begin(); 41 std::string::const_iterator redact_begin = value.begin();
41 std::string::const_iterator redact_end = value.begin(); 42 std::string::const_iterator redact_end = value.begin();
42 43
43 if (redact_begin == redact_end && 44 if (redact_begin == redact_end &&
44 !capture_mode.include_cookies_and_credentials()) { 45 !capture_mode.include_cookies_and_credentials()) {
45 // Note: this logic should be kept in sync with stripCookiesAndLoginInfo in 46 // Note: this logic should be kept in sync with stripCookieOrLoginInfo in
46 // chrome/browser/resources/net_internals/log_view_painter.js. 47 // chrome/browser/resources/net_internals/log_view_painter.js.
47 48
48 if (base::EqualsCaseInsensitiveASCII(header, "set-cookie") || 49 if (base::EqualsCaseInsensitiveASCII(header, "set-cookie") ||
49 base::EqualsCaseInsensitiveASCII(header, "set-cookie2") || 50 base::EqualsCaseInsensitiveASCII(header, "set-cookie2") ||
50 base::EqualsCaseInsensitiveASCII(header, "cookie") || 51 base::EqualsCaseInsensitiveASCII(header, "cookie") ||
51 base::EqualsCaseInsensitiveASCII(header, "authorization") || 52 base::EqualsCaseInsensitiveASCII(header, "authorization") ||
52 base::EqualsCaseInsensitiveASCII(header, "proxy-authorization")) { 53 base::EqualsCaseInsensitiveASCII(header, "proxy-authorization")) {
53 redact_begin = value.begin(); 54 redact_begin = value.begin();
54 redact_end = value.end(); 55 redact_end = value.end();
55 } else if (base::EqualsCaseInsensitiveASCII(header, "www-authenticate") || 56 } else if (base::EqualsCaseInsensitiveASCII(header, "www-authenticate") ||
(...skipping 10 matching lines...) Expand all
66 67
67 if (redact_begin == redact_end) 68 if (redact_begin == redact_end)
68 return value; 69 return value;
69 70
70 return std::string(value.begin(), redact_begin) + 71 return std::string(value.begin(), redact_begin) +
71 base::StringPrintf("[%ld bytes were stripped]", 72 base::StringPrintf("[%ld bytes were stripped]",
72 static_cast<long>(redact_end - redact_begin)) + 73 static_cast<long>(redact_end - redact_begin)) +
73 std::string(redact_end, value.end()); 74 std::string(redact_end, value.end());
74 } 75 }
75 76
77 std::string ElideGoAwayDebugDataForNetLog(NetLogCaptureMode capture_mode,
78 base::StringPiece debug_data) {
79 // Note: this logic should be kept in sync with stripGoAwayDebugData in
80 // chrome/browser/resources/net_internals/log_view_painter.js.
81 if (capture_mode.include_cookies_and_credentials()) {
82 return debug_data.as_string();
83 }
84
85 return std::string("[") + base::SizeTToString(debug_data.size()) +
86 std::string(" bytes were stripped]");
87 }
88
76 } // namespace net 89 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_log_util.h ('k') | net/http/http_log_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698