Skip to content

Commit

Permalink
Fix #10805 zero dynamic table (#11445) (#11452)
Browse files Browse the repository at this point in the history
* Fix #10805 zero dynamic table (#11445)

* Added test for #10805 Zero Dynamic Table

* fixed file header

* Added test for #10805 Zero Dynamic Table

* Fix for #10805 Zero Dynamic Table

Set the correct default size for the table.
Always send the max table size on the first encode

* updated file header

Signed-off-by: gregw <gregw@webtide.com>

---------

Signed-off-by: gregw <gregw@webtide.com>
  • Loading branch information
gregw committed Feb 28, 2024
1 parent 1bba3cd commit 686dd88
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ public class HpackEncoder
private int _maxHeaderListSize;
private int _headerListSize;
private boolean _validateEncoding = true;
private boolean _maxDynamicTableSizeSent = false;

public HpackEncoder()
{
_context = new HpackContext(0);
_context = new HpackContext(HpackContext.DEFAULT_MAX_TABLE_CAPACITY);
_debug = LOG.isDebugEnabled();
setMaxTableCapacity(HpackContext.DEFAULT_MAX_TABLE_CAPACITY);
setTableCapacity(HpackContext.DEFAULT_MAX_TABLE_CAPACITY);
Expand Down Expand Up @@ -197,8 +198,11 @@ public void encode(ByteBuffer buffer, MetaData metadata) throws HpackException

// If max table size changed, send the correspondent instruction.
int tableCapacity = getTableCapacity();
if (tableCapacity != _context.getMaxDynamicTableSize())
if (!_maxDynamicTableSizeSent || tableCapacity != _context.getMaxDynamicTableSize())
{
_maxDynamicTableSizeSent = true;
encodeMaxDynamicTableSize(buffer, tableCapacity);
}

// Add Request/response meta fields
if (metadata.isRequest())
Expand Down

0 comments on commit 686dd88

Please sign in to comment.