Repository navigation
fix(realtime): stop passing the library's 1002 upstream as the client's close code - #1340
Merged
Merged
Conversation
…'s close code axum's tungstenite replaces a client Close whose code may not be sent (1004, 1016-2999, ...) with its own (1002, "Protocol violation"), and the relay forwarded that to the upstream as if the client had sent 1002. Apply the rule #1339 introduced for the other direction: that exact frame reaches the upstream as 1011; any other legal client code is still forwarded as received.
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 9 minutes for your next included review. View limit details
Comment |
…e close-reply comment
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.
Follow-up to #1339, same bug class in the other direction. When a client closes
/v1/realtimewith a code that may not be sent (1004, 2999, ...), axum's tungstenite replaces the frame with its own(1002, "Protocol violation")and drops the original code, and the relay forwarded that to the upstream as if the client had sent 1002.That exact frame now reaches the upstream as 1011 with an empty reason, matching what #1339 does for upstream closes. Any other legal client code, 1002 with a different reason included, is still forwarded as received. Nothing changes for the client or the access log.
Test:
realtime-close-e2egets a case where the client writes a masked Close(1004) by hand (wsrefuses to send it) and the mock upstream must observe 1011. It sees 1002 on main.🤖 Generated with Claude Code