We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
Since the last release of the crate, I'm beggining to have a strange panic after trying to do an async connect with the following code:
let header = Request::builder() .uri("ws://localhost:5683") .header(http::header::SEC_WEBSOCKET_PROTOCOL, "test") .body(()) .unwrap(); // Safe let (mut websocket_client, _) = tokio_tungstenite::connect_async(header).await.unwrap();
I got:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Protocol(InvalidHeader("sec-websocket-key"))'
The text was updated successfully, but these errors were encountered:
You need to provide the sec-websocket-key and other headers yourself now if you create the request yourself.
sec-websocket-key
Something like
let req = Request::builder() .method("GET") .header("Host", host) .header("Connection", "Upgrade") .header("Upgrade", "websocket") .header("Sec-WebSocket-Version", "13") .header("Sec-WebSocket-Key", tungstenite::generate_key()) .uri(self) .body(())?;
Or you go via your_uri.into_client_request() to get a default Request that you can then modify.
your_uri.into_client_request()
Request
Sorry, something went wrong.
Ok, the question seems to be answered :)
Note it's the same issue as described here.
As for the rationale, you can read the reasoning behind the change here:
HeaderName::from_static
Yep, thanks.
No branches or pull requests
Hi,
Since the last release of the crate, I'm beggining to have a strange panic after trying to do an async connect with the following code:
I got:
The text was updated successfully, but these errors were encountered: