Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use proxy if configured in HttpClient settings ✨ #8945

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/AnthropicTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;
using Nikse.SubtitleEdit.Core.Settings;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
Expand Down Expand Up @@ -38,7 +39,7 @@ public class AnthropicTranslate : IAutoTranslator
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("anthropic-version", "2023-06-01");
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/ChatGptTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
{
Expand Down Expand Up @@ -49,7 +50,7 @@ public static string RemovePreamble(string original, string translation)
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.BaseAddress = new Uri(Configuration.Settings.Tools.ChatGptUrl.TrimEnd('/'));
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/DeepLTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Common;
using Nikse.SubtitleEdit.Core.Http;
using Nikse.SubtitleEdit.Core.Translate;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
Expand Down Expand Up @@ -37,7 +38,7 @@ public void Initialize()
return;
}

_client = new HttpClient();
_client = HttpClientFactory.CreateProxiedHttpClient();
_client.BaseAddress = new Uri(_apiUrl.Trim().TrimEnd('/'));
_client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "DeepL-Auth-Key " + _apiKey.Trim());
_formality = string.IsNullOrWhiteSpace(_formality) ? "default" : _formality.Trim();
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/DeepLXTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Common;
using Nikse.SubtitleEdit.Core.Http;
using Nikse.SubtitleEdit.Core.Translate;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
Expand Down Expand Up @@ -32,7 +33,7 @@ public void Initialize()
}
_apiUrl = Configuration.Settings.Tools.AutoTranslateDeepLXUrl;

