From d9988f3ab68ad074b7367354419bb2ac582f20c0 Mon Sep 17 00:00:00 2001 From: kingoflolz Date: Wed, 11 Jul 2018 21:21:32 +1000 Subject: [PATCH] fix missing content length fix missing content length when no compression is used --- src/client/writer.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/writer.rs b/src/client/writer.rs index 173b47e1..b691407d 100644 --- a/src/client/writer.rs +++ b/src/client/writer.rs @@ -266,6 +266,10 @@ fn content_encoder(buf: BytesMut, req: &mut ClientRequest) -> Output { } #[cfg(not(any(feature = "flate2", feature = "brotli")))] { + let mut b = BytesMut::new(); + let _ = write!(b, "{}", bytes.len()); + req.headers_mut() + .insert(CONTENT_LENGTH, HeaderValue::try_from(b.freeze()).unwrap()); TransferEncoding::eof(buf) } }