The Free Software Media System - Server Backend & API
Replace EnableHttps and SupportsHttps with ListenWithHttps and CanConnectWithHttps
Mark Monteiroca71ac72abf5
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex c959cc974a..8158b45592 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -1408,7 +1408,7 @@ namespace Emby.Server.ImplementationsInternalMetadataPath = ApplicationPaths.InternalMetadataPath,CachePath = ApplicationPaths.CachePath,HttpServerPortNumber = HttpPort,- SupportsHttps = SupportsHttps,+ SupportsHttps = CanConnectWithHttps,HttpsPortNumber = HttpsPort,OperatingSystem = OperatingSystem.Id.ToString(),OperatingSystemDisplayName = OperatingSystem.Name,@@ -1446,9 +1446,14 @@ namespace Emby.Server.Implementations};}- public bool EnableHttps => SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps;+ /// <inheritdoc/>+ public bool ListenWithHttps => Certificate != null && ServerConfigurationManager.Configuration.EnableHttps;- public bool SupportsHttps => Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy;+ /// <summary>+ /// Gets a value indicating whether a client can connect to the server over HTTPS, either directly or via a+ /// reverse proxy.+ /// </summary>+ public bool CanConnectWithHttps => ListenWithHttps || ServerConfigurationManager.Configuration.IsBehindProxy;public async Task<string> GetLocalApiUrl(CancellationToken cancellationToken){@@ -1509,10 +1514,10 @@ namespace Emby.Server.Implementationspublic string GetLocalApiUrl(ReadOnlySpan<char> host){var url = new StringBuilder(64);- url.Append(EnableHttps ? "https://" : "http://")+ url.Append(ListenWithHttps ? "https://" : "http://").Append(host).Append(':')- .Append(EnableHttps ? HttpsPort : HttpPort);+ .Append(ListenWithHttps ? HttpsPort : HttpPort);string baseUrl = ServerConfigurationManager.Configuration.BaseUrl;if (baseUrl.Length != 0)diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.csindex e290c62e16..2023c470a8 100644--- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs+++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs@@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.EntryPoints.Append(config.PublicPort).Append(Separator).Append(_appHost.HttpPort).Append(Separator).Append(_appHost.HttpsPort).Append(Separator)- .Append(_appHost.EnableHttps).Append(Separator)+ .Append(_appHost.ListenWithHttps).Append(Separator).Append(config.EnableRemoteAccess).Append(Separator).ToString();}diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.csindex 7a812f3201..e3f8ec0146 100644--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs@@ -422,7 +422,7 @@ namespace Emby.Server.Implementations.HttpServerprivate bool ValidateSsl(string remoteIp, string urlString){- if (_config.Configuration.RequireHttps && _appHost.EnableHttps && !_config.Configuration.IsBehindProxy)+ if (_config.Configuration.RequireHttps && _appHost.ListenWithHttps){if (urlString.IndexOf("https://", StringComparison.OrdinalIgnoreCase) == -1){diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.csindex 4abdd59aaf..ddd1054ad0 100644--- a/Jellyfin.Server/Program.cs+++ b/Jellyfin.Server/Program.cs@@ -274,7 +274,7 @@ namespace Jellyfin.Server_logger.LogInformation("Kestrel listening on {IpAddress}", address);options.Listen(address, appHost.HttpPort);- if (appHost.EnableHttps && appHost.Certificate != null)+ if (appHost.ListenWithHttps){options.Listen(address, appHost.HttpsPort, listenOptions =>{@@ -289,7 +289,7 @@ namespace Jellyfin.Server_logger.LogInformation("Kestrel listening on all interfaces");options.ListenAnyIP(appHost.HttpPort);- if (appHost.EnableHttps && appHost.Certificate != null)+ if (appHost.ListenWithHttps){options.ListenAnyIP(appHost.HttpsPort, listenOptions =>{diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.csindex 608ffc61c2..d999f76dbf 100644--- a/MediaBrowser.Controller/IServerApplicationHost.cs+++ b/MediaBrowser.Controller/IServerApplicationHost.cs@@ -39,10 +39,9 @@ namespace MediaBrowser.Controllerint HttpsPort { get; }/// <summary>- /// Gets a value indicating whether [supports HTTPS].+ /// Gets a value indicating whether the server should listen on an HTTPS port./// </summary>- /// <value><c>true</c> if [supports HTTPS]; otherwise, <c>false</c>.</value>- bool EnableHttps { get; }+ bool ListenWithHttps { get; }/// <summary>/// Gets a value indicating whether this instance has update available.diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.csindex cfa7684c91..83c60563e7 100644--- a/MediaBrowser.Model/System/SystemInfo.cs+++ b/MediaBrowser.Model/System/SystemInfo.cs@@ -124,9 +124,9 @@ namespace MediaBrowser.Model.Systempublic int HttpServerPortNumber { get; set; }/// <summary>- /// Gets or sets a value indicating whether [enable HTTPS].+ /// Gets or sets a value indicating whether a client can connect to the server over HTTPS, either directly or+ /// via a reverse proxy./// </summary>- /// <value><c>true</c> if [enable HTTPS]; otherwise, <c>false</c>.</value>public bool SupportsHttps { get; set; }/// <summary>