diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 4733b39abe..df4f3e6762 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1094,7 +1094,7 @@ namespace Emby.Server.Implementations { int? requestPort = request.Host.Port; if (requestPort == null - || (requestPort == 80 && string.Equals(request.Scheme, "http", StringComparison.OrdinalIgnoreCase)) + || (requestPort == 80 && string.Equals(request.Scheme, "http", StringComparison.OrdinalIgnoreCase)) || (requestPort == 443 && string.Equals(request.Scheme, "https", StringComparison.OrdinalIgnoreCase))) { requestPort = -1; diff --git a/MediaBrowser.Common/Net/NetworkExtensions.cs b/MediaBrowser.Common/Net/NetworkExtensions.cs index e37a5dc6bc..97f0abbb52 100644 --- a/MediaBrowser.Common/Net/NetworkExtensions.cs +++ b/MediaBrowser.Common/Net/NetworkExtensions.cs @@ -1,10 +1,10 @@ -using Microsoft.AspNetCore.HttpOverrides; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Net; using System.Net.Sockets; using System.Text.RegularExpressions; +using Microsoft.AspNetCore.HttpOverrides; namespace MediaBrowser.Common.Net { @@ -131,7 +131,7 @@ namespace MediaBrowser.Common.Net /// URI safe conversion of the address. public static string FormatIpString(IPAddress? address) { - if (address == null) + if (address is null) { return string.Empty; } @@ -163,7 +163,7 @@ namespace MediaBrowser.Common.Net { result = new List(); - if (values == null || values.Length == 0) + if (values is null || values.Length == 0) { return false; } @@ -182,7 +182,7 @@ namespace MediaBrowser.Common.Net _ = IPAddress.TryParse(v[0][0..], out address); } - if (address != IPAddress.None && address != null) + if (address != IPAddress.None && address is not null) { if (v.Length > 1 && int.TryParse(v[1], out var netmask)) { @@ -240,7 +240,7 @@ namespace MediaBrowser.Common.Net _ = IPAddress.TryParse(v[0][0..], out address); } - if (address != IPAddress.None && address != null) + if (address != IPAddress.None && address is not null) { if (v.Length > 1 && int.TryParse(v[1], out var netmask)) { diff --git a/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs b/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs index 86b2ab21a3..241d2314bf 100644 --- a/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs +++ b/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs @@ -207,7 +207,7 @@ namespace Jellyfin.Networking.Tests // Check to see if dns resolution is working. If not, skip test. _ = NetworkExtensions.TryParseHost(source, out var host); - if (resultObj != null && host.Length > 0) + if (resultObj is not null && host.Length > 0) { result = resultObj.First().Address.ToString(); var intf = nm.GetBindInterface(source, out _); @@ -265,7 +265,7 @@ namespace Jellyfin.Networking.Tests using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger()); NetworkManager.MockNetworkSettings = string.Empty; - if (nm.TryParseInterface(result, out List? resultObj) && resultObj != null) + if (nm.TryParseInterface(result, out List? resultObj) && resultObj is not null) { // Parse out IPAddresses so we can do a string comparison (ignore subnet masks). result = resultObj.First().Address.ToString();