Skip to content

Commit fb3d428

Browse files
author
a.zavernyaev
committed
Remove aws-lc-rs
1 parent 6862583 commit fb3d428

7 files changed

Lines changed: 33 additions & 114 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 111 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ rolldown-notify-debouncer-full = "0.7.5"
144144
ropey = "1.6.1"
145145
rusqlite = { version = "0.37.0", features = ["bundled"] }
146146
rustc-hash = "2.1.1"
147+
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
147148
schemars = "1.0.0"
148149
self_cell = "1.2.0"
149150
node-semver = "2.2.0"

crates/vite_error/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ wax = { workspace = true }
2929
reqwest = { workspace = true, features = ["stream", "native-tls-vendored", "json"] }
3030

3131
[target.'cfg(not(target_os = "windows"))'.dependencies]
32-
reqwest = { workspace = true, features = ["stream", "rustls", "json"] }
32+
reqwest = { workspace = true, features = ["stream", "rustls-no-provider", "json"] }
3333

3434
[lib]
3535
test = false

crates/vite_install/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ vite_workspace = { workspace = true }
3737
reqwest = { workspace = true, features = ["stream", "native-tls-vendored", "json"] }
3838

3939
[target.'cfg(not(target_os = "windows"))'.dependencies]
40-
reqwest = { workspace = true, features = ["stream", "rustls", "json"] }
40+
reqwest = { workspace = true, features = ["stream", "rustls-no-provider", "json"] }
41+
rustls = { workspace = true }
4142

4243
[dev-dependencies]
4344
httpmock = { workspace = true }

crates/vite_install/src/request.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ use tar::Archive;
1111
use tokio::{fs, io::AsyncWriteExt};
1212
use vite_error::Error;
1313

14+
#[cfg(not(target_os = "windows"))]
15+
fn ensure_tls_provider() {
16+
static INIT: std::sync::OnceLock<()> = std::sync::OnceLock::new();
17+
INIT.get_or_init(|| {
18+
let _ = rustls::crypto::ring::default_provider().install_default();
19+
});
20+
}
21+
1422
/// HTTP client with built-in retry support
1523
#[derive(Clone)]
1624
pub struct HttpClient {
@@ -57,6 +65,8 @@ impl HttpClient {
5765
}
5866

5967
async fn get(&self, url: &str) -> Result<Response, Error> {
68+
ensure_tls_provider();
69+
6070
let response = (|| async { reqwest::get(url).await?.error_for_status() })
6171
.retry(
6272
ExponentialBuilder::default()

crates/vite_js_runtime/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ zip = { workspace = true }
3232
reqwest = { workspace = true, features = ["stream", "native-tls-vendored"] }
3333

3434
[target.'cfg(not(target_os = "windows"))'.dependencies]
35-
reqwest = { workspace = true, features = ["stream", "rustls"] }
35+
reqwest = { workspace = true, features = ["stream", "rustls-no-provider"] }
36+
rustls = { workspace = true }
3637

3738
[dev-dependencies]
3839
tempfile = { workspace = true }

crates/vite_js_runtime/src/download.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ use vite_str::Str;
1515

1616
use crate::{Error, provider::ArchiveFormat};
1717

18+
#[cfg(not(target_os = "windows"))]
19+
fn ensure_tls_provider() {
20+
static INIT: std::sync::OnceLock<()> = std::sync::OnceLock::new();
21+
INIT.get_or_init(|| {
22+
let _ = rustls::crypto::ring::default_provider().install_default();
23+
});
24+
}
25+
1826
/// Response from a cached fetch operation
1927
pub struct CachedFetchResponse {
2028
/// Response body (None if 304 Not Modified)
@@ -37,6 +45,8 @@ pub async fn download_file(
3745
target_path: &AbsolutePath,
3846
message: &str,
3947
) -> Result<(), Error> {
48+
ensure_tls_provider();
49+
4050
tracing::debug!("Downloading {url} to {target_path:?}");
4151

4252
let response = (|| async { reqwest::get(url).await?.error_for_status() })
@@ -114,6 +124,8 @@ pub async fn download_file(
114124
/// Download text content from a URL with retry logic
115125
#[expect(clippy::disallowed_types, reason = "HTTP response body is a String")]
116126
pub async fn download_text(url: &str) -> Result<String, Error> {
127+
ensure_tls_provider();
128+
117129
tracing::debug!("Downloading text from {url}");
118130

119131
let content = (|| async { reqwest::get(url).await?.text().await })
@@ -137,6 +149,8 @@ pub async fn fetch_with_cache_headers(
137149
url: &str,
138150
if_none_match: Option<&str>,
139151
) -> Result<CachedFetchResponse, Error> {
152+
ensure_tls_provider();
153+
140154
tracing::debug!("Fetching with cache headers from {url}");
141155

142156
let response = (|| async {

0 commit comments

Comments
 (0)