aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-09-29 16:11:43 -0400
committerGitHub <noreply@github.com>2017-09-29 16:11:43 -0400
commit6121e67a0750d6a1883d32f08dfc74d7544689bb (patch)
tree57e03f441504689245922934474d4eb016426d13 /Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
parent93321730f4577d479c1c70b6c01c7aa2db79cb54 (diff)
parent9f86ebab28207be22617e165214ba68c35a09b15 (diff)
Merge pull request #2925 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/HttpListenerHost.cs')
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpListenerHost.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index 031d1d90b..acc247e45 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -423,6 +423,19 @@ namespace Emby.Server.Implementations.HttpServer
return true;
}
+ private bool ValidateSsl(string remoteIp)
+ {
+ if (_config.Configuration.RequireHttps && _appHost.EnableHttps)
+ {
+ if (!_networkManager.IsInLocalNetwork(remoteIp))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
/// <summary>
/// Overridable method that can be used to implement a custom hnandler
/// </summary>
@@ -453,6 +466,12 @@ namespace Emby.Server.Implementations.HttpServer
return;
}
+ if (!ValidateSsl(httpReq.RemoteIp))
+ {
+ RedirectToUrl(httpRes, urlString.Replace("http://", "https://", StringComparison.OrdinalIgnoreCase));
+ return;
+ }
+
if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase))
{
httpRes.StatusCode = 200;