From fe9f7a24a18c45ee5fb5d663e14c6d92a729b543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stef=C3=A1n=20J=C3=B6kull=20Sigur=C3=B0arson?= Date: Mon, 30 Sep 2024 10:38:08 +0000 Subject: [PATCH 1/2] Moving to SocketsHttpClient Updating NuGet packages --- src/Directory.Build.props | 2 +- ...IBeenPwned.PwnedPasswords.Downloader.csproj | 5 +++-- .../Program.cs | 18 +++++------------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 041a4c4..658e4ed 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,5 +1,5 @@ - + diff --git a/src/HaveIBeenPwned.PwnedPasswords.Downloader/HaveIBeenPwned.PwnedPasswords.Downloader.csproj b/src/HaveIBeenPwned.PwnedPasswords.Downloader/HaveIBeenPwned.PwnedPasswords.Downloader.csproj index d0a097f..75a72e8 100644 --- a/src/HaveIBeenPwned.PwnedPasswords.Downloader/HaveIBeenPwned.PwnedPasswords.Downloader.csproj +++ b/src/HaveIBeenPwned.PwnedPasswords.Downloader/HaveIBeenPwned.PwnedPasswords.Downloader.csproj @@ -1,7 +1,7 @@ Exe - net6.0;net7.0;net8.0 + net8.0;net7.0;net6.0 enable enable true @@ -14,11 +14,12 @@ hibp.png haveibeenpwned hibp pwnedpasswords security password README.md + true - + diff --git a/src/HaveIBeenPwned.PwnedPasswords.Downloader/Program.cs b/src/HaveIBeenPwned.PwnedPasswords.Downloader/Program.cs index cd4c875..828a615 100644 --- a/src/HaveIBeenPwned.PwnedPasswords.Downloader/Program.cs +++ b/src/HaveIBeenPwned.PwnedPasswords.Downloader/Program.cs @@ -48,17 +48,11 @@ static IHostBuilder CreateHostBuilder(string[] args) => { services .AddHttpClient("PwnedPasswords") - .ConfigurePrimaryHttpMessageHandler(() => + .UseSocketsHttpHandler((handler, provider) => { - var handler = new HttpClientHandler(); - - if (handler.SupportsAutomaticDecompression) - { - handler.AutomaticDecompression = DecompressionMethods.All; - handler.SslProtocols = System.Security.Authentication.SslProtocols.Tls13 | System.Security.Authentication.SslProtocols.Tls12; - } - - return handler; + handler.AutomaticDecompression = DecompressionMethods.All; + handler.SslOptions.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls13 | System.Security.Authentication.SslProtocols.Tls12; + handler.EnableMultipleHttp2Connections = true; }) .ConfigureHttpClient(client => { @@ -69,10 +63,8 @@ static IHostBuilder CreateHostBuilder(string[] args) => client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("hibp-downloader", FileVersionInfo.GetVersionInfo(process).ProductVersion)); } -#if NET7_0_OR_GREATER - client.DefaultRequestVersion = HttpVersion.Version30; + client.DefaultRequestVersion = HttpVersion.Version20; client.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrLower; -#endif }); }); From c5a8172c527835281f48e871656de4118256cf6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stef=C3=A1n=20J=C3=B6kull=20Sigur=C3=B0arson?= Date: Mon, 30 Sep 2024 10:43:35 +0000 Subject: [PATCH 2/2] Updating Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e3effd..3839ae4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # Installation ## Prerequisites -You'll need to install [.NET 6](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) to be able to install the tool. +You'll need to install the latest LTS (Long Term Support) version of the [.NET SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) to be able to install the tool. ## How to install 1. Open a command line window