aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ApplicationHost.cs
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2020-04-26 15:13:27 -0400
committerGitHub <noreply@github.com>2020-04-26 15:13:27 -0400
commitf502c893315ce0f130a22d1a30394218ae3ed511 (patch)
treebe7eb3ebb72889d3cda8cef849d4b4d364c6898e /Emby.Server.Implementations/ApplicationHost.cs
parentca4b6836c18044d793fa66aa701da33632df6fce (diff)
parentcbeeeced759de0452d75b3d6daa11bb213ff2a26 (diff)
Merge pull request #2798 from JustAMan/fix-livetv-again
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 33aec1a06..4d906a1bf 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -1185,7 +1185,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
{
@@ -1194,7 +1194,7 @@ namespace Emby.Server.Implementations
foreach (var address in addresses)
{
- return GetLocalApiUrl(address);
+ return GetLocalApiUrl(address, forceHttp);
}
return null;
@@ -1224,7 +1224,7 @@ namespace Emby.Server.Implementations
}
/// <inheritdoc />
- public string GetLocalApiUrl(IPAddress ipAddress)
+ public string GetLocalApiUrl(IPAddress ipAddress, bool forceHttp = false)
{
if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
{
@@ -1234,20 +1234,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)