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: Allow stream cancellation even if the dynamic table was config… #267

Merged
merged 1 commit into from
Dec 1, 2023
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 @@ -163,7 +163,12 @@ void sectionAcknowledgment(long streamId) throws QpackException {
* @param streamId which is cancelled.
*/
void streamCancellation(long streamId) throws QpackException {
assert streamSectionTrackers != null;
// If a configureDynamicTable(...) was called with a maxTableCapacity of 0 we will have not instanced
// streamSectionTrackers. The remote peer might still send a stream cancellation for a stream, while it
// is optional. See https://www.rfc-editor.org/rfc/rfc9204.html#section-2.2.2.2
if (streamSectionTrackers == null) {
return;
}
final Queue<Indices> tracker = streamSectionTrackers.remove(streamId);
if (tracker != null) {
for (;;) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,18 @@ public void streamCancelUnknownStream() throws Exception {
finishStreams();
}

@Test
public void streamCancelDynamicTableWithMaxCapacity0() throws Exception {
setup(0);
encodeHeaders(headers -> headers.add(fooBar.name, fooBar.value));
verifyRequiredInsertCount(0);
verifyKnownReceivedCount(0);
// Send a stream cancellation for a dynamic table of capacity 0.
// See https://www.rfc-editor.org/rfc/rfc9204.html#section-2.2.2.2
sendStreamCancellation(decoderStream.streamId());
finishStreams(false);
}

@Test
public void invalidIncrement() throws Exception {
setup(128);
Expand Down Expand Up @@ -325,8 +337,12 @@ private void setup(long maxTableCapacity) throws Exception {
}

private void finishStreams() {
finishStreams(true);
}

private void finishStreams(boolean encoderPendingMessage) {
assertThat("Unexpected decoder stream message", decoderStream.finishAndReleaseAll(), is(false));
assertThat("Unexpected encoder stream message", encoderStream.finishAndReleaseAll(), is(true));
assertThat("Unexpected encoder stream message", encoderStream.finishAndReleaseAll(), is(encoderPendingMessage));
assertThat("Unexpected parent stream message", parent.finishAndReleaseAll(), is(false));
}

Expand Down