aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ApplicationHost.cs
diff options
context:
space:
mode:
authorVasily <just.one.man@yandex.ru>2020-04-07 18:41:15 +0300
committerVasily <just.one.man@yandex.ru>2020-04-07 18:41:15 +0300
commite85f9f5613c009a47c9b59ac59cd5930fc45d96a (patch)
tree19cc65ff0c724dbcc25ed546c95ee734423a0575 /Emby.Server.Implementations/ApplicationHost.cs
parentc6987df50182af24b18d45f4e710aa90c9d0cc78 (diff)
Make localhost LiveTV restreams always use plain HTTP port
Diffstat (limited to 'Emby.Server.Implementations/ApplicationHost.cs')
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs17
1 files changed, 9 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index cb32b8c01..9af89112c 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -1419,7 +1419,7 @@ namespace Emby.Server.Implementations
public bool SupportsHttps => Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy;
- public async Task<string> GetLocalApiUrl(CancellationToken cancellationToken)
+ public async Task<string> GetLocalApiUrl(CancellationToken cancellationToken, bool forceHttp=false)
{
try
{
@@ -1428,7 +1428,7 @@ namespace Emby.Server.Implementations
foreach (var address in addresses)
{
- return GetLocalApiUrl(address);
+ return GetLocalApiUrl(address, forceHttp);
}
return null;
@@ -1458,7 +1458,7 @@ namespace Emby.Server.Implementations
}
/// <inheritdoc />
- public string GetLocalApiUrl(IPAddress ipAddress)
+ public string GetLocalApiUrl(IPAddress ipAddress, bool forceHttp=false)
{
if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
{
@@ -1468,20 +1468,21 @@ namespace Emby.Server.Implementations
str.CopyTo(span.Slice(1));
span[^1] = ']';
- return GetLocalApiUrl(span);
+ return GetLocalApiUrl(span, forceHttp);
}
- return GetLocalApiUrl(ipAddress.ToString());
+ return GetLocalApiUrl(ipAddress.ToString(), forceHttp);
}
/// <inheritdoc />
- public string GetLocalApiUrl(ReadOnlySpan<char> host)
+ public string GetLocalApiUrl(ReadOnlySpan<char> host, bool forceHttp=false)
{
var url = new StringBuilder(64);
- url.Append(EnableHttps ? "https://" : "http://")
+ bool useHttps = EnableHttps && !forceHttp;
+ url.Append(useHttps ? "https://" : "http://")
.Append(host)
.Append(':')
- .Append(EnableHttps ? HttpsPort : HttpPort);
+ .Append(useHttps ? HttpsPort : HttpPort);
string baseUrl = ServerConfigurationManager.Configuration.BaseUrl;
if (baseUrl.Length != 0)