actix-web icon indicating copy to clipboard operation
actix-web copied to clipboard

[awc] HTTP client ignores Content-Length if Body is stream.

Open ArtBlnd opened this issue 4 years ago • 1 comments

Expected Behavior

HTTP client should respect Content-Length even body of request is stream.

Current Behavior

Content-Length header is removed by client itself.

Possible Solution

respect Content-Length header if present. also an enhancement, if first item of body stream is known as None it is better set Content-Length to zero. not inserting chunked encoding header.

Steps to Reproduce (for bugs)

Send request with empty stream.

Context

Cloudfront will reject you.

Your Environment

  • Rust Version (I.e, output of rustc -V): rustc 1.53.0 (53cb7b09b 2021-06-17)
  • Actix Web Version: awc 3.0.0-beta.7

ArtBlnd avatar Jul 08 '21 06:07 ArtBlnd

Yes, I have the same problem, currently I have to read the whole stream to prevent it. Or there is a SizedStream

henry42 avatar Sep 21 '22 11:09 henry42