From dea39030bcf882c879c724d6b4d803735424e1dd Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 8 Nov 2018 20:38:40 -0800 Subject: [PATCH] properly handle upgrade header if content-length header is set --- src/h1/decoder.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/h1/decoder.rs b/src/h1/decoder.rs index cfa0879d..472e2993 100644 --- a/src/h1/decoder.rs +++ b/src/h1/decoder.rs @@ -141,6 +141,13 @@ impl Decoder for RequestDecoder { } header::UPGRADE => { has_upgrade = true; + // check content-length, some clients (dart) + // sends "content-length: 0" with websocket upgrade + if let Ok(val) = value.to_str() { + if val == "websocket" { + content_length = None; + } + } } _ => (), }