WebServiceApi: using HttpClientNetworkHandler for retries and custom DNS resolution support.

This commit is contained in:
Shreyas Zare
2023-03-18 13:37:34 +05:30
parent 444baf1b03
commit 3f92cb8846

View File

@@ -31,6 +31,7 @@ using System.Threading.Tasks;
using TechnitiumLibrary;
using TechnitiumLibrary.Net.Dns;
using TechnitiumLibrary.Net.Dns.ResourceRecords;
using TechnitiumLibrary.Net.Http.Client;
using TechnitiumLibrary.Net.Proxy;
namespace DnsServerCore
@@ -69,7 +70,7 @@ namespace DnsServerCore
handler.UseProxy = _dnsWebService.DnsServer.Proxy is not null;
handler.AutomaticDecompression = DecompressionMethods.All;
using (HttpClient http = new HttpClient(handler))
using (HttpClient http = new HttpClient(new HttpClientNetworkHandler(handler, _dnsWebService.DnsServer.PreferIPv6 ? HttpClientNetworkType.PreferIPv6 : HttpClientNetworkType.Default, _dnsWebService.DnsServer)))
{
_checkForUpdateJsonData = await http.GetStringAsync(_updateCheckUri);
_checkForUpdateJsonDataUpdatedOn = DateTime.UtcNow;