housleyjk / ws-rs

Lightweight, event-driven WebSockets for Rust.
MIT License
1.47k stars 221 forks source link

Panic on internal error #239

Open mcseemk opened 5 years ago

mcseemk commented 5 years ago

Ws-rs 0.7.9 panics with 'Panicking on internal error -- Internal Application Error: Failed to parse response after handshake is complete.' when connecting to wss://push.bibox.com.

housleyjk commented 5 years ago

Panicking on internal errors is a setting, useful in development to find serious errors. https://ws-rs.org/api_docs/ws/struct.Settings.html#structfield.panic_on_internal. If it's not possible to fix the issue, you can set that to false in order to avoid the panic.

drbawb commented 5 years ago

I haven't fully debugged what's happening, but I'm getting the same error when connecting to wss://gateway.discord.gg which is definitely reachable & functional. I have traced up to the point the error occurs the request is set to the HTTP upgrade, but the response is empty.

In src/connection.rs around line 630 where it tries to parse the response, the res variable is an empty string instead of a valid HTTP response.