Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Utilities/Download.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public static class Download
{
private static readonly Lazy<HttpClient> s_httpClient = new(CreateHttpClient);

/// <summary>
/// Gets or sets the HTTP client timeout in seconds. Default is 180 seconds.
/// Changes to this property only take effect before the first HTTP request is made.
/// </summary>
public static int TimeoutSeconds { get; set; } = 180;

/// <summary>
/// Gets content information (size and last modified time) from a URI.
/// </summary>
Expand Down Expand Up @@ -224,7 +230,7 @@ public static Uri CreateUri(string url, string? userName = null, string? passwor

private static HttpClient CreateHttpClient()
{
HttpClient client = new() { Timeout = TimeSpan.FromSeconds(180) };
HttpClient client = new() { Timeout = TimeSpan.FromSeconds(TimeoutSeconds) };

Assembly assembly = Assembly.GetExecutingAssembly();
string productName = assembly.GetName().Name ?? "InsaneGenius.Utilities";
Expand Down