Skip to content

Commit

Permalink
fix(server): do not automatically set ContentLength for 204 and 304 R…
Browse files Browse the repository at this point in the history
…esponses
  • Loading branch information
seanmonstar committed Jul 4, 2017
1 parent 81c0d18 commit c4c89a2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/http/h1/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,16 @@ impl Http1Transaction for ServerTransaction {
body
}

fn should_set_length(_head: &MessageHead<Self::Outgoing>) -> bool {
fn should_set_length(head: &MessageHead<Self::Outgoing>) -> bool {
//TODO: pass method, check if method == HEAD
true

match head.subject {
// TODO: support for 1xx codes needs improvement everywhere
// would be 100...199 => false
StatusCode::NoContent |
StatusCode::NotModified => false,
_ => true,
}
}
}

Expand Down

0 comments on commit c4c89a2

Please sign in to comment.