aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Services
diff options
context:
space:
mode:
authorLogicalPhallacy <44458166+LogicalPhallacy@users.noreply.github.com>2019-01-01 11:47:57 -0800
committerGitHub <noreply@github.com>2019-01-01 11:47:57 -0800
commit443218e3f109cdfbffa8c8c5d30e09e3ba5c2285 (patch)
tree6de8dee799eebba514bac0b6eac457b4c0137978 /Emby.Server.Implementations/Services
parent0c52f448a0c6d5cd3c5cce597fcf3ad9582c90f1 (diff)
parentcff0ece07329bbfa05fd22fbde444d09aaeb9a5c (diff)
Merge pull request #4 from jellyfin/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/Services')
-rw-r--r--Emby.Server.Implementations/Services/ServiceController.cs10
-rw-r--r--Emby.Server.Implementations/Services/ServiceExec.cs4
-rw-r--r--Emby.Server.Implementations/Services/ServiceHandler.cs8
-rw-r--r--Emby.Server.Implementations/Services/ServicePath.cs26
4 files changed, 21 insertions, 27 deletions
diff --git a/Emby.Server.Implementations/Services/ServiceController.cs b/Emby.Server.Implementations/Services/ServiceController.cs
index 3726c9f6b0..46af831288 100644
--- a/Emby.Server.Implementations/Services/ServiceController.cs
+++ b/Emby.Server.Implementations/Services/ServiceController.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Emby.Server.Implementations.HttpServer;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Services;
namespace Emby.Server.Implementations.Services
@@ -99,7 +99,7 @@ namespace Emby.Server.Implementations.Services
pathsAtFirstMatch.Add(restPath);
}
- public RestPath GetRestPathForRequest(string httpMethod, string pathInfo, ILogger logger)
+ public RestPath GetRestPathForRequest(string httpMethod, string pathInfo)
{
var matchUsingPathParts = RestPath.GetPathPartsForMatching(pathInfo);
@@ -117,7 +117,7 @@ namespace Emby.Server.Implementations.Services
RestPath bestMatch = null;
foreach (var restPath in firstMatches)
{
- var score = restPath.MatchScore(httpMethod, matchUsingPathParts, logger);
+ var score = restPath.MatchScore(httpMethod, matchUsingPathParts);
if (score > bestScore)
{
bestScore = score;
@@ -140,7 +140,7 @@ namespace Emby.Server.Implementations.Services
RestPath bestMatch = null;
foreach (var restPath in firstMatches)
{
- var score = restPath.MatchScore(httpMethod, matchUsingPathParts, logger);
+ var score = restPath.MatchScore(httpMethod, matchUsingPathParts);
if (score > bestScore)
{
bestScore = score;
@@ -183,4 +183,4 @@ namespace Emby.Server.Implementations.Services
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Services/ServiceExec.cs b/Emby.Server.Implementations/Services/ServiceExec.cs
index 79b57438ca..9516c1e389 100644
--- a/Emby.Server.Implementations/Services/ServiceExec.cs
+++ b/Emby.Server.Implementations/Services/ServiceExec.cs
@@ -181,7 +181,7 @@ namespace Emby.Server.Implementations.Services
}
if (reqFilters.Count > 0)
- actionCtx.RequestFilters = reqFilters.OrderBy(i => i.Priority).ToArray(reqFilters.Count);
+ actionCtx.RequestFilters = reqFilters.OrderBy(i => i.Priority).ToArray();
actions.Add(actionCtx);
}
@@ -220,4 +220,4 @@ namespace Emby.Server.Implementations.Services
}
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Services/ServiceHandler.cs b/Emby.Server.Implementations/Services/ServiceHandler.cs
index e76857a8df..f5fcb5fe6b 100644
--- a/Emby.Server.Implementations/Services/ServiceHandler.cs
+++ b/Emby.Server.Implementations/Services/ServiceHandler.cs
@@ -4,7 +4,7 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.HttpServer;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Services;
namespace Emby.Server.Implementations.Services
@@ -24,11 +24,11 @@ namespace Emby.Server.Implementations.Services
return Task.FromResult(host.CreateInstance(requestType));
}
- public static RestPath FindMatchingRestPath(string httpMethod, string pathInfo, ILogger logger, out string contentType)
+ public static RestPath FindMatchingRestPath(string httpMethod, string pathInfo, out string contentType)
{
pathInfo = GetSanitizedPathInfo(pathInfo, out contentType);
- return ServiceController.Instance.GetRestPathForRequest(httpMethod, pathInfo, logger);
+ return ServiceController.Instance.GetRestPathForRequest(httpMethod, pathInfo);
}
public static string GetSanitizedPathInfo(string pathInfo, out string contentType)
@@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.Services
if (this.RestPath == null)
{
string contentType;
- this.RestPath = FindMatchingRestPath(httpMethod, pathInfo, new NullLogger(), out contentType);
+ this.RestPath = FindMatchingRestPath(httpMethod, pathInfo, out contentType);
if (contentType != null)
ResponseContentType = contentType;
diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs
index 282269e7b1..ac2af3eaf9 100644
--- a/Emby.Server.Implementations/Services/ServicePath.cs
+++ b/Emby.Server.Implementations/Services/ServicePath.cs
@@ -4,7 +4,7 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Extensions;
namespace Emby.Server.Implementations.Services
@@ -132,13 +132,13 @@ namespace Emby.Server.Implementations.Services
}
}
- var components = componentsList.ToArray(componentsList.Count);
+ var components = componentsList.ToArray();
this.TotalComponentsCount = components.Length;
this.literalsToMatch = new string[this.TotalComponentsCount];
this.variablesNames = new string[this.TotalComponentsCount];
this.isWildcard = new bool[this.TotalComponentsCount];
- this.componentsWithSeparators = hasSeparators.ToArray(hasSeparators.Count);
+ this.componentsWithSeparators = hasSeparators.ToArray();
this.PathComponentsCount = this.componentsWithSeparators.Length;
string firstLiteralMatch = null;
@@ -297,7 +297,7 @@ namespace Emby.Server.Implementations.Services
if (mi != null && mi.IsStatic) continue;
pis.Add(pi);
}
- return pis.ToArray(pis.Count);
+ return pis.ToArray();
}
/// <summary>
@@ -309,10 +309,10 @@ namespace Emby.Server.Implementations.Services
private readonly Dictionary<string, string> propertyNamesMap = new Dictionary<string, string>();
- public int MatchScore(string httpMethod, string[] withPathInfoParts, ILogger logger)
+ public int MatchScore(string httpMethod, string[] withPathInfoParts)
{
int wildcardMatchCount;
- var isMatch = IsMatch(httpMethod, withPathInfoParts, logger, out wildcardMatchCount);
+ var isMatch = IsMatch(httpMethod, withPathInfoParts, out wildcardMatchCount);
if (!isMatch)
{
return -1;
@@ -348,31 +348,27 @@ namespace Emby.Server.Implementations.Services
/// For performance withPathInfoParts should already be a lower case string
/// to minimize redundant matching operations.
/// </summary>
- public bool IsMatch(string httpMethod, string[] withPathInfoParts, ILogger logger, out int wildcardMatchCount)
+ public bool IsMatch(string httpMethod, string[] withPathInfoParts, out int wildcardMatchCount)
{
wildcardMatchCount = 0;
if (withPathInfoParts.Length != this.PathComponentsCount && !this.IsWildCardPath)
{
- //logger.Info("withPathInfoParts mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
- return false;
+ return false;
}
if (!Verbs.Contains(httpMethod, StringComparer.OrdinalIgnoreCase))
{
- //logger.Info("allowsAllVerbs mismatch for {0} for {1} allowedverbs {2}", httpMethod, string.Join("/", withPathInfoParts), this.allowedVerbs);
return false;
}
if (!ExplodeComponents(ref withPathInfoParts))
{
- //logger.Info("ExplodeComponents mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
return false;
}
if (this.TotalComponentsCount != withPathInfoParts.Length && !this.IsWildCardPath)
{
- //logger.Info("TotalComponentsCount mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
return false;
}
@@ -393,7 +389,6 @@ namespace Emby.Server.Implementations.Services
// Ensure there are still enough parts left to match the remainder
if ((withPathInfoParts.Length - pathIx) < (this.TotalComponentsCount - i - 1))
{
- //logger.Info("withPathInfoParts length mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
return false;
}
}
@@ -416,7 +411,6 @@ namespace Emby.Server.Implementations.Services
if (withPathInfoParts.Length <= pathIx || !LiteralsEqual(withPathInfoParts[pathIx], literalToMatch))
{
- //logger.Info("withPathInfoParts2 length mismatch for {0} for {1}. not equals: {2} != {3}.", httpMethod, string.Join("/", withPathInfoParts), withPathInfoParts[pathIx], literalToMatch);
return false;
}
pathIx++;
@@ -463,7 +457,7 @@ namespace Emby.Server.Implementations.Services
}
}
- withPathInfoParts = totalComponents.ToArray(totalComponents.Count);
+ withPathInfoParts = totalComponents.ToArray();
return true;
}
@@ -574,4 +568,4 @@ namespace Emby.Server.Implementations.Services
}
}
}
-} \ No newline at end of file
+}