From 6c4fdf604b5a6aaebfcf0c90f8ea13657aa7b9f9 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 29 Nov 2017 19:40:27 -0800 Subject: [PATCH] do not set content encoding header for upgraded connection --- src/encoding.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/encoding.rs b/src/encoding.rs index 2fef7a49..c6fffa8b 100644 --- a/src/encoding.rs +++ b/src/encoding.rs @@ -459,7 +459,10 @@ impl PayloadEncoder { } else { resp.headers.insert(CONNECTION, HeaderValue::from_static("upgrade")); } - encoding = ContentEncoding::Identity; + if encoding != ContentEncoding::Identity { + encoding = ContentEncoding::Identity; + resp.headers.remove(CONTENT_ENCODING); + } TransferEncoding::eof() } };