swindon-rs / tk-http

Full featured HTTP and Websockets library for rust/tokio
Apache License 2.0
136 stars 10 forks source link

Encoder.done_headers should return false when content-length=0 #31

Open hh9527 opened 6 years ago

hh9527 commented 6 years ago
encoder.add_length(0).unwrap();
if encoder.done_headers().unwrap() {
  // this should be unreachable
}
tailhook commented 6 years ago

Well, I think an empty body is still a body. We return false when it's 304, or similar thing where body is omitted or prohibited. And I think it's still possible to do write_body(b""). The application knows that body is empty itself.

Do you have the case where this doesn't work?