Skip to content
Merged
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
11 changes: 3 additions & 8 deletions Flow.Launcher.Infrastructure/Http/Http.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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;
Expand All @@ -45,6 +39,7 @@ public static HttpProxy Proxy
{
proxy = value;
proxy.PropertyChanged += UpdateProxy;
UpdateProxy(ProxyProperty.Enabled);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Flow.Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down