fix(http1): return error if user body ends prematurely

- update proto::h1::end_body to return Result<()>
- update Encoder::end to return Error(NotEof) only when there's Content-length left to be addressed

Closes #2263
This commit is contained in:
João Oliveira
2020-08-12 22:12:48 +01:00
committed by GitHub
parent 3de81c822e
commit 1ecbcbb119
3 changed files with 15 additions and 8 deletions

View File

@@ -338,7 +338,7 @@ where
*clear_body = true;
if chunk.remaining() == 0 {
trace!("discarding empty chunk");
self.conn.end_body();
self.conn.end_body()?;
} else {
self.conn.write_body_and_end(chunk);
}
@@ -351,7 +351,7 @@ where
}
} else {
*clear_body = true;
self.conn.end_body();
self.conn.end_body()?;
}
} else {
return Poll::Pending;