From 14125085d6ad22f15c843d9577d77d86acd36787 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Tue, 9 Feb 2021 06:52:33 +0000 Subject: [PATCH] check encoder impl consistency --- actix-http/src/h1/encoder.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/actix-http/src/h1/encoder.rs b/actix-http/src/h1/encoder.rs index 6052bbacc..2932a7dce 100644 --- a/actix-http/src/h1/encoder.rs +++ b/actix-http/src/h1/encoder.rs @@ -148,6 +148,8 @@ pub(crate) trait MessageType: Sized { for val in value.iter() { let v = val.as_ref(); let v_len = v.len(); + + // key length + value length + colon + space + \r\n let len = k_len + v_len + 4; if len > remaining { @@ -156,6 +158,7 @@ pub(crate) trait MessageType: Sized { unsafe { dst.advance_mut(pos); } + pos = 0; dst.reserve(len * 2); remaining = dst.capacity() - dst.len(); @@ -169,6 +172,7 @@ pub(crate) trait MessageType: Sized { // the cursor matches the number of bytes written unsafe { if camel_case { + // use Camel-Case headers write_camel_case(k, from_raw_parts_mut(buf, k_len)); } else { write_data(k, buf, k_len);