diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs index 5af50bc6dca..de2e823590b 100644 --- a/Flow.Launcher.Infrastructure/Http/Http.cs +++ b/Flow.Launcher.Infrastructure/Http/Http.cs @@ -16,13 +16,7 @@ public static class Http { private const string UserAgent = @"Mozilla/5.0 (Trident/7.0; rv:11.0) like Gecko"; - private static HttpClient client; - - private static SocketsHttpHandler socketsHttpHandler = new SocketsHttpHandler() - { - UseProxy = true, - Proxy = WebProxy - }; + private static HttpClient client = new HttpClient(); static Http() { @@ -32,8 +26,8 @@ static Http() | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; - client = new HttpClient(socketsHttpHandler, false); client.DefaultRequestHeaders.Add("User-Agent", UserAgent); + HttpClient.DefaultProxy = WebProxy; } private static HttpProxy proxy; @@ -45,6 +39,7 @@ public static HttpProxy Proxy { proxy = value; proxy.PropertyChanged += UpdateProxy; + UpdateProxy(ProxyProperty.Enabled); } } diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index 06bb16e3be2..7c4c6a36716 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -61,6 +61,8 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () => _settingsVM = new SettingWindowViewModel(_updater, _portable); _settings = _settingsVM.Settings; + Http.Proxy = _settings.Proxy; + _alphabet.Initialize(_settings); _stringMatcher = new StringMatcher(_alphabet); StringMatcher.Instance = _stringMatcher; @@ -85,8 +87,6 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () => ThemeManager.Instance.Settings = _settings; ThemeManager.Instance.ChangeTheme(_settings.Theme); - Http.Proxy = _settings.Proxy; - Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); RegisterExitEvents();