Skip to content

Commit

Permalink
http3: send content-length if known
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Jun 11, 2024
1 parent 404df59 commit ce3b30e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/async_impl/h3_client/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,18 @@ impl PoolClient {
req: Request<Body>,
) -> Result<Response<ResponseBody>, BoxError> {
use http_body_util::{BodyExt, Full};
use hyper::body::Body as _;

let (head, req_body) = req.into_parts();
let req = Request::from_parts(head, ());
let mut req = Request::from_parts(head, ());

if let Some(n) = req_body.size_hint().exact() {
if n > 0 {
req.headers_mut()
.insert(http::header::CONTENT_LENGTH, n.into());
}
}

let mut stream = self.inner.send_request(req).await?;

match req_body.as_bytes() {
Expand Down

0 comments on commit ce3b30e

Please sign in to comment.