Skip to content
New issue

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

axum: fix panic caused by missing upgrade header; HTTP 400 on error #75

Merged
merged 1 commit into from
Mar 30, 2024

Conversation

nitn3lav
Copy link
Contributor

Previously, this would lead to a panic:

curl 'http://127.0.0.1:3000' -H 'Sec-WebSocket-Version: 13' -H 'Sec-WebSocket-Key: hi' -i
cargo run --example axum -F upgrade -F with_axum
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/examples/axum`
thread 'tokio-runtime-worker' panicked at /Users/valentin/Programmieren/fastwebsockets/src/upgrade.rs:98:8:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Additionally, the implementation of FromRequestParts for IncomingUpgrade now responds to errors with HTTP status 400 instead of 200.

@littledivy littledivy merged commit bd38ea5 into denoland:main Mar 30, 2024
3 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