Skip to content

Fix client side get_subprotocol() does not get populated #570 - #1196

Open
GreenLightning wants to merge 1 commit into
zaphoyd:developfrom
GreenLightning:fix/client-subprotocol
Open

Fix client side get_subprotocol() does not get populated #570#1196
GreenLightning wants to merge 1 commit into
zaphoyd:developfrom
GreenLightning:fix/client-subprotocol

Conversation

@GreenLightning

Copy link
Copy Markdown

This MR validates and stores the negotiated subprotocol on the client.

Corresponding tests have been added to test/roles/client.cpp.

Fixes #570

handle_read_http_response() validated the server handshake and
negotiated extensions but never read the Sec-WebSocket-Protocol
response header, so a client that offered subprotocols always saw
get_subprotocol() return an empty string even after the server selected
one.

Read the Sec-WebSocket-Protocol header from the response and validate it
against the requested subprotocols. Then store it on the client, so it
is available to end users (e.g. from the open handler) via
get_subprotocol(). Add corresponding client role tests.

Fixes zaphoyd#570
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant