From 781f1a3fef466a820bdcf4f841616f0a8c9fa55f Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 18 Feb 2019 22:20:00 -0800 Subject: [PATCH] do not skip content length is no chunking is selected --- src/h1/encoder.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/h1/encoder.rs b/src/h1/encoder.rs index 7627f697..d4f54d24 100644 --- a/src/h1/encoder.rs +++ b/src/h1/encoder.rs @@ -57,6 +57,7 @@ pub(crate) trait MessageType: Sized { ctype: ConnectionType, config: &ServiceConfig, ) -> io::Result<()> { + let chunked = self.chunked(); let mut skip_len = length != BodyLength::Stream; // Content length @@ -74,8 +75,10 @@ pub(crate) trait MessageType: Sized { } match length { BodyLength::Stream => { - if self.chunked() { + if chunked { dst.extend_from_slice(b"\r\ntransfer-encoding: chunked\r\n") + } else { + skip_len = false; } } BodyLength::Empty => {