From d99c5d583bdb1429966283cc5cd4a977cf0770b2 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Sat, 21 May 2022 06:54:22 -0700 Subject: [PATCH] fix(core): HTTP timeout not working on Windows, closes #4050 (#4185) --- .changes/fix-windows-timeout-http.md | 5 +++++ core/tauri/src/api/http.rs | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changes/fix-windows-timeout-http.md diff --git a/.changes/fix-windows-timeout-http.md b/.changes/fix-windows-timeout-http.md new file mode 100644 index 000000000..a45cdd1fb --- /dev/null +++ b/.changes/fix-windows-timeout-http.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Fixes HTTP timeout not working on Windows when using the `attohttpc` client. diff --git a/core/tauri/src/api/http.rs b/core/tauri/src/api/http.rs index c62a6dfc2..7f34b5f9b 100644 --- a/core/tauri/src/api/http.rs +++ b/core/tauri/src/api/http.rs @@ -143,6 +143,11 @@ 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 {