Send Set Dynamic Table Capacity instruction.
Do not change dynamic table capacity in
QpackHeaderTable::SetMaximumDynamicTableCapacity(), because according to
https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#eviction, "The initial
capacity of the dynamic table is zero.". Instead, add
QpackEncoder::SetDynamicTableCapacity() to send Set Dynamic Table Capacity
instruction.
Roundtrip tests were passing because QpackHeaderTable::SetMaximumDynamicTableCapacity() incorrectly updated the capacity for both the encoder and decoder context.
gfe-relnote: n/a, change to QUIC v99-only code. Protected by existing disabled gfe2_reloadable_flag_quic_enable_version_99.
PiperOrigin-RevId: 266358801
Change-Id: I23f10f224139dee79e9305c42c85b75cba61a999
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index 101b33d..73f63bb 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -694,9 +694,13 @@
QUIC_DVLOG(1)
<< "SETTINGS_QPACK_MAX_TABLE_CAPACITY received with value "
<< value;
- // TODO(b/112770235): Limit value to
- // qpack_maximum_dynamic_table_capacity_.
+ // Communicate |value| to encoder, because it is used for encoding
+ // Required Insert Count.
qpack_encoder_->SetMaximumDynamicTableCapacity(value);
+ // However, limit the dynamic table capacity to
+ // |qpack_maximum_dynamic_table_capacity_|.
+ qpack_encoder_->SetDynamicTableCapacity(
+ std::min(value, qpack_maximum_dynamic_table_capacity_));
break;
case SETTINGS_MAX_HEADER_LIST_SIZE:
QUIC_DVLOG(1) << "SETTINGS_MAX_HEADER_LIST_SIZE received with value "
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index 3798461..e09cbf4 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -1921,6 +1921,7 @@
testing::InSequence s;
Initialize(kShouldProcessData);
+ session_->qpack_decoder()->OnSetDynamicTableCapacity(1024);
auto decoder_send_stream =
QuicSpdySessionPeer::GetQpackDecoderSendStream(session_.get());
@@ -1983,6 +1984,7 @@
testing::InSequence s;
Initialize(kShouldProcessData);
+ session_->qpack_decoder()->OnSetDynamicTableCapacity(1024);
// HEADERS frame referencing first dynamic table entry.
std::string headers = HeadersFrame(QuicTextUtils::HexDecode("020080"));
@@ -2040,6 +2042,7 @@
}
Initialize(kShouldProcessData);
+ session_->qpack_decoder()->OnSetDynamicTableCapacity(1024);
// HEADERS frame only referencing entry with absolute index 0 but with
// Required Insert Count = 2, which is incorrect.
@@ -2078,6 +2081,7 @@
testing::InSequence s;
Initialize(kShouldProcessData);
+ session_->qpack_decoder()->OnSetDynamicTableCapacity(1024);
// HEADERS frame referencing first dynamic table entry.
std::string headers = HeadersFrame(QuicTextUtils::HexDecode("020080"));