Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10805 zero dynamic table #11445

Merged
merged 5 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IO
});

if (clientMaxCapacity >= 0)
client.setMaxEncoderTableCapacity(0);
client.setMaxEncoderTableCapacity(clientMaxCapacity);
if (serverMaxCapacity >= 0)
connector.getConnectionFactory(AbstractHTTP2ServerConnectionFactory.class).setMaxEncoderTableCapacity(serverMaxCapacity);

Expand Down Expand Up @@ -103,7 +103,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IO
});

if (clientMaxCapacity >= 0)
client.setMaxDecoderTableCapacity(0);
client.setMaxDecoderTableCapacity(clientMaxCapacity);
if (serverMaxCapacity >= 0)
connector.getConnectionFactory(AbstractHTTP2ServerConnectionFactory.class).setMaxDecoderTableCapacity(serverMaxCapacity);

Expand Down Expand Up @@ -151,8 +151,8 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IO

if (clientMaxCapacity >= 0)
{
client.setMaxDecoderTableCapacity(0);
client.setMaxEncoderTableCapacity(0);
client.setMaxDecoderTableCapacity(clientMaxCapacity);
client.setMaxEncoderTableCapacity(clientMaxCapacity);
}
if (serverMaxCapacity >= 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public class HpackEncoder
private int _maxHeaderListSize;
private int _headerListSize;
private boolean _validateEncoding = true;
private boolean _maxDynamicTableSizeSent = false;

@Deprecated
public HpackEncoder(int localMaxDynamicTableSize)
Expand All @@ -128,7 +129,7 @@ public HpackEncoder(int localMaxDynamicTableSize, int remoteMaxDynamicTableSize,

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 @@ -235,8 +236,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