From adede8fa61a6018b06752d442c305535156a9d3c Mon Sep 17 00:00:00 2001 From: Bryan Wong Date: Wed, 24 Jun 2026 12:14:06 -0700 Subject: [PATCH] Fix download timeout: use 10min HttpClient and ResponseHeadersRead --- Program.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Program.cs b/Program.cs index 463696d..65ae5f2 100644 --- a/Program.cs +++ b/Program.cs @@ -981,11 +981,15 @@ static async Task DownloadAndInstallPackage(string displayName, string url, stri Logger.WriteSubProgress("Downloading from", url); DialogManager.Instance.NotifyDownloadStarted(displayName); - using var httpClient = new HttpClient(); + // Use a 10-minute timeout so large MSIs (e.g. CimianTools ARM64) don't hit + // the 100-second HttpClient default on slow links. ResponseHeadersRead lets + // GetAsync return as soon as headers arrive; the body streams via CopyToAsync + // which is not subject to HttpClient.Timeout. + using var httpClient = new HttpClient { Timeout = TimeSpan.FromMinutes(10) }; var authHeader = ConfigManager.Instance.Config.AuthorizationHeader; if (!string.IsNullOrEmpty(authHeader)) httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", authHeader); - using var response = await httpClient.GetAsync(url); + using var response = await httpClient.GetAsync(url, HttpCompletionOption.ResponseHeadersRead); if (!response.IsSuccessStatusCode) { throw new Exception($"Download failed: {response.StatusCode}");