Skip to content

Commit 1e12fd0

Browse files
JusterZhuclaude
andcommitted
fix: set HttpClient.Timeout to infinite to honor per-request cancellation
HttpClient.Timeout defaults to ~100s and would cap requests before a caller-configured DownloadTimeout takes effect. Setting it to infinite lets HttpDownloadExecutor and VersionService per-request CancellationTokenSource.CancelAfter control timeout precisely. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent eca4b06 commit 1e12fd0

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/c#/GeneralUpdate.Core/Network/HttpClientProvider.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ static HttpClientProvider()
3232
var handler = new HttpClientHandler();
3333
handler.ServerCertificateCustomValidationCallback = (req, cert, chain, errors) =>
3434
_sslPolicy.ValidateCertificate(cert, chain, errors);
35-
_shared = new HttpClient(handler, disposeHandler: false);
35+
_shared = new HttpClient(handler, disposeHandler: false)
36+
{
37+
// Let per-request CancellationTokenSource.CancelAfter (set by
38+
// HttpDownloadExecutor & VersionService) control timeout — the
39+
// global HttpClient.Timeout (default ~100s) would otherwise cap
40+
// requests before a caller-configured longer DownloadTimeout.
41+
Timeout = System.Threading.Timeout.InfiniteTimeSpan
42+
};
3643
}
3744

3845
/// <summary>

0 commit comments

Comments
 (0)