From f27beab016de18577de0818a5802829b31da96b1 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 2 May 2019 09:30:00 -0700 Subject: [PATCH] fix case for transfer-encoding header name --- actix-http/src/h1/encoder.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/actix-http/src/h1/encoder.rs b/actix-http/src/h1/encoder.rs index 60bf2262b..61ca48b1d 100644 --- a/actix-http/src/h1/encoder.rs +++ b/actix-http/src/h1/encoder.rs @@ -82,7 +82,7 @@ pub(crate) trait MessageType: Sized { if camel_case { dst.put_slice(b"\r\nTransfer-Encoding: chunked\r\n") } else { - dst.put_slice(b"\r\nTransfer-Encoding: chunked\r\n") + dst.put_slice(b"\r\ntransfer-encoding: chunked\r\n") } } else { skip_len = false; @@ -564,5 +564,18 @@ mod tests { bytes.take().freeze(), Bytes::from_static(b"\r\nTransfer-Encoding: chunked\r\nDate: date\r\nContent-Type: xml\r\nContent-Type: plain/text\r\n\r\n") ); + + head.set_camel_case_headers(false); + let _ = head.encode_headers( + &mut bytes, + Version::HTTP_11, + BodySize::Stream, + ConnectionType::KeepAlive, + &ServiceConfig::default(), + ); + assert_eq!( + bytes.take().freeze(), + Bytes::from_static(b"\r\ntransfer-encoding: chunked\r\ndate: date\r\ncontent-type: xml\r\ncontent-type: plain/text\r\n\r\n") + ); } }