mirror of
https://github.com/Jake-Shadle/xwin
synced 2026-06-08 11:22:36 +00:00
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
<!-- next-header -->
|
||||
## [Unreleased] - ReleaseDate
|
||||
### Fixed
|
||||
- [PR#142](https://github.com/Jake-Shadle/xwin/pull/142) is an attempt to resolve [#141](https://github.com/Jake-Shadle/xwin/issues/141) by switching from `ureq` to `reqwest`.
|
||||
|
||||
## [0.6.5] - 2024-08-21
|
||||
### Fixed
|
||||
- [PR#137](https://github.com/Jake-Shadle/xwin/pull/137) fixes the fix introduced in [PR#136](https://github.com/Jake-Shadle/xwin/pull/136).
|
||||
|
||||
Generated
+711
-202
File diff suppressed because it is too large
Load Diff
+8
-8
@@ -22,16 +22,16 @@ exclude = [
|
||||
[features]
|
||||
# By default we use rustls for TLS
|
||||
default = ["rustls-tls"]
|
||||
rustls-tls = ["ureq/tls"]
|
||||
rustls-tls = ["reqwest/rustls-tls"]
|
||||
# If this feature is enabled we instead use the native TLS implementation for the
|
||||
# target platform
|
||||
native-tls = ["ureq/native-tls", "native-tls-crate/vendored"]
|
||||
native-tls = ["reqwest/native-tls", "native-tls-crate/vendored"]
|
||||
|
||||
[dependencies]
|
||||
# Easy errors
|
||||
anyhow = "1.0"
|
||||
# Network/file buffers
|
||||
bytes = "1.0"
|
||||
bytes = "1.7"
|
||||
# CAB files are used in conjunction with MSI files for SDK packages
|
||||
cab = "0.6"
|
||||
# Nicer to use utf-8 paths
|
||||
@@ -47,9 +47,9 @@ parking_lot = "0.12"
|
||||
# brrr
|
||||
rayon = "1.5"
|
||||
# Include scanning
|
||||
regex = "1.0"
|
||||
regex = "1.11"
|
||||
# HTTP requests
|
||||
ureq = { version = "2.4", default-features = false, features = ["gzip"] }
|
||||
reqwest = { version = "0.12", default-features = false, features = ["gzip", "blocking"] }
|
||||
memchr = "2.6"
|
||||
native-tls-crate = { package = "native-tls", version = "0.2", optional = true }
|
||||
# SHA-256 verification
|
||||
@@ -59,9 +59,9 @@ serde = { version = "1.0", features = ["derive"] }
|
||||
# JSON deserialization
|
||||
serde_json = "1.0"
|
||||
# Argument parsing
|
||||
clap = { version = "4.0", features = ["derive", "env", "wrap_help"] }
|
||||
clap = { version = "4.5", features = ["derive", "env", "wrap_help"] }
|
||||
# Easy management of temp files
|
||||
tempfile = "3.1"
|
||||
tempfile = "3.13"
|
||||
# We need to pin it to not get duplicates due to zip -> num_enum -> proc-macro-crate -> (WHY!?!?) toml_edit
|
||||
toml = "0.8"
|
||||
# Tracing logs
|
||||
@@ -88,7 +88,7 @@ zip = { version = "2.1", default-features = false, features = ["deflate"] }
|
||||
mimalloc = { version = "0.1", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
insta = "1.12"
|
||||
insta = "1.40"
|
||||
|
||||
[profile.dev.package.insta]
|
||||
opt-level = 3
|
||||
|
||||
+7
-9
@@ -4,6 +4,7 @@ use crate::{
|
||||
Path, PathBuf, WorkItem,
|
||||
};
|
||||
use anyhow::{Context as _, Error};
|
||||
use reqwest::blocking::Client;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub enum Unpack {
|
||||
@@ -19,12 +20,12 @@ pub enum Unpack {
|
||||
pub struct Ctx {
|
||||
pub work_dir: PathBuf,
|
||||
pub tempdir: Option<tempfile::TempDir>,
|
||||
pub client: ureq::Agent,
|
||||
pub client: Client,
|
||||
pub draw_target: ProgressTarget,
|
||||
}
|
||||
|
||||
impl Ctx {
|
||||
pub fn with_temp(dt: ProgressTarget, client: ureq::Agent) -> Result<Self, Error> {
|
||||
pub fn with_temp(dt: ProgressTarget, client: Client) -> Result<Self, Error> {
|
||||
let td = tempfile::TempDir::new()?;
|
||||
|
||||
Ok(Self {
|
||||
@@ -40,7 +41,7 @@ impl Ctx {
|
||||
pub fn with_dir(
|
||||
mut work_dir: PathBuf,
|
||||
dt: ProgressTarget,
|
||||
client: ureq::Agent,
|
||||
client: Client,
|
||||
) -> Result<Self, Error> {
|
||||
work_dir.push("dl");
|
||||
std::fs::create_dir_all(&work_dir)?;
|
||||
@@ -107,12 +108,9 @@ impl Ctx {
|
||||
}
|
||||
}
|
||||
|
||||
let res = self.client.get(url.as_ref()).call()?;
|
||||
let mut res = self.client.get(url.as_ref()).send()?;
|
||||
|
||||
let content_length = res
|
||||
.header("content-length")
|
||||
.and_then(|header| header.parse().ok())
|
||||
.unwrap_or_default();
|
||||
let content_length = res.content_length().unwrap_or_default();
|
||||
progress.inc_length(content_length);
|
||||
|
||||
let body = bytes::BytesMut::with_capacity(content_length as usize);
|
||||
@@ -140,7 +138,7 @@ impl Ctx {
|
||||
inner: body.writer(),
|
||||
};
|
||||
|
||||
std::io::copy(&mut res.into_reader(), &mut pc)?;
|
||||
res.copy_to(&mut pc)?;
|
||||
|
||||
let body = pc.inner.into_inner().freeze();
|
||||
|
||||
|
||||
+2
-2
@@ -17,8 +17,8 @@ pub mod util;
|
||||
|
||||
pub use ctx::Ctx;
|
||||
pub use minimize::MinimizeConfig;
|
||||
pub use reqwest;
|
||||
pub use splat::SplatConfig;
|
||||
pub use ureq;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum Arch {
|
||||
@@ -37,7 +37,7 @@ impl std::str::FromStr for Arch {
|
||||
"x86_64" => Self::X86_64,
|
||||
"aarch" => Self::Aarch,
|
||||
"aarch64" => Self::Aarch64,
|
||||
o => anyhow::bail!("unknown architecture '{}'", o),
|
||||
o => anyhow::bail!("unknown architecture '{o}'"),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -275,14 +275,15 @@ fn main() -> Result<(), Error> {
|
||||
let draw_target = xwin::util::ProgressTarget::Stdout;
|
||||
|
||||
let client = {
|
||||
let mut builder = ureq::AgentBuilder::new().timeout_read(args.timeout);
|
||||
let mut builder = reqwest::blocking::Client::builder().timeout(args.timeout);
|
||||
|
||||
if let Some(proxy) = args.https_proxy {
|
||||
let proxy = ureq::Proxy::new(proxy).context("failed to parse https proxy address")?;
|
||||
let proxy =
|
||||
reqwest::Proxy::all(proxy).context("failed to parse https proxy address")?;
|
||||
builder = builder.proxy(proxy);
|
||||
}
|
||||
|
||||
builder.build()
|
||||
builder.build()?
|
||||
};
|
||||
|
||||
let ctx = if args.temp {
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ fn verify_compiles() {
|
||||
let ctx = xwin::Ctx::with_dir(
|
||||
xwin::PathBuf::from(".xwin-cache/compile-test"),
|
||||
xwin::util::ProgressTarget::Hidden,
|
||||
ureq::agent(),
|
||||
reqwest::blocking::Client::new(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -166,7 +166,7 @@ fn verify_compiles_minimized() {
|
||||
let ctx = xwin::Ctx::with_dir(
|
||||
xwin::PathBuf::from(".xwin-cache/compile-test-minimized"),
|
||||
xwin::util::ProgressTarget::Hidden,
|
||||
ureq::agent(),
|
||||
reqwest::blocking::Client::new(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ fn verify_deterministic() {
|
||||
let ctx = xwin::Ctx::with_dir(
|
||||
PathBuf::from(".xwin-cache/deterministic"),
|
||||
xwin::util::ProgressTarget::Hidden,
|
||||
ureq::agent(),
|
||||
reqwest::blocking::Client::new(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user