Preventing shell resolution when unnecessary

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2013-05-17 10:04:30 -07:00
parent ed4d04b904
commit 3acae64d72

View File

@@ -60,7 +60,8 @@ namespace Orchard.Environment {
s.RequestUrlHost.Split(new [] {','}, StringSplitOptions.RemoveEmptyEntries)
.Select(h => new ShellSettings(s) {RequestUrlHost = h}))
.GroupBy(s => s.RequestUrlHost ?? string.Empty)
.OrderByDescending(g => g.Key.Length);
.OrderByDescending(g => g.Key.Length)
.ToArray();
if (unqualified.Count() == 1) {
// only one shell had no request url criteria
@@ -85,6 +86,11 @@ namespace Orchard.Environment {
}
public ShellSettings Match(string host, string appRelativePath) {
// optimized path when only one tenant (Default)
if (!_shellsByHost.Any()) {
return _fallback;
}
var hostLength = host.IndexOf(':');
if (hostLength != -1)
host = host.Substring(0, hostLength);