-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server websocket implementation should allow, ignore other subprotocols #1112
Server websocket implementation should allow, ignore other subprotocols #1112
Conversation
Correctly reads all Sec-Websocket-Protocol headers and reads all values in those headers, and only succeeds if the expected subprotcol value of "grpc-websockets" is present. This implementation roughly mirrors what the nhooyr.io/websocket Accept() method does, with a few simplifications. Fixes improbable-eng#1111
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One very minor nit, this looks great.
Canonicalize the header key before read, normalizing the possible values. Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
The "test failure" looks like it might be a transient saucelabs tunnel issue?
Can someone re-run that? |
Thank you for your contribution! |
@johanbrandhorst would it be reasonable to request a release be cut, for this and a few other fixes made since the release last November? |
That sounds reasonable :). The release process isn't super automated, so I'm gonna have to ask @MarcusLongmuir for some help. |
Ping @MarcusLongmuir or @easyCZ, either of you have bandwidth for a new release? |
Correctly reads all Sec-Websocket-Protocol headers and reads all values
in those headers, and only succeeds if the expected subprotcol value of
"grpc-websockets" is present. This implementation roughly mirrors what
the nhooyr.io/websocket Accept() method does, with a few
simplifications.
Fixes #1111
Changes
Updated
IsGrpcWebSocketRequest()
to allow for multiple protocol headers and values, but still only succeeds if the expected valuegrpc-websockets
is present. Usesstrings.EqualFold
in place ofstrings.toLower
and a==
check, as this is a more flexible check, and reflects the underlying nhooyr.io/websockets implementation.Verification