Skip to content

Commit

Permalink
Merge pull request #5 from felsokning/hotfix/TLS_Version_Issue
Browse files Browse the repository at this point in the history
Fixing TLS Version in HttpBase Until Bug Can Be Addressed
  • Loading branch information
felsokning authored Feb 28, 2024
2 parents 18e4c1d + 8cddb01 commit 84df226
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-publish-to-nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ jobs:
- name: Adding markdown to build summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: .NET Pack
run: dotnet pack /p:Version=${{ github.event.release.tag_name }}
run: dotnet pack --configuration Debug /p:Version=${{ github.event.release.tag_name }}
- name: Push to NuGet
run: dotnet nuget push "**/*.nupkg" --api-key ${{ secrets.NUGET_API_TOKEN }} --source https://api.nuget.org/v3/index.json
15 changes: 15 additions & 0 deletions Felsökning.Tests/HttpBaseTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Felsökning.Tests
{
[TestClass]
public class HttpBaseTests
{
[TestMethod]
public async Task TestTlsVersions()
{
var sut = new HttpBase(HttpVersion.Version11, "Felsökning.Tests");

var exception = await Assert.ThrowsExceptionAsync<HttpRequestException>(async () => await sut.HttpClient.GetStringAsync("https://api.nationaltransport.ie/gtfsr/v2/TripUpdates?format=json"));
exception.Should().BeOfType<HttpRequestException>();
}
}
}
5 changes: 3 additions & 2 deletions Felsökning/HttpBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ public class HttpBase : IDisposable
public HttpBase(Version httpVersion, [Optional] string productInfoString)
{
var httpClientHandler = new HttpClientHandler()
{
SslProtocols = SslProtocols.Tls13
{
//SslProtocols.Tls13
SslProtocols = SslProtocols.Tls12
};

HttpClient = new HttpClient(httpClientHandler)
Expand Down

0 comments on commit 84df226

Please sign in to comment.