diff --git a/crates/uv-distribution/src/distribution_database.rs b/crates/uv-distribution/src/distribution_database.rs index e6fd95907..5200fa337 100644 --- a/crates/uv-distribution/src/distribution_database.rs +++ b/crates/uv-distribution/src/distribution_database.rs @@ -180,7 +180,19 @@ impl<'a, Context: BuildContext + Send + Sync> DistributionDatabase<'a, Context> .instrument(info_span!("download", wheel = %wheel)) }; - let req = self.client.cached_client().uncached().get(url).build()?; + let req = self + .client + .cached_client() + .uncached() + .get(url) + .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( self.cache diff --git a/crates/uv-extract/src/stream.rs b/crates/uv-extract/src/stream.rs index 8d8dfb11a..3754064a7 100644 --- a/crates/uv-extract/src/stream.rs +++ b/crates/uv-extract/src/stream.rs @@ -18,7 +18,7 @@ pub async fn unzip( target: impl AsRef, ) -> Result<(), Error> { let target = target.as_ref(); - let mut reader = reader.compat(); + let mut reader = futures::io::BufReader::with_capacity(128 * 1024, reader.compat()); let mut zip = async_zip::base::read::stream::ZipFileReader::new(&mut reader); let mut directories = FxHashSet::default();