Skip to content

net.websocket: fix incorrect formatting for custom headers during handshake#25397

Merged
spytheman merged 1 commit into
vlang:masterfrom
zUltimaPG3D:ws_custom_headers_fix
Sep 28, 2025
Merged

net.websocket: fix incorrect formatting for custom headers during handshake#25397
spytheman merged 1 commit into
vlang:masterfrom
zUltimaPG3D:ws_custom_headers_fix

Conversation

@zUltimaPG3D

Copy link
Copy Markdown
Contributor

fix that makes custom headers during ws client handshake actually valid

if for example a server requires the Origin header to be set, before this fix, said server would've denied the connection even if the value was correct and the header was there, just because the header isn't valid, but now since it's valid it no longer fails

i didn't make a specific test for this fix in particular because it just adds a space to a string and the only valid testing option i know of is a very specific domain (not local) and i wouldn't want to have an external connection in a test like that

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-26084

@spytheman

Copy link
Copy Markdown
Contributor

Afaik .github/workflows/websockets_ci.yml already does more extensive tests, by starting a docker container with an Autobahn server, and running our client against it.

Can the vlib/net/websocket/tests/autobahn/autobahn_client.v program be changed to add at least one custom header?

That will change the handshake request, and hopefully can serve as a regression test, without needing to add a separate test that does a websocket request to a separate external sertice.

@spytheman spytheman merged commit ba79e85 into vlang:master Sep 28, 2025
72 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.

2 participants