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

QPack encoder must not send any encoder instructions when SETTINGS_QPACK_MAX_TABLE_CAPACITY is 0 #12341

Closed
AlekseiEfimov opened this issue Oct 2, 2024 · 2 comments · Fixed by #12343
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@AlekseiEfimov
Copy link

Jetty version(s)
Jetty-12

Jetty Environment
core

Java version/vendor
N/A since the report is based on source code and RFC 9204

OS type/version
N/A since the report is based on source code and RFC 9204

Description
According to RFC 9204, the QPack encoder should not send instructions on the encoder stream when the maximum dynamic table capacity value is 0. This value is determined by the SETTINGS_QPACK_MAX_TABLE_CAPACITY sent by the peer's decoder.

Here is the RFC 9204 section 3.2.3 quote:

When the maximum table capacity is zero, the encoder
 MUST NOT insert entries into the dynamic table
 and MUST NOT send any encoder instructions on the encoder stream.

The encoder is issuing the "Set Dynamic Table Capacity" with capacity set to the minimum of the received and configured max capacity values:

encoder.setTableCapacity(Math.min(maxTableCapacity, configuration.getMaxEncoderTableCapacity()));

If the resulting value is 0 - the encoder instruction will be issued unconditionally to the max capacity value. It is correct for positive values, but for 0, it is not - the instruction must not be sent according to the RFC statement above.

How to reproduce?
Use any HTTP/3 client to connect to Jetty server. Client-side steps: a) send a settings frame with SETTINGS_QPACK_MAX_TABLE_CAPACITY set to 0 (which is the default value). b) verify that no encoder instructions (including set dynamic table capacity) are received on the client's encoder stream after that.

@AlekseiEfimov AlekseiEfimov added the Bug For general bugs on Jetty side label Oct 2, 2024
@lachlan-roberts lachlan-roberts self-assigned this Oct 3, 2024
@lachlan-roberts
Copy link
Contributor

I think that line in the RFC is a bit vague. But if you take it literally, then since the table capacity starts at zero, you can never change it to a non-zero value because you cannot send the instruction to do so.

So I don't agree that sending this instruction violates the RFC, I think this should be interpreted as "you cannot use any instruction to alter to contents of the dynamic table if the capacity is zero".

@lachlan-roberts
Copy link
Contributor

But since this instruction is redundant we can skip it anyway.

I will open a PR to only send the instruction if it actually changed the table capacity.
And this should fix your concern with it.

lachlan-roberts added a commit that referenced this issue Oct 3, 2024
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
lachlan-roberts added a commit that referenced this issue Oct 4, 2024
…apacity

Issue #12341 - only send QpackEncoder instructions if change in capacity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
No open projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants