You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#6842 describes the problems that occur when the optional gzip feature is enabled in reqwest. The fix in #6843 addressed this by calling the reqwest::ClientBuilder.no_gzip() method.
Reqwest offers other features that automatically enable compression on a supported server too: in addition to gzip, there's also deflate, brotli, and zstd. When any of these features are enabled, reqwest will include the Accept-Encoding header with supported compression formats, and supporting HTTP servers will reply with Content-Encoding indicating the accepted compression format (if any). When this happens, the Content-Length header will be set to the compressed length of the body. That is, if it's set at all-- many servers will end up omitting the header when compression is enabled.
thread 'tests::repro' panicked at src/lib.rs:32:14:
called `Result::unwrap()` on an `Err` value: Generic { store: "HTTP", source: Header { source: MissingContentLength } }
(Example repo based on the example from #6842, thanks @phillipleblanc for making an easy-to-use example for the previous bug!)
Expected behavior
The test should pass. It passes if the zstd feature is disabled in the reqwest crate.
Additional context
This example repo uses a local Axum server with gzip/deflate/brotli/zstd compression enabled, and with the zstd feature enabled on the reqwest crate. Therefore, the default reqwest client includes Accept-Encoding: zstd in the request, and the server responds with Content-Encoding: zstd. Because compression is enabled, reqwest does not (and cannot) return the decompressed content length of the response.
The text was updated successfully, but these errors were encountered:
Describe the bug
#6842 describes the problems that occur when the optional
gzip
feature is enabled in reqwest. The fix in #6843 addressed this by calling thereqwest::ClientBuilder.no_gzip()
method.Reqwest offers other features that automatically enable compression on a supported server too: in addition to
gzip
, there's alsodeflate
,brotli
, andzstd
. When any of these features are enabled, reqwest will include theAccept-Encoding
header with supported compression formats, and supporting HTTP servers will reply withContent-Encoding
indicating the accepted compression format (if any). When this happens, theContent-Length
header will be set to the compressed length of the body. That is, if it's set at all-- many servers will end up omitting the header when compression is enabled.To Reproduce
cargo test
within the repoThe test fails with the following error:
(Example repo based on the example from #6842, thanks @phillipleblanc for making an easy-to-use example for the previous bug!)
Expected behavior
The test should pass. It passes if the
zstd
feature is disabled in the reqwest crate.Additional context
This example repo uses a local Axum server with gzip/deflate/brotli/zstd compression enabled, and with the
zstd
feature enabled on the reqwest crate. Therefore, the default reqwest client includesAccept-Encoding: zstd
in the request, and the server responds withContent-Encoding: zstd
. Because compression is enabled, reqwest does not (and cannot) return the decompressed content length of the response.The text was updated successfully, but these errors were encountered: