Skip to content

Commit cfdee00

Browse files
authored
refactor(core): fix tls features, use rustls on mobile (#6591)
1 parent 76668b3 commit cfdee00

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"cli.js": patch
4+
---
5+
6+
Automatically enable the `rustls-tls` tauri feature on mobile and `native-tls` on desktop if `rustls-tls` is not enabled.

.changes/tls-features-refactor.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Renamed the `default-tls` feature to `native-tls` and added `rustls-tls` feature.

core/tauri/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,9 @@ http-api = [ ]
155155
http-multipart = [ "reqwest/multipart" ]
156156
shell-open-api = [ "open", "regex", "tauri-macros/shell-scope" ]
157157
fs-extract-api = [ "zip" ]
158-
default-tls = [ "reqwest/default-tls" ]
158+
native-tls = [ "reqwest/native-tls" ]
159159
native-tls-vendored = [ "reqwest/native-tls-vendored" ]
160+
rustls-tls = [ "reqwest/rustls-tls" ]
160161
process-command-api = [ "shared_child", "os_pipe" ]
161162
global-shortcut = [
162163
"tauri-runtime/global-shortcut",

core/tauri/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
//! - **shell-open-api**: Enables the [`api::shell`] module.
2323
//! - **http-api**: Enables the [`api::http`] module.
2424
//! - **http-multipart**: Adds support to `multipart/form-data` requests.
25-
//! - **default-tls**: Provides TLS support to connect over HTTPS.
25+
//! - **native-tls**: Provides TLS support to connect over HTTPS.
2626
//! - **native-tls-vendored**: Compile and statically link to a vendored copy of OpenSSL.
27+
//! - **rustls-tls**: Provides TLS support to connect over HTTPS using rustls.
2728
//! - **process-command-api**: Enables the [`api::process::Command`] APIs.
2829
//! - **global-shortcut**: Enables the global shortcut APIs.
2930
//! - **clipboard**: Enables the clipboard APIs.

tooling/cli/src/interface/rust.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,17 @@ fn shared_options(
350350
app_settings: &RustAppSettings,
351351
) {
352352
if mobile {
353+
features
354+
.get_or_insert(Vec::new())
355+
.push("tauri/rustls-tls".into());
356+
} else {
353357
let all_features = app_settings
354358
.manifest
355359
.all_enabled_features(if let Some(f) = features { f } else { &[] });
356-
if all_features.contains(&"tauri/default-tls".into()) {
360+
if !all_features.contains(&"tauri/rustls-tls".into()) {
357361
features
358362
.get_or_insert(Vec::new())
359-
.push("tauri/native-tls-vendored".into());
363+
.push("tauri/native-tls".into());
360364
}
361365
}
362366
}

0 commit comments

Comments
 (0)