diff --git a/crates/uv-client/src/registry_client.rs b/crates/uv-client/src/registry_client.rs index cdb3cff04..d4c403c2c 100644 --- a/crates/uv-client/src/registry_client.rs +++ b/crates/uv-client/src/registry_client.rs @@ -549,6 +549,13 @@ impl RegistryClient { .client .uncached() .get(url.clone()) + .header( + // `reqwest` defaults to accepting compressed responses. + // Specify identity encoding to get consistent .whl downloading + // behavior from servers. ref: https://github.com/pypa/pip/pull/1688 + "accept-encoding", + reqwest::header::HeaderValue::from_static("identity"), + ) .build() .map_err(ErrorKind::from)?; diff --git a/crates/uv-distribution/src/distribution_database.rs b/crates/uv-distribution/src/distribution_database.rs index 5200fa337..6e2f2274d 100644 --- a/crates/uv-distribution/src/distribution_database.rs +++ b/crates/uv-distribution/src/distribution_database.rs @@ -259,6 +259,13 @@ impl<'a, Context: BuildContext + Send + Sync> DistributionDatabase<'a, Context> .cached_client() .uncached() .get(wheel.url.raw().clone()) + .header( + // `reqwest` defaults to accepting compressed responses. + // Specify identity encoding to get consistent .whl downloading + // behavior from servers. ref: https://github.com/pypa/pip/pull/1688 + "accept-encoding", + reqwest::header::HeaderValue::from_static("identity"), + ) .build()?; let cache_control = match self.client.connectivity() { Connectivity::Online => CacheControl::from( diff --git a/crates/uv-distribution/src/source/mod.rs b/crates/uv-distribution/src/source/mod.rs index 42f65ed3c..3ec954223 100644 --- a/crates/uv-distribution/src/source/mod.rs +++ b/crates/uv-distribution/src/source/mod.rs @@ -307,6 +307,13 @@ impl<'a, T: BuildContext> SourceDistCachedBuilder<'a, T> { .cached_client() .uncached() .get(url.clone()) + .header( + // `reqwest` defaults to accepting compressed responses. + // Specify identity encoding to get consistent .whl downloading + // behavior from servers. ref: https://github.com/pypa/pip/pull/1688 + "accept-encoding", + reqwest::header::HeaderValue::from_static("identity"), + ) .build()?; let manifest = self .client @@ -410,6 +417,13 @@ impl<'a, T: BuildContext> SourceDistCachedBuilder<'a, T> { .cached_client() .uncached() .get(url.clone()) + .header( + // `reqwest` defaults to accepting compressed responses. + // Specify identity encoding to get consistent .whl downloading + // behavior from servers. ref: https://github.com/pypa/pip/pull/1688 + "accept-encoding", + reqwest::header::HeaderValue::from_static("identity"), + ) .build()?; let manifest = self .client