Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
H2Connection.send_headers(..., priority_weight=16)with a header block larger than the peer's max frame size raises a bareAssertionError(and underpython -Owould emit an oversized HEADERS frame).Root cause
_build_headers_frames()slices the encoded header block using the full max frame size, but a priority block adds 5 bytes (4-byte depends_on/exclusive + 1-byte weight) to the first HEADERS payload. PR #1338 documented the same issue for PUSH_PROMISE.Fix
Added an optional
reserved_bytesparameter toH2Stream.send_headers()/_build_headers_frames(); the first fragment is reduced by that amount.H2Connection.send_headers()passes 5 when priority is present. The generic parameter composes with #1338's PUSH_PROMISE reservation and preserves default behaviour.Verification
MAX_FRAME_SIZE=16384with a ~50 KB incompressible value. Base-red:AssertionErrorat_prepare_for_sending(1 failed / 1 passed).ruff check src/clean;mypy --strictand--strict-bytesclean.No h2spec/interop run;
python -Onot re-run after the fix.