diff --git a/src/proto/h1/role.rs b/src/proto/h1/role.rs index 4f04acec96..fc90819c8d 100644 --- a/src/proto/h1/role.rs +++ b/src/proto/h1/role.rs @@ -702,12 +702,14 @@ impl Server { #[cfg(debug_assertions)] { if let Some(len) = headers::content_length_parse(&value) { - assert!( + if msg.req_method != &Some(Method::HEAD) || known_len != 0 { + assert!( len == known_len, "payload claims content-length of {}, custom content-length header claims {}", known_len, len, ); + } } }