Skip to content

Commit eaf2267

Browse files
authored
fix(http1): skip debug assertion of content length for HEAD responses (#3795)
Closes #3794
1 parent 7f4a682 commit eaf2267

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/proto/h1/role.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,12 +702,14 @@ impl Server {
702702
#[cfg(debug_assertions)]
703703
{
704704
if let Some(len) = headers::content_length_parse(&value) {
705-
assert!(
705+
if msg.req_method != &Some(Method::HEAD) || known_len != 0 {
706+
assert!(
706707
len == known_len,
707708
"payload claims content-length of {}, custom content-length header claims {}",
708709
known_len,
709710
len,
710711
);
712+
}
711713
}
712714
}
713715

0 commit comments

Comments
 (0)