fix(http2): don't add client content-length if method doesn't require it
This commit is contained in:
committed by
Sean McArthur
parent
35825c4614
commit
fb90d30c02
@@ -120,7 +120,9 @@ where
|
||||
let mut req = ::http::Request::from_parts(head, ());
|
||||
super::strip_connection_headers(req.headers_mut(), true);
|
||||
if let Some(len) = body.size_hint().exact() {
|
||||
headers::set_content_length_if_missing(req.headers_mut(), len);
|
||||
if len != 0 || headers::method_has_defined_payload_semantics(req.method()) {
|
||||
headers::set_content_length_if_missing(req.headers_mut(), len);
|
||||
}
|
||||
}
|
||||
let eos = body.is_end_stream();
|
||||
let (fut, body_tx) = match self.h2_tx.send_request(req, eos) {
|
||||
|
||||
Reference in New Issue
Block a user