Repository navigation
fix: preserve generated WebSocket request singleton headers - #1606
Merged
Merged
Conversation
pjfanning
reviewed
Nov 26, 2026
pjfanning
left a comment
Member
There was a problem hiding this comment.
Fix looks correct. Nits:
- Caller
Sec-WebSocket-Key/Sec-WebSocket-Versionheaders are now dropped silently; consider a debug/warn log, and a line in the client-side WebSocket docs (only scaladoc was updated). - The import reorder in
WebSocketClientSpecis unrelated churn.
He-Pin
force-pushed
the
fix/ws-generated-request-singletons
branch
from
November 26, 2026 12:22
af7d127 to
d83a973
Compare
Motivation: The WebSocket client generates its own opening key and protocol version. Caller extras must not add duplicate singleton fields. Modification: Keep the generated key and version when building the request. Explain the boundary between application-provided headers and generated fields in the client guide and both request APIs. Keep the test's existing import order except for required additions. Result: Caller-provided key and version fields are not sent, while ordinary application headers and negotiated options are preserved. No public signatures or generic header handling changed. References: RFC 6455 sections 11.3.1 and 11.3.5; Netty 4.2's outbound handshake builder test informed the original coverage.
He-Pin
force-pushed
the
fix/ws-generated-request-singletons
branch
from
November 26, 2026 20:20
d83a973 to
a73156d
Compare
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
The client generates the opening handshake key and protocol version. Supplying either field through extra headers could send the field twice, even though RFC 6455 requires each to appear only once.
Modification
Ignore caller-supplied WebSocket key and version fields when constructing the opening request, preserving the generated fields and other extra headers. Document their ordinary public usage for Scala and Java callers. This revision clarifies the documentation and minimizes test imports; it does not change the prior revision’s production code or add logging.
Result
The request keeps the generated key used to validate the server's handshake and sends version 13 once. Other extra headers retain their order and values, including list-valued negotiation fields and Connection options. No generic HTTP header rendering changes.
Tests
The focused normal WebSocket client checks passed with the exact changed source on Scala 2.13.18 and 3.3.9. The targeted Paradox render passed. No full CI run.
References
RFC 6455 §11.3.1 and §11.3.5. Informed by Netty 4.2's outbound client handshake test; narrower by design to preserve valid Pekko HTTP request extras.