feat(http2): set Content-Length header on outgoing messages

Closes #1547
This commit is contained in:
Laurențiu Nicola
2018-06-11 00:22:30 +02:00
committed by Sean McArthur
parent f20afba57d
commit 386fc0d70b
5 changed files with 97 additions and 0 deletions

View File

@@ -78,6 +78,13 @@ pub fn content_length_value(len: u64) -> HeaderValue {
}
}
pub fn set_content_length_if_missing(headers: &mut HeaderMap, len: u64) {
headers
.entry(CONTENT_LENGTH)
.unwrap()
.or_insert(content_length_value(len));
}
pub fn transfer_encoding_is_chunked(headers: &HeaderMap) -> bool {
is_chunked(headers.get_all(TRANSFER_ENCODING).into_iter())
}