diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-09-30 13:41:55 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-30 13:41:55 -0400 |
| commit | af78556e1fef067852d4ee6d36d32f3c3269491e (patch) | |
| tree | 2b5b4f5a6e1399863fd0bcc3db1229e1772fa1aa /Emby.Server.Implementations/HttpServer | |
| parent | 6121e67a0750d6a1883d32f08dfc74d7544689bb (diff) | |
| parent | f2a5bd58ddc513a48850134eac4777ef985afcaa (diff) | |
Merge pull request #2926 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/HttpServer')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/HttpListenerHost.cs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index acc247e45..737d4ceea 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -4,6 +4,7 @@ using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Reflection; @@ -423,13 +424,16 @@ namespace Emby.Server.Implementations.HttpServer return true; } - private bool ValidateSsl(string remoteIp) + private bool ValidateSsl(string remoteIp, string urlString) { if (_config.Configuration.RequireHttps && _appHost.EnableHttps) { - if (!_networkManager.IsInLocalNetwork(remoteIp)) + if (urlString.IndexOf("https://", StringComparison.OrdinalIgnoreCase) == -1) { - return false; + if (!_networkManager.IsInLocalNetwork(remoteIp)) + { + return false; + } } } @@ -466,9 +470,13 @@ namespace Emby.Server.Implementations.HttpServer return; } - if (!ValidateSsl(httpReq.RemoteIp)) + if (!ValidateSsl(httpReq.RemoteIp, urlString)) { - RedirectToUrl(httpRes, urlString.Replace("http://", "https://", StringComparison.OrdinalIgnoreCase)); + var httpsUrl = urlString + .Replace("http://", "https://", StringComparison.OrdinalIgnoreCase) + .Replace(":" + _config.Configuration.PublicPort.ToString(CultureInfo.InvariantCulture), ":" + _config.Configuration.PublicHttpsPort.ToString(CultureInfo.InvariantCulture), StringComparison.OrdinalIgnoreCase); + + RedirectToUrl(httpRes, httpsUrl); return; } @@ -487,7 +495,7 @@ namespace Emby.Server.Implementations.HttpServer enableLog = EnableLogging(urlString, localPath); urlToLog = urlString; - logHeaders = enableLog && urlToLog.IndexOf("/videos/", StringComparison.OrdinalIgnoreCase) != -1; + logHeaders = enableLog && urlToLog.IndexOf("/videos/", StringComparison.OrdinalIgnoreCase) != -1; if (enableLog) { |
