Skip to content

Commit

Permalink
Auto merge of #11292 - arlosi:compression, r=epage
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Oct 27, 2022
2 parents 1c1e9a6 + 7c89237 commit 1985caf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cargo/ops/registry.rs
Expand Up @@ -643,6 +643,9 @@ pub fn configure_http_handle(config: &Config, handle: &mut Easy) -> CargoResult<
handle.useragent(&format!("cargo {}", version()))?;
}

// Empty string accept encoding expands to the encodings supported by the current libcurl.
handle.accept_encoding("")?;

fn to_ssl_version(s: &str) -> CargoResult<SslVersion> {
let version = match s {
"default" => SslVersion::Default,
Expand Down

0 comments on commit 1985caf

Please sign in to comment.