From fa1b11b228a2c432415eed57d5dd5708d81fa0e8 Mon Sep 17 00:00:00 2001 From: Aveline <352441+ym@users.noreply.github.com> Date: Tue, 8 Apr 2025 00:43:03 +0200 Subject: [PATCH] chore(ota): allow a longer timeout when downloading packages (#332) --- ota.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ota.go b/ota.go index f813c09..9c583b6 100644 --- a/ota.go +++ b/ota.go @@ -126,7 +126,15 @@ func downloadFile(ctx context.Context, path string, url string, downloadProgress return fmt.Errorf("error creating request: %w", err) } - resp, err := http.DefaultClient.Do(req) + client := http.Client{ + // allow a longer timeout for the download but keep the TLS handshake short + Timeout: 10 * time.Minute, + Transport: &http.Transport{ + TLSHandshakeTimeout: 1 * time.Minute, + }, + } + + resp, err := client.Do(req) if err != nil { return fmt.Errorf("error downloading file: %w", err) }