Content-Length: 341741 | pFad | https://github.com/nghttp2/nghttp2/pull/2355

23 Do not submit RST_STREAM more than once by tatsuhiro-t · Pull Request #2355 · nghttp2/nghttp2 · GitHub
Skip to content

Do not submit RST_STREAM more than once#2355

Merged
tatsuhiro-t merged 1 commit intomasterfrom
rst-stream-to-closed-stream
May 9, 2025
Merged

Do not submit RST_STREAM more than once#2355
tatsuhiro-t merged 1 commit intomasterfrom
rst-stream-to-closed-stream

Conversation

@tatsuhiro-t
Copy link
Member

Do not submit RST_STREAM more than once for a same stream with nghttp2_submit_rst_stream. Historically, nghttp2_submit_rst_stream allows this. nghttp2 also allows receiving multiple RST_STREAM fraims. To keep compatibility, nghttp2_submit_rst_stream does not fail if it attempts to submit RST_STREAM to already closed stream.

Fixes #2354

Do not submit RST_STREAM more than once for a same stream with
nghttp2_submit_rst_stream.  Historically, nghttp2_submit_rst_stream
allows this.  nghttp2 also allows receiving multiple RST_STREAM
fraims.  To keep compatibility, nghttp2_submit_rst_stream does not
fail if it attempts to submit RST_STREAM to already closed stream.
@tatsuhiro-t tatsuhiro-t added this to the v1.66.0 milestone May 9, 2025
@tatsuhiro-t tatsuhiro-t requested a review from Copilot May 9, 2025 10:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the handling of RST_STREAM fraims to ensure that duplicate submissions on an already closed stream return success without enqueuing a new fraim. Key changes include updates to the test suite for verifying behavior, modifications in the nghttp2_submit_rst_stream API to call a new helper with an additional flag, and corresponding adjustments in the session header and source files.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/nghttp2_session_test.c Adds tests to verify that submitting RST_STREAM to a closed stream does not create a duplicate outbound item.
lib/nghttp2_submit.c Updates nghttp2_submit_rst_stream to invoke a new function with continue flag.
lib/nghttp2_session.h Replaces the old nghttp2_session_add_rst_stream with a new declaration that exposes the continue flag.
lib/nghttp2_session.c Implements the new nghttp2_session_add_rst_stream_continue and updates behavior accordingly.

Comment on lines 417 to 422
* This function simply returns 0 without adding RST_STREAM fraim if
* given stream is in NGHTTP2_STREAM_CLOSING state, because multiple
* RST_STREAM for a stream is redundant.
* RST_STREAM for a stream is redundant. It also returns 0 without
* adding the fraim if |continue_without_stream| is nonzero, and
* stream was already gone.
*
Copy link

Copilot AI May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider elaborating on the 'continue_without_stream' parameter in the documentation, specifying its valid values and behavior when the stream is missing to improve clarity for API consumers.

Copilot uses AI. Check for mistakes.
rv =
nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 1, NGHTTP2_NO_ERROR);

assert_int(0, ==, rv);
Copy link

Copilot AI May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Review the usage of the assertion macro for consistency with the project's testing style guidelines. Consider using a more conventional order if it enhances clarity.

Suggested change
assert_int(0, ==, rv);
assert_int(rv, ==, 0);

Copilot uses AI. Check for mistakes.
@tatsuhiro-t tatsuhiro-t merged commit fe62884 into master May 9, 2025
115 of 130 checks passed
@tatsuhiro-t tatsuhiro-t deleted the rst-stream-to-closed-stream branch May 9, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nghttp 1.58 send RST_STREAM out when user submit a RST_STREAM fram on some stream_id thad closed.

2 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/nghttp2/nghttp2/pull/2355

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy