-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
HTTP2 outgoing messages should set content-length if payload knows it #1547
Copy link
Copy link
Closed
Labels
A-http2Area: HTTP/2 specific.Area: HTTP/2 specific.C-featureCategory: feature. This is adding a new feature.Category: feature. This is adding a new feature.E-easyEffort: easy. A task that would be a great starting point for a new contributor.Effort: easy. A task that would be a great starting point for a new contributor.
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-http2Area: HTTP/2 specific.Area: HTTP/2 specific.C-featureCategory: feature. This is adding a new feature.Category: feature. This is adding a new feature.E-easyEffort: easy. A task that would be a great starting point for a new contributor.Effort: easy. A task that would be a great starting point for a new contributor.