| Index: net/quic/core/quic_header_list.cc
|
| diff --git a/net/quic/core/quic_header_list.cc b/net/quic/core/quic_header_list.cc
|
| index df8ecac45213d9a1e54f3405dbf998591a1a257b..871c49a3ce5a54d7d2d2b769178b995351674e04 100644
|
| --- a/net/quic/core/quic_header_list.cc
|
| +++ b/net/quic/core/quic_header_list.cc
|
| @@ -6,9 +6,14 @@
|
|
|
| using std::string;
|
|
|
| +#include "net/quic/core/quic_flags.h"
|
| +#include "net/quic/core/quic_protocol.h"
|
| +
|
| namespace net {
|
|
|
| -QuicHeaderList::QuicHeaderList() : uncompressed_header_bytes_(0) {}
|
| +QuicHeaderList::QuicHeaderList()
|
| + : max_uncompressed_header_bytes_(kDefaultMaxUncompressedHeaderSize),
|
| + uncompressed_header_bytes_(0) {}
|
|
|
| QuicHeaderList::QuicHeaderList(QuicHeaderList&& other) = default;
|
|
|
| @@ -27,18 +32,26 @@ void QuicHeaderList::OnHeaderBlockStart() {
|
| }
|
|
|
| void QuicHeaderList::OnHeader(base::StringPiece name, base::StringPiece value) {
|
| - header_list_.emplace_back(name.as_string(), value.as_string());
|
| + // Avoid infinte buffering of headers. No longer store headers
|
| + // once the current headers are over the limit.
|
| + if (!FLAGS_quic_limit_uncompressed_headers ||
|
| + uncompressed_header_bytes_ == 0 || !header_list_.empty()) {
|
| + header_list_.emplace_back(name.as_string(), value.as_string());
|
| + }
|
| }
|
|
|
| void QuicHeaderList::OnHeaderBlockEnd(size_t uncompressed_header_bytes) {
|
| - uncompressed_header_bytes_ = uncompressed_header_bytes;
|
| - compressed_header_bytes_ = uncompressed_header_bytes;
|
| + OnHeaderBlockEnd(uncompressed_header_bytes, uncompressed_header_bytes);
|
| }
|
|
|
| void QuicHeaderList::OnHeaderBlockEnd(size_t uncompressed_header_bytes,
|
| size_t compressed_header_bytes) {
|
| uncompressed_header_bytes_ = uncompressed_header_bytes;
|
| compressed_header_bytes_ = compressed_header_bytes;
|
| + if (FLAGS_quic_limit_uncompressed_headers &&
|
| + uncompressed_header_bytes_ > max_uncompressed_header_bytes_) {
|
| + Clear();
|
| + }
|
| }
|
|
|
| void QuicHeaderList::Clear() {
|
|
|