perf(h1): poll body less if is_end_stream

This commit is contained in:
Sean McArthur
2018-05-07 12:09:15 -07:00
parent 0d104deced
commit 8f0e01f853
4 changed files with 118 additions and 53 deletions

View File

@@ -514,13 +514,13 @@ fn set_length(headers: &mut HeaderMap, body: BodyLength, can_chunked: bool) -> E
let encoder = if headers.remove(TRANSFER_ENCODING).is_some() {
trace!("removing illegal transfer-encoding header");
should_remove_con_len = true;
Encoder::eof()
Encoder::close_delimited()
} else if let Some(len) = existing_con_len {
Encoder::length(len)
} else if let BodyLength::Known(len) = body {
set_content_length(headers, len)
} else {
Encoder::eof()
Encoder::close_delimited()
};
if should_remove_con_len && existing_con_len.is_some() {