summaryrefslogtreecommitdiff
path: root/ext/http/lib.rs
diff options
context:
space:
mode:
authorLeo K <crowlkats@toaxl.com>2021-08-13 20:52:13 +0200
committerGitHub <noreply@github.com>2021-08-13 20:52:13 +0200
commit0c9d6cbb2adc4a0903b18e3c290e9b2c8c8b4e91 (patch)
tree31eb4ad0475d600280518379cf8684c5dd44c4fd /ext/http/lib.rs
parentc6e3f93ebb716c2df310e4ca4fd1f4c8290feed1 (diff)
fix(http/ws): support multiple options in connection header (#11675)
Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'ext/http/lib.rs')
-rw-r--r--ext/http/lib.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/ext/http/lib.rs b/ext/http/lib.rs
index db55ca53d..38c14409c 100644
--- a/ext/http/lib.rs
+++ b/ext/http/lib.rs
@@ -268,18 +268,22 @@ async fn op_http_request_next(
let is_websocket_request = req
.headers()
- .get(hyper::header::CONNECTION)
- .and_then(|v| {
- v.to_str().ok().map(|s| "Upgrade".eq_ignore_ascii_case(s))
+ .get_all(hyper::header::CONNECTION)
+ .iter()
+ .any(|v| {
+ v.to_str()
+ .map(|s| s.to_lowercase().contains("upgrade"))
+ .unwrap_or(false)
})
- .unwrap_or(false)
&& req
.headers()
- .get(hyper::header::UPGRADE)
- .and_then(|v| {
- v.to_str().ok().map(|s| "websocket".eq_ignore_ascii_case(s))
- })
- .unwrap_or(false);
+ .get_all(hyper::header::UPGRADE)
+ .iter()
+ .any(|v| {
+ v.to_str()
+ .map(|s| s.to_lowercase().contains("websocket"))
+ .unwrap_or(false)
+ });
let has_body = if let Some(exact_size) = req.size_hint().exact() {
exact_size > 0