Closed
Description
For instance, a server replying with Response::new(Body::from("Hello, World!"))
over HTTP2 should set the content-length: 13
header.
Steps to fix
- In
proto::h2::server
, before callingSendResponse::send_response
, checkbody.content_length()
. If it returnsSome(len)
, check if the headers containCONTENT_LENGTH
, and if not, add the header with the serialized length. - Do the same in
proto::h2::client
, before callingSendRequest::send_request
. - Serializing into a header value can make use of
hyper::headers::content_length_value
. - A new function,
set_content_length_if_not_present
, could probably be added tohyper::headers
, making use ofHeaderMap::entry
.