Browse Source

feat(core): add option to use vendored openssl, closes #4470 (#4809)

Lucas Fernandes Nogueira 3 năm trước cách đây
mục cha
commit
331f346002

+ 5 - 0
.changes/vendored-openssl.md

@@ -0,0 +1,5 @@
+---
+"tauri": patch
+---
+
+Added `native-tls-vendored` and `reqwest-native-tls-vendored` Cargo features to compile and statically link to a vendored copy of OpenSSL on Linux.

+ 3 - 1
core/tauri/Cargo.toml

@@ -75,7 +75,7 @@ base64 = { version = "0.13", optional = true }
 clap = { version = "3", optional = true }
 reqwest = { version = "0.11", features = [ "json", "stream" ], optional = true }
 bytes = { version = "1", features = [ "serde" ], optional = true }
-attohttpc = { version = "0.19", features = [ "json", "form" ], optional = true }
+attohttpc = { version = "0.20", features = [ "compress", "json", "form" ], optional = true }
 open = { version = "3.0", optional = true }
 shared_child = { version = "1.0", optional = true }
 os_pipe = { version = "1.0", optional = true }
@@ -151,6 +151,8 @@ http-multipart = [ "attohttpc/multipart-form", "reqwest/multipart" ]
 shell-open-api = [ "open", "regex", "tauri-macros/shell-scope" ]
 fs-extract-api = [ "zip" ]
 reqwest-client = [ "reqwest", "bytes" ]
+reqwest-native-tls-vendored = [ "reqwest-client", "reqwest/native-tls-vendored" ]
+native-tls-vendored = [ "attohttpc/tls-vendored" ]
 process-command-api = [ "shared_child", "os_pipe" ]
 global-shortcut = [
   "tauri-runtime/global-shortcut",

+ 0 - 5
core/tauri/src/api/http.rs

@@ -155,11 +155,6 @@ impl Client {
 
     if let Some(timeout) = request.timeout {
       request_builder = request_builder.timeout(timeout);
-      #[cfg(windows)]
-      {
-        // on Windows the global timeout is not respected, see https://github.com/sbstp/attohttpc/issues/118
-        request_builder = request_builder.read_timeout(timeout);
-      }
     }
 
     let response = if let Some(body) = request.body {

+ 2 - 0
core/tauri/src/lib.rs

@@ -22,6 +22,8 @@
 //! - **http-api**: Enables the [`api::http`] module.
 //! - **http-multipart**: Adds support to `multipart/form-data` requests.
 //! - **reqwest-client**: Uses `reqwest` as HTTP client on the `http` APIs. Improves performance, but increases the bundle size.
+//! - **native-tls-vendored**: Compile and statically link to a vendored copy of OpenSSL (applies to the default HTTP client).
+//! - **reqwest-native-tls-vendored**: Compile and statically link to a vendored copy of OpenSSL (applies to the `reqwest` HTTP client).
 //! - **process-command-api**: Enables the [`api::process::Command`] APIs.
 //! - **global-shortcut**: Enables the global shortcut APIs.
 //! - **clipboard**: Enables the clipboard APIs.

+ 1 - 1
tooling/bundler/Cargo.toml

@@ -39,7 +39,7 @@ log = { version = "0.4.17", features = [ "kv_unstable" ] }
 dirs-next = "2.0"
 
 [target."cfg(target_os = \"windows\")".dependencies]
-attohttpc = "0.19"
+attohttpc = "0.20"
 uuid = { version = "1", features = [ "v4", "v5" ] }
 bitness = "0.4"
 winreg = "0.10"

+ 2 - 2
tooling/cli/Cargo.lock

@@ -72,9 +72,9 @@ checksum = "d67af77d68a931ecd5cbd8a3b5987d63a1d1d1278f7f6a60ae33db485cdebb69"
 
 [[package]]
 name = "attohttpc"
-version = "0.19.1"
+version = "0.20.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "262c3f7f5d61249d8c00e5546e2685cd15ebeeb1bc0f3cc5449350a1cb07319e"
+checksum = "6ca359af0239b00307656f0d6520fab5997a068cdfcfdb424e5466a3ea7958c5"
 dependencies = [
  "flate2",
  "http",