html-agility-pack icon indicating copy to clipboard operation
html-agility-pack copied to clipboard

Possibly allow LoadFromWebAsync to accept Cancellation Tokens

Open hvining opened this issue 8 years ago • 3 comments

Hi, What are you guys' thoughts on adding a cancellation token source to the LoadFromWebAsync method? I've ran across an issue where some urls take upwards to 90 secs to load in decent networking conditions and would like a way to cancel the task when that occurs. Thanks.

Here's an exampl url:

https://www.ticketmaster.com/member/order_history?v=txfm3sEQvwZh-8lyZHhAvoql_VMuiIgw1Cyd5NCj08c3FOvi9DAlASaHBwB3SkT0bBYrrrj5JtdQboum7IxjHFs4rmB2j3E8gvnO7JwqyUb0NfFbGO65a2DOoXk8QSKUlbVSNVAJgg&queue_token=pdf8721fb380190f20b705d7a4c4e7bcfff0c0af528

hvining avatar Jun 24 '17 19:06 hvining

Hello @hvining ,

Thank you for reporting. This issue will be fixed this week.

Best Regards,

Jonathan

JonathanMagnan avatar Jun 25 '17 12:06 JonathanMagnan

Thanks @JonathanMagnan.

After some digging, it seems the issue with the long load times were coming from the type of HttpClient that is being used. I'm building against UWP and the HttpClient being used is from the System.Net.Http namespace however when I use the Windows.Web.Http namespace (via an extension method of HtmlWeb) it works as expected. Hope that helps any.

hvining avatar Jun 27 '17 13:06 hvining

Hello @hvining ,

CancellationToken has been added to LoadFromWebAsync .

We will let this issue open to investigating more about System.Net.Http vs. Windows.Web.Http when time will permit.

Best Regards,

Jonathan

JonathanMagnan avatar Jul 10 '17 14:07 JonathanMagnan