summaryrefslogtreecommitdiff
path: root/ext/http/lib.rs
diff options
context:
space:
mode:
authorLeo K <crowlkats@toaxl.com>2021-10-26 23:06:44 +0200
committerGitHub <noreply@github.com>2021-10-26 23:06:44 +0200
commit6268703487da02d66552d1e1a42858aa273def90 (patch)
tree04bb51cfb65d733132ceb6b435dbec77fd544a1d /ext/http/lib.rs
parent9161e74a7dc8e0ff2c49bb9ca53895a6d49b5838 (diff)
fix(ext/http): allow multiple values in upgrade header for websocket (#12551)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
Diffstat (limited to 'ext/http/lib.rs')
-rw-r--r--ext/http/lib.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/http/lib.rs b/ext/http/lib.rs
index ffca4fa2f..aae6415cb 100644
--- a/ext/http/lib.rs
+++ b/ext/http/lib.rs
@@ -332,7 +332,9 @@ fn is_websocket_request(req: &hyper::Request<hyper::Body>) -> bool {
&& req.method() == hyper::Method::GET
&& req.headers().contains_key(&SEC_WEBSOCKET_KEY)
&& header(req.headers(), &SEC_WEBSOCKET_VERSION) == b"13"
- && header(req.headers(), &UPGRADE).eq_ignore_ascii_case(b"websocket")
+ && header(req.headers(), &UPGRADE)
+ .split(|c| *c == b' ' || *c == b',')
+ .any(|token| token.eq_ignore_ascii_case(b"websocket"))
&& header(req.headers(), &CONNECTION)
.split(|c| *c == b' ' || *c == b',')
.any(|token| token.eq_ignore_ascii_case(b"upgrade"))