Send Insert Count Increment instruction after decoding a header block if possible.
See also https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#new-table-entries
for justification of not delaying sending Insert Count Increment instructions too long.
gfe-relnote: n/a, change to QUIC v99-only code. Protected by existing disabled gfe2_reloadable_flag_quic_enable_version_99.
PiperOrigin-RevId: 273510751
Change-Id: Ic33afd24c41bc92577b9b75d00f8ecdd94058d60
diff --git a/quic/core/qpack/qpack_decoder_test.cc b/quic/core/qpack/qpack_decoder_test.cc
index 7071913..faa0f9d 100644
--- a/quic/core/qpack/qpack_decoder_test.cc
+++ b/quic/core/qpack/qpack_decoder_test.cc
@@ -816,7 +816,6 @@
// At most three non-empty entries fit in the dynamic table.
DecodeEncoderStreamData(QuicTextUtils::HexDecode("3f61"));
- StartDecoding();
DecodeHeaderBlock(QuicTextUtils::HexDecode(
"0700" // Required Insert Count 6 and Delta Base 0.
// Base is 6 + 0 = 6.
@@ -854,6 +853,29 @@
progressive_decoder2->Decode(data);
}
+TEST_P(QpackDecoderTest, InsertCountIncrement) {
+ DecodeEncoderStreamData(QuicTextUtils::HexDecode(
+ "3fe107" // Set dynamic table capacity to 1024.
+ "6294e703626172" // Add literal entry with name "foo" and value "bar".
+ "00")); // Duplicate entry.
+
+ EXPECT_CALL(handler_, OnHeaderDecoded(Eq("foo"), Eq("bar")));
+ EXPECT_CALL(handler_, OnDecodingCompleted());
+ EXPECT_CALL(decoder_stream_sender_delegate_,
+ WriteStreamData(Eq(kHeaderAcknowledgement)));
+
+ // Decoder received two insertions, but Header Acknowledgement only increases
+ // Known Insert Count to one. Decoder should send an Insert Count Increment
+ // instruction with increment of one to update Known Insert Count to two.
+ EXPECT_CALL(decoder_stream_sender_delegate_,
+ WriteStreamData(Eq(QuicTextUtils::HexDecode("01"))));
+
+ DecodeHeaderBlock(QuicTextUtils::HexDecode(
+ "0200" // Required Insert Count 1 and Delta Base 0.
+ // Base is 1 + 0 = 1.
+ "80")); // Dynamic table entry with relative index 0, absolute index 0.
+}
+
} // namespace
} // namespace test
} // namespace quic