Skip to content

Commit ce3b30e

Browse files
committed
http3: send content-length if known
1 parent 404df59 commit ce3b30e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/async_impl/h3_client/pool.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,18 @@ impl PoolClient {
127127
req: Request<Body>,
128128
) -> Result<Response<ResponseBody>, BoxError> {
129129
use http_body_util::{BodyExt, Full};
130+
use hyper::body::Body as _;
130131

131132
let (head, req_body) = req.into_parts();
132-
let req = Request::from_parts(head, ());
133+
let mut req = Request::from_parts(head, ());
134+
135+
if let Some(n) = req_body.size_hint().exact() {
136+
if n > 0 {
137+
req.headers_mut()
138+
.insert(http::header::CONTENT_LENGTH, n.into());
139+
}
140+
}
141+
133142
let mut stream = self.inner.send_request(req).await?;
134143

135144
match req_body.as_bytes() {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy