You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Handshake with protocol fails for some WebSocket servers #61
I was attempting to switch from tokio_tungstenite to ratchet_rs primarily because this library supports per-message deflate. However, the library does not appear to work for some WebSocket servers as it fails on the handshake.
I am not entirely sure of the reason, but I can't reproduce the issue on any other library even across different programming languages, so something ratchet_rs is doing is unique.
@eqiy, the issue arises because Ratchet writes HTTP headers in lowercase, while the server you're trying to connect to doesn't handle lowercase headers properly; which is interesting as it returns lowercase headers. HTTP header names should be case insensitive when parsed. Although Ratchet isn't technically wrong for using lowercase, many servers enforce incorrect casing rules and to avoid issues, many WebSocket servers opt for using title case headers instead. I'll release an update soon that switches to a more expected title case convention for headers.
Activity
SirCipher commentedon Mar 3, 2025
@eqiy, the issue arises because Ratchet writes HTTP headers in lowercase, while the server you're trying to connect to doesn't handle lowercase headers properly; which is interesting as it returns lowercase headers. HTTP header names should be case insensitive when parsed. Although Ratchet isn't technically wrong for using lowercase, many servers enforce incorrect casing rules and to avoid issues, many WebSocket servers opt for using title case headers instead. I'll release an update soon that switches to a more expected title case convention for headers.