Repository navigation
Allow WebSocket extension negotiation to be disabled per response (#17030) - #17036
Merged
Merged
Conversation
…7030) Motivation: Frameworks may install `WebSocketServerExtensionHandler` globally in the server pipeline, but still need to decline WebSocket extension negotiation for a specific accepted WebSocket response. One example is a framework-level WebSocket API where compression is enabled globally, but an individual WebSocket endpoint chooses to disable compression. The server should still accept the WebSocket upgrade and exchange plain WebSocket frames; it should only omit the negotiated extension response header and avoid installing extension encoder/decoder handlers for that response. Modification: Add a response marker that lets `WebSocketServerExtensionHandler` skip extension negotiation for that response. Add coverage verifying that the upgrade response is forwarded without negotiating extensions when the marker is present. Result: Applications and frameworks can decide per WebSocket response whether negotiated extensions should be accepted, without adding private headers or removing the extension handler from the pipeline. Co-authored-by: Norman Maurer <[email protected]>
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.
Motivation:
Frameworks may install
WebSocketServerExtensionHandlerglobally in theserver pipeline, but still need to decline WebSocket extension
negotiation for a specific accepted WebSocket response.
One example is a framework-level WebSocket API where compression is
enabled globally, but an individual WebSocket endpoint chooses to
disable compression. The server should still accept the WebSocket
upgrade and exchange plain WebSocket frames; it should only omit the
negotiated extension response header and avoid installing extension
encoder/decoder handlers for that response.
Modification:
Add a response marker that lets
WebSocketServerExtensionHandlerskipextension negotiation for that response.
Add coverage verifying that the upgrade response is forwarded without
negotiating extensions when the marker is present.
Result:
Applications and frameworks can decide per WebSocket response whether
negotiated extensions should be accepted, without adding private headers
or removing the extension handler from the pipeline.
Co-authored-by: Norman Maurer [email protected]