fix turkish character recognition problems
This commit is contained in:
parent
a0f4a628dd
commit
a6e7438987
|
@ -37,10 +37,6 @@
|
|||
<Reference Include="Emby.Server.Core">
|
||||
<HintPath>..\ThirdParty\emby\Emby.Server.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="INIFileParser, Version=2.3.0.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ini-parser.2.3.0\lib\net20\INIFileParser.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.1\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
@ -79,28 +75,6 @@
|
|||
<Compile Include="Cryptography\X520Attributes.cs" />
|
||||
<Compile Include="ImageEncoderHelper.cs" />
|
||||
<Compile Include="IO\MemoryStreamProvider.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\ChannelScan.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\ReportBlock.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\RtcpAppPacket.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\RtcpByePacket.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\RtcpListener.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\RtcpPacket.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\RtcpReceiverReportPacket.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\RtcpSenderReportPacket.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\RtcpSourceDescriptionPacket.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\SourceDescriptionBlock.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\SourceDescriptionItem.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtp\RtpListener.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtp\RtpPacket.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtsp\RtspMethod.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtsp\RtspRequest.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtsp\RtspResponse.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtsp\RtspSession.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtsp\RtspStatusCode.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\SatIpDiscovery.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\SatIpHost.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\TransmissionMode.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\SatIp\Utils.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SystemEvents.cs" />
|
||||
</ItemGroup>
|
||||
|
@ -136,175 +110,6 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0030.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0049.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0070.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0090.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0100.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0130.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0160.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0170.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0192.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0200.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0215.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0235.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0255.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0260.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0282.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0305.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0308.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0310.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0315.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0330.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0360.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0380.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0390.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0400.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0420.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0435.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0450.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0460.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0475.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0480.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0490.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0505.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0510.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0520.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0525.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0530.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0549.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0560.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0570.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0600.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0620.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0642.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0650.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0660.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0685.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0705.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0721.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0740.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0750.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0765.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0785.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0830.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0851.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0865.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0875.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0880.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0900.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0915.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0922.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0935.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0950.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\0965.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1005.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1030.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1055.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1082.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1100.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1105.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1130.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1155.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1160.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1180.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1195.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1222.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1240.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1250.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1280.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1320.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1340.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1380.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1400.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1440.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1500.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1520.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1540.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1560.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1590.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1600 OPTUS D1 FTA %28160.0E%29.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1600.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1620.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1640.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1660.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1690.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1720.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1800.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\1830.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2210.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2230.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2250.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2270.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2290.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2310.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2330.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2350.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2370.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2390.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2410.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2432.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2451.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2470.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2489.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2500.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2527.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2550.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2570.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2590.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2608.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2630.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2650.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2669.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2690.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2710.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2728.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2730.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2750.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2760.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2770.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2780.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2812.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2820.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2830.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2850.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2873.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2880.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2881.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2882.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2900.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2930.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2950.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2970.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2985.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\2990.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3020.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3045.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3070.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3100.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3125.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3150.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3169.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3195.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3225.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3255.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3285.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3300.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3325.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3355.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3380.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3400.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3420.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3450.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3460.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3475.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3490.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3520.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3527.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3550.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3560.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3592.ini" />
|
||||
<None Include="LiveTv\TunerHosts\SatIp\ini\satellite\3594.ini" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="ini-parser" version="2.3.0" targetFramework="net46" />
|
||||
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.2.1" targetFramework="net46" />
|
||||
</packages>
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Services;
|
||||
|
||||
namespace ServiceStack.Host
|
||||
|
@ -54,11 +55,11 @@ namespace ServiceStack.Host
|
|||
return requestFactoryFn != null ? requestFactoryFn(httpReq) : null;
|
||||
}
|
||||
|
||||
public static RestPath FindMatchingRestPath(string httpMethod, string pathInfo, out string contentType)
|
||||
public static RestPath FindMatchingRestPath(string httpMethod, string pathInfo, ILogger logger, out string contentType)
|
||||
{
|
||||
pathInfo = GetSanitizedPathInfo(pathInfo, out contentType);
|
||||
|
||||
return ServiceStackHost.Instance.ServiceController.GetRestPathForRequest(httpMethod, pathInfo);
|
||||
return ServiceStackHost.Instance.ServiceController.GetRestPathForRequest(httpMethod, pathInfo, logger);
|
||||
}
|
||||
|
||||
public static string GetSanitizedPathInfo(string pathInfo, out string contentType)
|
||||
|
@ -93,7 +94,7 @@ namespace ServiceStack.Host
|
|||
if (this.RestPath == null)
|
||||
{
|
||||
string contentType;
|
||||
this.RestPath = FindMatchingRestPath(httpMethod, pathInfo, out contentType);
|
||||
this.RestPath = FindMatchingRestPath(httpMethod, pathInfo, new NullLogger(), out contentType);
|
||||
|
||||
if (contentType != null)
|
||||
ResponseContentType = contentType;
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using ServiceStack.Serialization;
|
||||
|
||||
namespace ServiceStack.Host
|
||||
|
@ -75,31 +76,36 @@ namespace ServiceStack.Host
|
|||
return parts;
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetFirstMatchHashKeys(string[] pathPartsForMatching)
|
||||
public static List<string> GetFirstMatchHashKeys(string[] pathPartsForMatching)
|
||||
{
|
||||
var hashPrefix = pathPartsForMatching.Length + PathSeperator;
|
||||
return GetPotentialMatchesWithPrefix(hashPrefix, pathPartsForMatching);
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetFirstMatchWildCardHashKeys(string[] pathPartsForMatching)
|
||||
public static List<string> GetFirstMatchWildCardHashKeys(string[] pathPartsForMatching)
|
||||
{
|
||||
const string hashPrefix = WildCard + PathSeperator;
|
||||
return GetPotentialMatchesWithPrefix(hashPrefix, pathPartsForMatching);
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetPotentialMatchesWithPrefix(string hashPrefix, string[] pathPartsForMatching)
|
||||
private static List<string> GetPotentialMatchesWithPrefix(string hashPrefix, string[] pathPartsForMatching)
|
||||
{
|
||||
var list = new List<string>();
|
||||
|
||||
foreach (var part in pathPartsForMatching)
|
||||
{
|
||||
yield return hashPrefix + part;
|
||||
list.Add(hashPrefix + part);
|
||||
|
||||
var subParts = part.Split(ComponentSeperator);
|
||||
if (subParts.Length == 1) continue;
|
||||
|
||||
foreach (var subPart in subParts)
|
||||
{
|
||||
yield return hashPrefix + subPart;
|
||||
list.Add(hashPrefix + subPart);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public RestPath(Type requestType, string path, string verbs, string summary = null, string notes = null)
|
||||
|
@ -220,16 +226,14 @@ namespace ServiceStack.Host
|
|||
|
||||
private readonly Dictionary<string, string> propertyNamesMap = new Dictionary<string, string>();
|
||||
|
||||
public static Func<RestPath, string, string[], int> CalculateMatchScore { get; set; }
|
||||
|
||||
public int MatchScore(string httpMethod, string[] withPathInfoParts)
|
||||
public int MatchScore(string httpMethod, string[] withPathInfoParts, ILogger logger)
|
||||
{
|
||||
if (CalculateMatchScore != null)
|
||||
return CalculateMatchScore(this, httpMethod, withPathInfoParts);
|
||||
|
||||
int wildcardMatchCount;
|
||||
var isMatch = IsMatch(httpMethod, withPathInfoParts, out wildcardMatchCount);
|
||||
if (!isMatch) return -1;
|
||||
var isMatch = IsMatch(httpMethod, withPathInfoParts, logger, out wildcardMatchCount);
|
||||
if (!isMatch)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
var score = 0;
|
||||
|
||||
|
@ -255,19 +259,33 @@ namespace ServiceStack.Host
|
|||
/// For performance withPathInfoParts should already be a lower case string
|
||||
/// to minimize redundant matching operations.
|
||||
/// </summary>
|
||||
/// <param name="httpMethod"></param>
|
||||
/// <param name="withPathInfoParts"></param>
|
||||
/// <param name="wildcardMatchCount"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsMatch(string httpMethod, string[] withPathInfoParts, out int wildcardMatchCount)
|
||||
public bool IsMatch(string httpMethod, string[] withPathInfoParts, ILogger logger, out int wildcardMatchCount)
|
||||
{
|
||||
wildcardMatchCount = 0;
|
||||
|
||||
if (withPathInfoParts.Length != this.PathComponentsCount && !this.IsWildCardPath) return false;
|
||||
if (!this.allowsAllVerbs && !StringContains(this.allowedVerbs, httpMethod)) return false;
|
||||
if (withPathInfoParts.Length != this.PathComponentsCount && !this.IsWildCardPath)
|
||||
{
|
||||
//logger.Info("withPathInfoParts mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ExplodeComponents(ref withPathInfoParts)) return false;
|
||||
if (this.TotalComponentsCount != withPathInfoParts.Length && !this.IsWildCardPath) return false;
|
||||
if (!this.allowsAllVerbs && !StringContains(this.allowedVerbs, httpMethod))
|
||||
{
|
||||
//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;
|
||||
}
|
||||
|
||||
int pathIx = 0;
|
||||
for (var i = 0; i < this.TotalComponentsCount; i++)
|
||||
|
@ -277,7 +295,7 @@ namespace ServiceStack.Host
|
|||
if (i < this.TotalComponentsCount - 1)
|
||||
{
|
||||
// Continue to consume up until a match with the next literal
|
||||
while (pathIx < withPathInfoParts.Length && withPathInfoParts[pathIx] != this.literalsToMatch[i + 1])
|
||||
while (pathIx < withPathInfoParts.Length && !LiteralsEqual(withPathInfoParts[pathIx], this.literalsToMatch[i + 1]))
|
||||
{
|
||||
pathIx++;
|
||||
wildcardMatchCount++;
|
||||
|
@ -286,6 +304,7 @@ namespace ServiceStack.Host
|
|||
// 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;
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +325,11 @@ namespace ServiceStack.Host
|
|||
continue;
|
||||
}
|
||||
|
||||
if (withPathInfoParts.Length <= pathIx || withPathInfoParts[pathIx] != literalToMatch) return false;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
@ -314,6 +337,22 @@ namespace ServiceStack.Host
|
|||
return pathIx == withPathInfoParts.Length;
|
||||
}
|
||||
|
||||
private bool LiteralsEqual(string str1, string str2)
|
||||
{
|
||||
// Most cases
|
||||
if (string.Equals(str1, str2, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle turkish i
|
||||
str1 = str1.ToUpperInvariant();
|
||||
str2 = str2.ToUpperInvariant();
|
||||
|
||||
// Invariant IgnoreCase would probably be better but it's not available in PCL
|
||||
return string.Equals(str1, str2, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
private bool ExplodeComponents(ref string[] withPathInfoParts)
|
||||
{
|
||||
var totalComponents = new List<string>();
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Services;
|
||||
|
||||
namespace ServiceStack.Host
|
||||
|
@ -135,7 +136,7 @@ namespace ServiceStack.Host
|
|||
appHost.RestPaths.AddRange(RestPathMap.Values.SelectMany(x => x));
|
||||
}
|
||||
|
||||
public RestPath GetRestPathForRequest(string httpMethod, string pathInfo)
|
||||
public RestPath GetRestPathForRequest(string httpMethod, string pathInfo, ILogger logger)
|
||||
{
|
||||
var matchUsingPathParts = RestPath.GetPathPartsForMatching(pathInfo);
|
||||
|
||||
|
@ -144,19 +145,23 @@ namespace ServiceStack.Host
|
|||
var yieldedHashMatches = RestPath.GetFirstMatchHashKeys(matchUsingPathParts);
|
||||
foreach (var potentialHashMatch in yieldedHashMatches)
|
||||
{
|
||||
if (!this.RestPathMap.TryGetValue(potentialHashMatch, out firstMatches)) continue;
|
||||
if (!this.RestPathMap.TryGetValue(potentialHashMatch, out firstMatches))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var bestScore = -1;
|
||||
foreach (var restPath in firstMatches)
|
||||
{
|
||||
var score = restPath.MatchScore(httpMethod, matchUsingPathParts);
|
||||
var score = restPath.MatchScore(httpMethod, matchUsingPathParts, logger);
|
||||
if (score > bestScore) bestScore = score;
|
||||
}
|
||||
|
||||
if (bestScore > 0)
|
||||
{
|
||||
foreach (var restPath in firstMatches)
|
||||
{
|
||||
if (bestScore == restPath.MatchScore(httpMethod, matchUsingPathParts))
|
||||
if (bestScore == restPath.MatchScore(httpMethod, matchUsingPathParts, logger))
|
||||
return restPath;
|
||||
}
|
||||
}
|
||||
|
@ -170,14 +175,14 @@ namespace ServiceStack.Host
|
|||
var bestScore = -1;
|
||||
foreach (var restPath in firstMatches)
|
||||
{
|
||||
var score = restPath.MatchScore(httpMethod, matchUsingPathParts);
|
||||
var score = restPath.MatchScore(httpMethod, matchUsingPathParts, logger);
|
||||
if (score > bestScore) bestScore = score;
|
||||
}
|
||||
if (bestScore > 0)
|
||||
{
|
||||
foreach (var restPath in firstMatches)
|
||||
{
|
||||
if (bestScore == restPath.MatchScore(httpMethod, matchUsingPathParts))
|
||||
if (bestScore == restPath.MatchScore(httpMethod, matchUsingPathParts, logger))
|
||||
return restPath;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,19 @@ namespace ServiceStack
|
|||
}
|
||||
|
||||
string contentType;
|
||||
var restPath = RestHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, out contentType);
|
||||
if (restPath != null)
|
||||
return new RestHandler { RestPath = restPath, RequestName = restPath.RequestType.GetOperationName(), ResponseContentType = contentType };
|
||||
var restPath = RestHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, logger, out contentType);
|
||||
|
||||
if (restPath != null)
|
||||
{
|
||||
return new RestHandler
|
||||
{
|
||||
RestPath = restPath,
|
||||
RequestName = restPath.RequestType.GetOperationName(),
|
||||
ResponseContentType = contentType
|
||||
};
|
||||
}
|
||||
|
||||
logger.Error("Could not find handler for {0}", pathInfo);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user