_client = new HttpClient();
_client = HttpClientFactory.CreateProxiedHttpClient();
_client.BaseAddress = new Uri(_apiUrl.Trim().TrimEnd('/'));
}

Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/GeminiTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
{
Expand All @@ -25,7 +26,7 @@ public class GeminiTranslate : IAutoTranslator
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.BaseAddress = new Uri("https://generativelanguage.googleapis.com/v1/models/gemini-pro:generateContent");
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/GoogleTranslateV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
{
Expand All @@ -29,7 +30,7 @@ public class GoogleTranslateV1 : IAutoTranslator
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient(); //DownloaderFactory.MakeHttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient(); //HttpClientFactory.CreateHttpClientDownloader();
_httpClient.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=UTF-8");
_httpClient.BaseAddress = new Uri("https://translate.googleapis.com/");
Expand Down
2 changes: 1 addition & 1 deletion src/libse/AutoTranslate/GoogleTranslateV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class GoogleTranslateV2 : IAutoTranslator, IDisposable
public void Initialize()
{
_apiKey = Configuration.Settings.Tools.GoogleApiV2Key;
_httpClient = DownloaderFactory.MakeHttpClient();
_httpClient = HttpClientFactory.CreateHttpClientDownloader();
_httpClient.BaseAddress = new Uri("https://translation.googleapis.com/language/translate/v2/");
_httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/GroqTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;
using Nikse.SubtitleEdit.Core.Settings;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
Expand Down Expand Up @@ -38,7 +39,7 @@ public class GroqTranslate : IAutoTranslator
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.BaseAddress = new Uri(Configuration.Settings.Tools.GroqUrl.TrimEnd('/'));
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/LibreTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
{
Expand All @@ -26,7 +27,7 @@ public class LibreTranslate : IAutoTranslator
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.BaseAddress = new Uri(Configuration.Settings.Tools.AutoTranslateLibreUrl);
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/LmStudioTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;
using Nikse.SubtitleEdit.Core.Settings;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
Expand All @@ -26,7 +27,7 @@ public class LmStudioTranslate : IAutoTranslator
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.BaseAddress = new Uri(Configuration.Settings.Tools.LmStudioApiUrl.TrimEnd('/'));
Expand Down
6 changes: 3 additions & 3 deletions src/libse/AutoTranslate/MicrosoftTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private IDownloader GetTranslateClient()
{
if (_httpClient == null)
{
_httpClient = DownloaderFactory.MakeHttpClient();
_httpClient = HttpClientFactory.CreateHttpClientDownloader();
_httpClient.BaseAddress = new Uri("https://api.cognitive.microsofttranslator.com/");
_httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _accessToken);
Expand All @@ -129,7 +129,7 @@ private IDownloader GetTranslateClient()

private static string GetAccessToken(string apiKey, string tokenEndpoint)
{
using (var httpClient = DownloaderFactory.MakeHttpClient())
using (var httpClient = HttpClientFactory.CreateHttpClientDownloader())
{
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
httpClient.DefaultRequestHeaders.TryAddWithoutValidation(SecurityHeaderName, apiKey);
Expand All @@ -151,7 +151,7 @@ private static List<TranslationPair> GetTranslationPairs()
return _translationPairs;
}

using (var httpClient = DownloaderFactory.MakeHttpClient())
using (var httpClient = HttpClientFactory.CreateHttpClientDownloader())
{
httpClient.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=UTF-8");
Expand Down
2 changes: 1 addition & 1 deletion src/libse/AutoTranslate/MyMemoryApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class MyMemoryApi : IAutoTranslator, IDisposable

public void Initialize()
{
_httpClient = DownloaderFactory.MakeHttpClient();
_httpClient = HttpClientFactory.CreateHttpClientDownloader();
_httpClient.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=UTF-8");
_httpClient.BaseAddress = new Uri("https://api.mymemory.translated.net/get");
Expand Down
2 changes: 1 addition & 1 deletion src/libse/AutoTranslate/NoLanguageLeftBehindApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class NoLanguageLeftBehindApi : IAutoTranslator, IDisposable
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = DownloaderFactory.MakeHttpClient();
_httpClient = HttpClientFactory.CreateHttpClientDownloader();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.BaseAddress = new Uri(Configuration.Settings.Tools.AutoTranslateNllbApiUrl);
Expand Down
2 changes: 1 addition & 1 deletion src/libse/AutoTranslate/NoLanguageLeftBehindServe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class NoLanguageLeftBehindServe : IAutoTranslator, IDisposable
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = DownloaderFactory.MakeHttpClient();
_httpClient = HttpClientFactory.CreateHttpClientDownloader();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.BaseAddress = new Uri(Configuration.Settings.Tools.AutoTranslateNllbServeUrl);
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/OllamaTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;
using Nikse.SubtitleEdit.Core.Settings;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
Expand All @@ -26,7 +27,7 @@ public class OllamaTranslate : IAutoTranslator
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.BaseAddress = new Uri(Configuration.Settings.Tools.OllamaApiUrl.TrimEnd('/'));
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/OpenRouterTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;
using Nikse.SubtitleEdit.Core.Settings;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
Expand Down Expand Up @@ -37,7 +38,7 @@ public class OpenRouterTranslate : IAutoTranslator
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.BaseAddress = new Uri(Configuration.Settings.Tools.OpenRouterUrl.TrimEnd('/'));
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/PapagoTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
{
Expand All @@ -26,7 +27,7 @@ public class PapagoTranslate : IAutoTranslator
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("X-NCP-APIGW-API-KEY-ID", Configuration.Settings.Tools.AutoTranslatePapagoApiKeyId);
Expand Down
3 changes: 2 additions & 1 deletion src/libse/AutoTranslate/SeamlessM4TTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Nikse.SubtitleEdit.Core.Http;

namespace Nikse.SubtitleEdit.Core.AutoTranslate
{
Expand All @@ -26,7 +27,7 @@ public class SeamlessM4TTranslate : IAutoTranslator
public void Initialize()
{
_httpClient?.Dispose();
_httpClient = new HttpClient();
_httpClient = HttpClientFactory.CreateProxiedHttpClient();
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
_httpClient.BaseAddress = new Uri(Configuration.Settings.Tools.AutoTranslateSeamlessM4TUrl.TrimEnd('/') + "/");
Expand Down
2 changes: 1 addition & 1 deletion src/libse/Forms/CheckForUpdatesHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void CheckForUpdates()
{
try
{
using (var httpClient = DownloaderFactory.MakeHttpClient())
using (var httpClient = HttpClientFactory.CreateHttpClientDownloader())
{
_changeLog = httpClient.GetStringAsync(ChangeLogUrl).Result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

namespace Nikse.SubtitleEdit.Core.Http
{
public static class DownloaderFactory
public static class HttpClientFactory
{
public static IDownloader MakeHttpClient()
public static IDownloader CreateHttpClientDownloader()
{
var httpClient = new HttpClient(CreateHandler(Configuration.Settings.Proxy));
var httpClient = CreateProxiedHttpClient();
if (Configuration.Settings.General.UseLegacyDownloader)
{
return new LegacyDownloader(httpClient);
Expand All @@ -19,6 +19,11 @@ public static IDownloader MakeHttpClient()
return new HttpClientDownloader(httpClient);
}

public static HttpClient CreateProxiedHttpClient()
{
return new HttpClient(CreateHandler(Configuration.Settings.Proxy));
}

private static HttpClientHandler CreateHandler(ProxySettings proxySettings)
{
var handler = new HttpClientHandler();
Expand Down
2 changes: 1 addition & 1 deletion src/libse/VobSub/Ocr/Service/GoogleCloudVisionApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public List<OcrLanguage> GetLanguages()
public GoogleCloudVisionApi(string apiKey)
{
_apiKey = apiKey;
_httpClient = DownloaderFactory.MakeHttpClient();
_httpClient = HttpClientFactory.CreateHttpClientDownloader();
_httpClient.BaseAddress = new Uri("https://vision.googleapis.com/v1/images:annotate");
_httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Forms/AudioToText/VoskModelDownload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void buttonOK_Click(object sender, EventArgs e)
buttonDownload.Enabled = false;
Refresh();
Cursor = Cursors.WaitCursor;
using (var httpClient = DownloaderFactory.MakeHttpClient())
using (var httpClient = HttpClientFactory.CreateHttpClientDownloader())
using (var downloadStream = new MemoryStream())
{
var downloadTask = httpClient.DownloadAsync(url, downloadStream, new Progress<float>((progress) =>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Forms/AudioToText/WhisperDownload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private void WhisperDownload_Shown(object sender, EventArgs e)

try
{
using (var httpClient = DownloaderFactory.MakeHttpClient())
using (var httpClient = HttpClientFactory.CreateHttpClientDownloader())
using (var downloadStream = new MemoryStream())
{
var downloadTask = httpClient.DownloadAsync(downloadUrl, downloadStream, new Progress<float>((progress) =>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Forms/AudioToText/WhisperModelDownload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void MultiFileDownload()
});
foreach (var url in LastDownloadedModel.Urls)
{
using (var httpClient = DownloaderFactory.MakeHttpClient())
using (var httpClient = HttpClientFactory.CreateHttpClientDownloader())
{
currentDownloadUrl = url;
_downloadFileName = MakeDownloadFileName(LastDownloadedModel, url) + ".$$$";
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Forms/DownloadFfmpeg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void DownloadFfmpeg_Shown(object sender, EventArgs e)
{
labelPleaseWait.Text = LanguageSettings.Current.General.PleaseWait;
Cursor = Cursors.WaitCursor;
using (var httpClient = DownloaderFactory.MakeHttpClient())
using (var httpClient = HttpClientFactory.CreateHttpClientDownloader())
using (var downloadStream = new MemoryStream())
{
var downloadTask = httpClient.DownloadAsync(url, downloadStream, new Progress<float>((progress) =>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Forms/DownloadVosk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void DownloadVosk_Shown(object sender, EventArgs e)
Refresh();
Cursor = Cursors.WaitCursor;

using (var httpClient = DownloaderFactory.MakeHttpClient())
using (var httpClient = HttpClientFactory.CreateHttpClientDownloader())
using (var downloadStream = new MemoryStream())
{
var downloadTask = httpClient.DownloadAsync(VoskUrl, downloadStream, new Progress<float>((progress) =>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Forms/DownloadYouTubeDl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void DownloadFfmpeg_Shown(object sender, EventArgs e)
buttonOK.Enabled = false;
Refresh();
Cursor = Cursors.WaitCursor;
using (var httpClient = DownloaderFactory.MakeHttpClient())
using (var httpClient = HttpClientFactory.CreateHttpClientDownloader())
using (var downloadStream = new MemoryStream())
{
var downloadTask = httpClient.DownloadAsync(Url, downloadStream, new Progress<float>((progress) =>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Forms/GetDictionaries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void buttonDownload_Click(object sender, EventArgs e)
Refresh();
Cursor = Cursors.WaitCursor;

using (var httpClient = DownloaderFactory.MakeHttpClient())
using (var httpClient = HttpClientFactory.CreateHttpClientDownloader())
using (var downloadStream = new MemoryStream())
{
var downloadTask = httpClient.DownloadAsync(_downloadLink, downloadStream, new Progress<float>((progress) =>
Expand Down
Loading