Fix Rack websocket upgrades for 0.2.27#26
Merged
Conversation
Deploying itsi with
|
| Latest commit: |
8c7889d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d2ddd3ac.itsi.pages.dev |
| Branch Preview URL: | https://release-0-2-27-rc1.itsi.pages.dev |
Signed-off-by: Wouter Coppieters <wc@pico.net.nz>
4ba402b to
c9358c3
Compare
Signed-off-by: Wouter Coppieters <wc@pico.net.nz>
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.
What changed
Fix Rack websocket upgrade handling for callable streaming bodies that return
101 Switching Protocols, and add a regression test usingAsync::WebSocket::Adapters::RackunderRack::Lint.Why it changed
Issue #25 exposed that Itsi handled upgrade responses correctly for explicit
rack.hijackcallbacks, but not for Rack apps that expose the upgrade path via a callable response body. That caused websocket adapters to receive anItsi::HttpResponseinstead of a bidirectional IO stream and fail during frame reads.Impact
This makes websocket upgrade behavior conform better to modern Rack behavior and fixes the async websocket compatibility regression targeted for
0.2.27.Root cause
For generic streaming bodies,
rack_interface.rbalways yielded the HTTP response writer. For101upgrade responses it must instead yield the partial hijack stream so the Rack adapter gets real bidirectional IO.Validation
bundle exec ruby -Ilib:test test/rack/test_rack_server.rbingems/serverbundle exec rake testingems/serverbundle exec rake testNotes
This PR also suppresses expected bridge shutdown noise (
BrokenPipe, reset/EOF-style shutdown cases) so normal websocket close paths do not emit misleading errors.