diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/net/quic/quic_http3_logger.cc | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/net/quic/quic_http3_logger.cc')
-rw-r--r-- | chromium/net/quic/quic_http3_logger.cc | 84 |
1 files changed, 47 insertions, 37 deletions
diff --git a/chromium/net/quic/quic_http3_logger.cc b/chromium/net/quic/quic_http3_logger.cc index c190156ff45..e93ff2987ea 100644 --- a/chromium/net/quic/quic_http3_logger.cc +++ b/chromium/net/quic/quic_http3_logger.cc @@ -9,10 +9,13 @@ #include <vector> #include "base/metrics/histogram_macros.h" +#include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" +#include "net/http/http_log_util.h" #include "net/log/net_log_capture_mode.h" #include "net/log/net_log_event_type.h" #include "net/log/net_log_values.h" +#include "net/spdy/spdy_log_util.h" namespace net { @@ -64,20 +67,19 @@ base::Value NetLogThreeIntParams(base::StringPiece name1, return dict; } -base::Value NetLogHeadersToDict(const quic::QuicHeaderList& headers) { - base::Value dict(base::Value::Type::DICTIONARY); - for (auto header : headers) { - dict.SetStringKey(header.first, header.second); - } - return dict; -} - -base::Value NetLogHeadersToDict(const spdy::SpdyHeaderBlock& headers) { - base::Value dict(base::Value::Type::DICTIONARY); - for (auto header : headers) { - dict.SetStringKey(header.first, header.second); +base::ListValue ElideQuicHeaderListForNetLog( + const quic::QuicHeaderList& headers, + NetLogCaptureMode capture_mode) { + base::ListValue headers_list; + for (const auto& header : headers) { + base::StringPiece key = header.first; + base::StringPiece value = header.second; + headers_list.Append(NetLogStringValue( + base::StrCat({key, ": ", + ElideHeaderValueForNetLog(capture_mode, key.as_string(), + value.as_string())}))); } - return dict; + return headers_list; } } // namespace @@ -248,11 +250,13 @@ void QuicHttp3Logger::OnHeadersDecoded(quic::QuicStreamId stream_id, return; } net_log_.AddEvent( - NetLogEventType::HTTP3_HEADERS_DECODED, [stream_id, &headers] { + NetLogEventType::HTTP3_HEADERS_DECODED, + [stream_id, &headers](NetLogCaptureMode capture_mode) { base::Value dict(base::Value::Type::DICTIONARY); dict.SetKey("stream_id", NetLogNumberValue(static_cast<uint64_t>(stream_id))); - dict.SetKey("headers", NetLogHeadersToDict(headers)); + dict.SetKey("headers", + ElideQuicHeaderListForNetLog(headers, capture_mode)); return dict; }); } @@ -279,16 +283,18 @@ void QuicHttp3Logger::OnPushPromiseDecoded(quic::QuicStreamId stream_id, if (!net_log_.IsCapturing()) { return; } - net_log_.AddEvent(NetLogEventType::HTTP3_PUSH_PROMISE_DECODED, [stream_id, - push_id, - &headers] { - base::Value dict(base::Value::Type::DICTIONARY); - dict.SetKey("stream_id", - NetLogNumberValue(static_cast<uint64_t>(stream_id))); - dict.SetKey("push_id", NetLogNumberValue(static_cast<uint64_t>(push_id))); - dict.SetKey("headers", NetLogHeadersToDict(headers)); - return dict; - }); + net_log_.AddEvent( + NetLogEventType::HTTP3_PUSH_PROMISE_DECODED, + [stream_id, push_id, &headers](NetLogCaptureMode capture_mode) { + base::Value dict(base::Value::Type::DICTIONARY); + dict.SetKey("stream_id", + NetLogNumberValue(static_cast<uint64_t>(stream_id))); + dict.SetKey("push_id", + NetLogNumberValue(static_cast<uint64_t>(push_id))); + dict.SetKey("headers", + ElideQuicHeaderListForNetLog(headers, capture_mode)); + return dict; + }); } void QuicHttp3Logger::OnUnknownFrameReceived( @@ -357,11 +363,13 @@ void QuicHttp3Logger::OnHeadersFrameSent( return; } net_log_.AddEvent( - NetLogEventType::HTTP3_HEADERS_SENT, [stream_id, &header_block] { + NetLogEventType::HTTP3_HEADERS_SENT, + [stream_id, &header_block](NetLogCaptureMode capture_mode) { base::Value dict(base::Value::Type::DICTIONARY); dict.SetKey("stream_id", NetLogNumberValue(static_cast<uint64_t>(stream_id))); - dict.SetKey("headers", NetLogHeadersToDict(header_block)); + dict.SetKey("headers", + ElideSpdyHeaderBlockForNetLog(header_block, capture_mode)); return dict; }); } @@ -373,16 +381,18 @@ void QuicHttp3Logger::OnPushPromiseFrameSent( if (!net_log_.IsCapturing()) { return; } - net_log_.AddEvent(NetLogEventType::HTTP3_PUSH_PROMISE_SENT, [stream_id, - push_id, - &header_block] { - base::Value dict(base::Value::Type::DICTIONARY); - dict.SetKey("stream_id", - NetLogNumberValue(static_cast<uint64_t>(stream_id))); - dict.SetKey("push_id", NetLogNumberValue(static_cast<uint64_t>(push_id))); - dict.SetKey("headers", NetLogHeadersToDict(header_block)); - return dict; - }); + net_log_.AddEvent( + NetLogEventType::HTTP3_PUSH_PROMISE_SENT, + [stream_id, push_id, &header_block](NetLogCaptureMode capture_mode) { + base::Value dict(base::Value::Type::DICTIONARY); + dict.SetKey("stream_id", + NetLogNumberValue(static_cast<uint64_t>(stream_id))); + dict.SetKey("push_id", + NetLogNumberValue(static_cast<uint64_t>(push_id))); + dict.SetKey("headers", + ElideSpdyHeaderBlockForNetLog(header_block, capture_mode)); + return dict; + }); } } // namespace net |