Repository navigation
Derive websocket scheme from request scheme - #6153
Merged
Merged
Conversation
encodeWebsocketURL always returned ws://, so a page served over https got an insecure push URL which the browser refuses to open. Restore the scheme replacement so that https gives wss and http gives ws. Regression from 90103af (#5256), present in all 4.1 releases. Closes #6150 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
ExternalContextImpl.encodeWebsocketURLalways returned aws://URL. A page served overhttps://therefore got an insecure push URL, which the browser refuses to open. TheExternalContext.encodeWebsocketURLjavadoc requires "the correct websocket scheme".This PR replaces only the scheme of the URL built from the request, so
httpsgiveswssandhttpgivesws. This is the same logic as on the 4.0 branch. The twoUrlBuilderconstants which are no longer used are removed.The new tests in
ExternalContextImplTestcover the following: https and http, with and without port, uppercase scheme, IPv6 host,httpelsewhere in the host or path, the configured websocket port, response encoding, malformed request URL and null URL.The regression comes from 90103af (#5256) and is present in all 4.1 releases. 5.0 has the same code and follows by upmerge.
Closes #6150
🤖 Generated with Claude Opus 5.5