netty/netty-incubator-codec-http3

QPack: Max table capacity value should be used to encode required insert count value

AlekseiEfimov opened this issue · 0 comments

According to the required insert count encoding algorithm described in RFC-9204 "4.5.1.1. Required Insert Count" the max table capacity value should be used to encode maxEntries value:

Here MaxEntries is the maximum number of entries that the dynamic table can have.
The smallest entry has empty name and value strings and has the size of 32.
Hence, MaxEntries is calculated as:
   MaxEntries = floor( MaxTableCapacity / 32 )

MaxTableCapacity is the QPACK_MAX_TABLE_CAPACITY HTTP/3 setting value sent by the decoder:

To bound the memory requirements of the decoder, the decoder limits the maximum value the encoder
is permitted to set for the dynamic table capacity.
In HTTP/3, this limit is determined by the value of SETTINGS_QPACK_MAX_TABLE_CAPACITY
 sent by the decoder;

The implementations of QPack's encoder and decoder are using the current capacity value instead:

  • QpackEncoderDynamicTable.java:241:
    return reqInsertCount == 0 ? 0 : reqInsertCount % toIntExact(2 * floorDiv(capacity, 32)) + 1;

  • QPackDecoder.java:165:
    maxEntries = floorDiv(capacity, 32);