Skip to content
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

Possibility to mirror Sec-WebSocket-Protocols #980

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

andrew-guz
Copy link
Contributor

Hello.

We are using Sec-WebSocket-Protocols to send important data, that is not constant. So we can't predict subprotocol on server side.
From the other hand, we have to send something back, otherwise Browsers will not work correctly.

So, we suggest the next solution: add a possibility to return exactly the same subprotocol that was received.

gittiver
gittiver previously approved these changes Jan 9, 2025
@gittiver
Copy link
Member

gittiver commented Jan 9, 2025

We are using Sec-WebSocket-Protocols to send important data, that is not constant. So we can't predict subprotocol on server side. From the other hand, we have to send something back, otherwise Browsers will not work correctly.

We can add this to Crow, but with this few informations it sounds like a strange design. You should think about if it maybe opens an attack vector or something like this.

tests/unittest.cpp Outdated Show resolved Hide resolved
@andrew-guz
Copy link
Contributor Author

andrew-guz commented Jan 9, 2025

We are using Sec-WebSocket-Protocols to send important data, that is not constant. So we can't predict subprotocol on server side. From the other hand, we have to send something back, otherwise Browsers will not work correctly.

We can add this to Crow, but with this few informations it sounds like a strange design. You should think about if it maybe opens an attack vector or something like this.

We are using Sec-WebSocket-Protocols to send some information about client. And this data will be different for different clients. We want to get this info during onAccept, and reject, depending on this information if needed.
Since we have to send something back (https://datatracker.ietf.org/doc/html/rfc6455#section-11.3.4) this was the easiest solution for us.

@andrew-guz andrew-guz requested a review from gittiver January 9, 2025 10:59
include/crow/routing.h Outdated Show resolved Hide resolved
tests/unittest.cpp Show resolved Hide resolved
@andrew-guz andrew-guz requested a review from gittiver January 10, 2025 09:12
@gittiver gittiver merged commit 08f2b36 into CrowCpp:master Jan 14, 2025
11 checks passed
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.

3 participants