Repository navigation
fix: use FRAME_SIZE_ERROR and FLOW_CONTROL_ERROR for malformed control frames - #992
Closed
jaeminbird wants to merge 1 commit into
Closed
jaeminbird wants to merge 1 commit into
jaeminbird wants to merge 1 commit into
Conversation
…l frames RFC 9113 requires FRAME_SIZE_ERROR when a SETTINGS, PING, WINDOW_UPDATE, RST_STREAM or GOAWAY frame has the wrong length (sections 4.2, 6.4, 6.5, 6.7, 6.9), and FLOW_CONTROL_ERROR when SETTINGS_INITIAL_WINDOW_SIZE is above 2^31-1 (section 6.5.2). These all went away with PROTOCOL_ERROR.
Member
|
Note that the spec explicitly allows returning PROTOCOL_ERROR for any of those error codes instead. We have chosen to do so. |
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.
On a malformed control frame the server always answered GOAWAY with
PROTOCOL_ERROR. RFC 9113 requiresFRAME_SIZE_ERRORfor wrong-length SETTINGS, PING, WINDOW_UPDATE, RST_STREAM and GOAWAY frames (§4.2, 6.4, 6.5, 6.7, 6.9), andFLOW_CONTROL_ERRORfor aSETTINGS_INITIAL_WINDOW_SIZEabove 2^31-1 (§6.5.2).decode_frame(src/codec/framed_read.rs) now maps each case through aload_error_reason()helper, with a new internalInvalidInitialWindowSizevariant (src/frame/mod.rs, raised insrc/frame/settings.rs);frame::Erroris public only under theunstablefeature, so stable users just see the GOAWAY code change. +24/-6 in src, plus 77 lines of tests.A raw-socket probe sending one bad frame per case (script below): h2 before the fix 0/6 correct, nginx 1.31.8 6/6, h2 after the fix 6/6. h2spec doesn't catch this — it accepts a plain connection close.
tests/h2-tests/tests/server.rsfail before and pass after.cargo test(446 + 40) andcargo test -p h2-testspass; fmt,check --features unstableandclippy --lib -D warningsclean.h2probe.py