Skip to content

Commit

Permalink
fix: content length assertion for HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
23doors committed Nov 26, 2024
1 parent 7f4a682 commit f736d98
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/proto/h1/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,9 @@ impl Server {
// same to help developers find bugs.
#[cfg(debug_assertions)]
{
if let Some(len) = headers::content_length_parse(&value) {
if let Some(len) = headers::content_length_parse(&value)
&& (msg.req_method != &Some(Method::HEAD) || known_len != 0)
{
assert!(
len == known_len,
"payload claims content-length of {}, custom content-length header claims {}",
Expand Down

0 comments on commit f736d98

Please sign in to comment.