Skip to content

Commit 2fc5b9c

Browse files
committed
Don't remove the Sec-WebSocket-Key header in WebSocketUpgrade
Fixes #1971
1 parent c7d4af9 commit 2fc5b9c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

axum/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5252
use `axum::serve(listener, service)` or hyper/hyper-util for more configuration options ([#1868])
5353
- **breaking:** Only inherit fallbacks for routers nested with `Router::nest`.
5454
Routers nested with `Router::nest_service` will no longer inherit fallbacks ([#1956])
55+
- **fixed:** Don't remove the `Sec-WebSocket-Key` header in `WebSocketUpgrade`
5556

5657
[#1664]: https://github.com/tokio-rs/axum/pull/1664
5758
[#1751]: https://github.com/tokio-rs/axum/pull/1751

axum/src/extract/ws.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,9 @@ where
381381

382382
let sec_websocket_key = parts
383383
.headers
384-
.remove(header::SEC_WEBSOCKET_KEY)
385-
.ok_or(WebSocketKeyHeaderMissing)?;
384+
.get(header::SEC_WEBSOCKET_KEY)
385+
.ok_or(WebSocketKeyHeaderMissing)?
386+
.clone();
386387

387388
let on_upgrade = parts
388389
.extensions

0 commit comments

Comments
 (0)