Skip to content

Commit

Permalink
Made LoadFromWebAsync honor the TImeout property. Fixes zzzprojects#580
Browse files Browse the repository at this point in the history
  • Loading branch information
cant0r committed Feb 8, 2025
1 parent d24fa1c commit 0fb28d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/HtmlAgilityPack.Shared/HtmlWeb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2431,6 +2431,8 @@ public async Task<HtmlDocument> LoadFromWebAsync(Uri uri, Encoding encoding, Net
client = GetSharedHttpClient(this.UserAgent);
}

client.Timeout = TimeSpan.FromMilliseconds(Timeout);

var e = await client.GetAsync(uri, cancellationToken).ConfigureAwait(false);
_statusCode = e.StatusCode;

Expand All @@ -2442,7 +2444,7 @@ public async Task<HtmlDocument> LoadFromWebAsync(Uri uri, Encoding encoding, Net
}
else
{
#if !(NETSTANDARD1_3 || NETSTANDARD1_6 || WINDOWS_UWP)
#if !(NETSTANDARD1_3 || NETSTANDARD1_6 || WINDOWS_UWP)
_responseUri = new Uri(uri.GetLeftPart(UriPartial.Authority) + e.Headers.Location);
#endif
}
Expand Down

0 comments on commit 0fb28d6

Please sign in to comment.