Add 'Apache' and 'IIS' to internal namespaces and classes

This commit is contained in:
Nate McMaster 2016-09-06 10:51:19 -07:00
parent 57c1f877e3
commit a5ff9d8003
No known key found for this signature in database
GPG Key ID: 6572615A705669C9
53 changed files with 81 additions and 83 deletions

5
.gitignore vendored
View File

@ -27,4 +27,7 @@ project.lock.json
*.ipch
.vs/
.build/
.testPublish/
.testPublish/
.idea/
.vscode/

View File

@ -4,7 +4,7 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Rewrite.Internal.ModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite;
namespace Microsoft.AspNetCore.Rewrite
{

View File

@ -4,7 +4,7 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite;
namespace Microsoft.AspNetCore.Rewrite
{

View File

@ -4,15 +4,15 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Rewrite.Logging;
namespace Microsoft.AspNetCore.Rewrite.Internal
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
public class ModRewriteRule : Rule
public class ApacheModRewriteRule : Rule
{
public UrlMatch InitialMatch { get; }
public IList<Condition> Conditions { get; }
public IList<UrlAction> Actions { get; }
public ModRewriteRule(UrlMatch initialMatch, IList<Condition> conditions, IList<UrlAction> urlActions)
public ApacheModRewriteRule(UrlMatch initialMatch, IList<Condition> conditions, IList<UrlAction> urlActions)
{
Conditions = conditions;
InitialMatch = initialMatch;

View File

@ -3,7 +3,7 @@
using System;
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
/// <summary>
/// Parses the "CondPattern" portion of the RewriteCond.

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
public enum ConditionType
{

View File

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
public class FileParser
{

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
public class FlagParser
{

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
public enum FlagType
{

View File

@ -3,7 +3,7 @@
using System.Collections.Generic;
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
// For more information of flags, and what flags we currently support:
// https://github.com/aspnet/BasicMiddleware/issues/66

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
public enum OperationType
{

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
public class ParsedModRewriteInput
{

View File

@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Rewrite.Internal.UrlActions;
using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches;
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
public class RuleBuilder
{
@ -17,13 +17,13 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
private readonly TimeSpan RegexTimeout = TimeSpan.FromMilliseconds(1);
public ModRewriteRule Build()
public ApacheModRewriteRule Build()
{
if (_actions.Count == 0 || _match == null)
{
throw new InvalidOperationException("Cannot create ModRewriteRule without action and match");
}
return new ModRewriteRule(_match, _conditions, _actions);
return new ApacheModRewriteRule(_match, _conditions, _actions);
}
public void AddRule(string rule)

View File

@ -3,7 +3,7 @@
using System;
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
public class RuleRegexParser
{

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
public enum SegmentType
{

View File

@ -5,7 +5,7 @@ using System;
using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments;
using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
/// <summary>
/// mod_rewrite lookups for specific string constants.

View File

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments;
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
/// <summary>
/// Parses the TestString segment of the mod_rewrite condition.

View File

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{
/// <summary>
/// Tokenizes a mod_rewrite rule, delimited by spaces.

View File

@ -3,7 +3,7 @@
using System;
namespace Microsoft.AspNetCore.Rewrite.Internal.CodeRules
namespace Microsoft.AspNetCore.Rewrite.Internal
{
public class DelegateRule : Rule
{

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public enum ActionType
{

View File

@ -5,16 +5,16 @@ using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Rewrite.Logging;
namespace Microsoft.AspNetCore.Rewrite.Internal
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public class UrlRewriteRule : Rule
public class IISUrlRewriteRule : Rule
{
public string Name { get; }
public UrlMatch InitialMatch { get; }
public IList<Condition> Conditions { get; }
public UrlAction Action { get; }
public UrlRewriteRule(string name,
public IISUrlRewriteRule(string name,
UrlMatch initialMatch,
IList<Condition> conditions,
UrlAction action)

View File

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments;
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public class InputParser
{

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public enum LogicalGrouping
{

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public enum MatchType
{

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public enum PatternSyntax
{

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public enum RedirectType
{

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public static class RewriteTags
{

View File

@ -5,7 +5,7 @@ using System;
using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments;
using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public static class ServerVariables
{

View File

@ -8,20 +8,20 @@ using System.Linq;
using System.Xml;
using System.Xml.Linq;
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public class UrlRewriteFileParser
{
private readonly InputParser _inputParser = new InputParser();
public IList<UrlRewriteRule> Parse(TextReader reader)
public IList<IISUrlRewriteRule> Parse(TextReader reader)
{
var xmlDoc = XDocument.Load(reader, LoadOptions.SetLineInfo);
var xmlRoot = xmlDoc.Descendants(RewriteTags.Rewrite).FirstOrDefault();
if (xmlRoot != null)
{
var result = new List<UrlRewriteRule>();
var result = new List<IISUrlRewriteRule>();
// TODO Global rules are currently not treated differently than normal rules, fix.
// See: https://github.com/aspnet/BasicMiddleware/issues/59
ParseRules(xmlRoot.Descendants(RewriteTags.GlobalRules).FirstOrDefault(), result);
@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
return null;
}
private void ParseRules(XElement rules, IList<UrlRewriteRule> result)
private void ParseRules(XElement rules, IList<IISUrlRewriteRule> result)
{
if (rules == null)
{
@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
{
var builder = new UrlRewriteRuleBuilder();
ParseRuleAttributes(rule, builder);
if (builder.Enabled)
{
result.Add(builder.Build());
@ -121,7 +121,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
LogicalGrouping grouping;
if (!Enum.TryParse(conditions.Attribute(RewriteTags.MatchType)?.Value, out grouping))
{
grouping = LogicalGrouping.MatchAll;
grouping = LogicalGrouping.MatchAll;
}
bool trackingAllCaptures;

View File

@ -5,11 +5,10 @@ using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Rewrite.Internal.ModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.UrlActions;
using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches;
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
public class UrlRewriteRuleBuilder
{
@ -23,14 +22,14 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
private UrlAction _action;
private bool _matchAny;
public UrlRewriteRule Build()
public IISUrlRewriteRule Build()
{
if (_initialMatch == null || _action == null)
{
throw new InvalidOperationException("Cannot create UrlRewriteRule without action and match");
}
return new UrlRewriteRule(Name, _initialMatch, _conditions, _action);
return new IISUrlRewriteRule(Name, _initialMatch, _conditions, _action);
}
public void AddUrlAction(
@ -107,11 +106,11 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
}
var regex = new Regex(
pattern,
pattern,
ignoreCase ? RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.IgnoreCase :
RegexOptions.CultureInvariant | RegexOptions.Compiled,
RegexTimeout);
_conditions.Add(new Condition { Input = input, Match = new RegexMatch(regex, negate), OrNext = _matchAny });
break;
}

View File

@ -6,7 +6,7 @@ using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Http;
using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Rewrite.Internal.CodeRules
namespace Microsoft.AspNetCore.Rewrite.Internal
{
public class RedirectRule : Rule
{
@ -71,7 +71,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.CodeRules
var query = context.HttpContext.Request.QueryString.Add(
QueryString.FromUriComponent(
newPath.Substring(split)));
// not using the HttpContext.Response.redirect here because status codes may be 301, 302, 307, 308
// not using the HttpContext.Response.redirect here because status codes may be 301, 302, 307, 308
response.Headers[HeaderNames.Location] = pathBase + newPath.Substring(0, split) + query;
}
else

View File

@ -4,7 +4,7 @@
using System.Text;
using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Rewrite.Internal.CodeRules
namespace Microsoft.AspNetCore.Rewrite.Internal
{
public class RedirectToHttpsRule : Rule
{

View File

@ -6,7 +6,7 @@ using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
namespace Microsoft.AspNetCore.Rewrite.Internal.CodeRules
namespace Microsoft.AspNetCore.Rewrite.Internal
{
public class RewriteRule : Rule
{

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
{

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
{

View File

@ -2,9 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments;
using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions

View File

@ -33,14 +33,14 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
public RewriteAction(
RuleTermination result,
Pattern pattern,
bool queryStringAppend):
this (result,
bool queryStringAppend) :
this(result,
pattern,
queryStringAppend,
queryStringDelete: false,
escapeBackReferences: false)
{
}
public override void ApplyAction(RewriteContext context, MatchResults ruleMatch, MatchResults condMatch)

View File

@ -32,9 +32,9 @@ namespace Microsoft.AspNetCore.Rewrite
/// <param name="loggerFactory">The Logger Factory.</param>
/// <param name="options">The middleware options, containing the rules to apply.</param>
public RewriteMiddleware(
RequestDelegate next,
IHostingEnvironment hostingEnvironment,
ILoggerFactory loggerFactory,
RequestDelegate next,
IHostingEnvironment hostingEnvironment,
ILoggerFactory loggerFactory,
RewriteOptions options)
{
if (next == null)
@ -64,7 +64,9 @@ namespace Microsoft.AspNetCore.Rewrite
{
throw new ArgumentNullException(nameof(context));
}
var rewriteContext = new RewriteContext {
var rewriteContext = new RewriteContext
{
HttpContext = context,
StaticFileProvider = _fileProvider,
Logger = _logger,

View File

@ -3,13 +3,11 @@
using System;
using Microsoft.AspNetCore.Rewrite.Internal;
using Microsoft.AspNetCore.Rewrite.Internal.CodeRules;
using Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite;
namespace Microsoft.AspNetCore.Rewrite
{
/// <summary>
/// The builder to a list of rules for <see cref="RewriteOptions"/> and <see cref="RewriteMiddleware"/>
/// The builder to a list of rules for <see cref="RewriteOptions"/> and <see cref="RewriteMiddleware"/>
/// </summary>
public static class RewriteOptionsExtensions
{
@ -90,7 +88,7 @@ namespace Microsoft.AspNetCore.Rewrite
}
/// <summary>
/// Redirect a request to https if the incoming request is http, with returning a 301
/// Redirect a request to https if the incoming request is http, with returning a 301
/// status code for permanently redirected.
/// </summary>
/// <param name="options"></param>

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Rewrite.Internal.ModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite;
using Xunit;
namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Rewrite.Internal.ModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite;
using Xunit;
namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite

View File

@ -3,7 +3,7 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Rewrite.Internal.ModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite;
using Xunit;
namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite

View File

@ -3,7 +3,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Rewrite.Internal.ModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite;
using Xunit;
namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Rewrite.Internal.ModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite;
using Xunit;
namespace Microsoft.AspNetCore.Rewrite.Tests.ModRewrite

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Rewrite.Internal;
using Microsoft.AspNetCore.Rewrite.Internal.ModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments;
using Xunit;

View File

@ -5,10 +5,10 @@ using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Rewrite.Internal;
using Microsoft.AspNetCore.Rewrite.Internal.ModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.UrlActions;
using Microsoft.AspNetCore.Rewrite.Internal.UrlMatches;
using Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite;
using Xunit;
namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
</rules>
</rewrite>";
var expected = new List<UrlRewriteRule>();
var expected = new List<IISUrlRewriteRule>();
expected.Add(CreateTestRule(new List<Condition>(),
url: "^article/([0-9]+)/([_0-9a-z-]+)",
name: "Rewrite to article.aspx",
@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
Match = new RegexMatch(new Regex("^OFF$"), false)
});
var expected = new List<UrlRewriteRule>();
var expected = new List<IISUrlRewriteRule>();
expected.Add(CreateTestRule(condList,
url: "^article/([0-9]+)/([_0-9a-z-]+)",
name: "Rewrite to article.aspx",
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
Match = new RegexMatch(new Regex("^OFF$"), false)
});
var expected = new List<UrlRewriteRule>();
var expected = new List<IISUrlRewriteRule>();
expected.Add(CreateTestRule(condList,
url: "^article/([0-9]+)/([_0-9a-z-]+)",
name: "Rewrite to article.aspx",
@ -129,7 +129,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
}
// Creates a rule with appropriate default values of the url rewrite rule.
private UrlRewriteRule CreateTestRule(List<Condition> conditions,
private IISUrlRewriteRule CreateTestRule(List<Condition> conditions,
LogicalGrouping condGrouping = LogicalGrouping.MatchAll,
bool condTracking = false,
string name = "",
@ -146,12 +146,12 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
RedirectType redirectType = RedirectType.Permanent
)
{
return new UrlRewriteRule(name, new RegexMatch(new Regex("^OFF$"), false), conditions,
return new IISUrlRewriteRule(name, new RegexMatch(new Regex("^OFF$"), false), conditions,
new RewriteAction(RuleTermination.Continue, new InputParser().ParseInputString(url), queryStringAppend: false));
}
// TODO make rules comparable?
private void AssertUrlRewriteRuleEquality(IList<UrlRewriteRule> actual, IList<UrlRewriteRule> expected)
private void AssertUrlRewriteRuleEquality(IList<IISUrlRewriteRule> actual, IList<IISUrlRewriteRule> expected)
{
Assert.Equal(actual.Count, expected.Count);
for (var i = 0; i < actual.Count; i++)

View File

@ -3,7 +3,7 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite;
using Xunit;
namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite

View File

@ -5,7 +5,7 @@ using System;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Rewrite.Internal;
using Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite;
using Xunit;
namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite

View File

@ -4,7 +4,7 @@
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Rewrite.Internal;
using Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite;
using Microsoft.Net.Http.Headers;
using Xunit;

View File

@ -4,7 +4,7 @@
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite;
using Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite;
using Xunit;
namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite