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

@@ -5,6 +5,7 @@ use tokio_io::{AsyncRead, AsyncWrite};
use ::body::Payload;
use ::common::Exec;
use ::headers;
use ::service::Service;
use super::{PipeToSendStream, SendBuf};
@@ -171,6 +172,9 @@ where
let (head, body) = res.into_parts();
let mut res = ::http::Response::from_parts(head, ());
super::strip_connection_headers(res.headers_mut());
if let Some(len) = body.content_length() {
headers::set_content_length_if_missing(res.headers_mut(), len);
}
macro_rules! reply {
($eos:expr) => ({
match self.reply.send_response(res, $eos) {