Skip to content

Commit

Permalink
Don't remove the Sec-WebSocket-Key header in WebSocketUpgrade
Browse files Browse the repository at this point in the history
Fixes #1971
  • Loading branch information
davidpdrsn committed Apr 30, 2023
1 parent c7d4af9 commit 2fc5b9c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions axum/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
use `axum::serve(listener, service)` or hyper/hyper-util for more configuration options ([#1868])
- **breaking:** Only inherit fallbacks for routers nested with `Router::nest`.
Routers nested with `Router::nest_service` will no longer inherit fallbacks ([#1956])
- **fixed:** Don't remove the `Sec-WebSocket-Key` header in `WebSocketUpgrade`

[#1664]: https://github.com/tokio-rs/axum/pull/1664
[#1751]: https://github.com/tokio-rs/axum/pull/1751
Expand Down
5 changes: 3 additions & 2 deletions axum/src/extract/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,9 @@ where

let sec_websocket_key = parts
.headers
.remove(header::SEC_WEBSOCKET_KEY)
.ok_or(WebSocketKeyHeaderMissing)?;
.get(header::SEC_WEBSOCKET_KEY)
.ok_or(WebSocketKeyHeaderMissing)?
.clone();

let on_upgrade = parts
.extensions
Expand Down

0 comments on commit 2fc5b9c

Please sign in to comment.