Skip to content

Possibility to mirror Sec-WebSocket-Protocols - #980

Merged
gittiver merged 4 commits into
CrowCpp:masterfrom
softcom-su:mirror-Sec-WebSocket-Protocol
Jan 14, 2025
Merged

gittiver merged 4 commits into
CrowCpp:masterfrom
softcom-su:mirror-Sec-WebSocket-Protocol

Conversation

@andrew-guz

Copy link
Copy Markdown
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

gittiver commented Jan 9, 2025

Copy link
Copy Markdown
Member

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.

Comment thread tests/unittest.cpp Resolved
@andrew-guz

andrew-guz commented Jan 9, 2025 •

Copy link
Copy Markdown
Contributor Author

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
Comment thread include/crow/routing.h Resolved
Comment thread tests/unittest.cpp Resolved
@andrew-guz
andrew-guz requested a review from gittiver January 10, 2025 09:12
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