Skip to content

Commit 1985caf

Browse files
committed
Auto merge of #11292 - arlosi:compression, r=epage
Add Accept-Encoding request header to enable compression ### What does this PR try to resolve? Cargo does not request compression from servers. Enabling compression can save bandwidth and improve performance. ### How should we test and review this PR? I validated locally that the header was being sent using a local proxy (Fiddler). It sent `Accept-Encoding: deflate, gzip` on Windows.
2 parents 1c1e9a6 + 7c89237 commit 1985caf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/cargo/ops/registry.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,9 @@ pub fn configure_http_handle(config: &Config, handle: &mut Easy) -> CargoResult<
643643
handle.useragent(&format!("cargo {}", version()))?;
644644
}
645645

646+
// Empty string accept encoding expands to the encodings supported by the current libcurl.
647+
handle.accept_encoding("")?;
648+
646649
fn to_ssl_version(s: &str) -> CargoResult<SslVersion> {
647650
let version = match s {
648651
"default" => SslVersion::Default,

0 commit comments

Comments
 (0)