Exceptions more descriptive and more NSE
This commit is contained in:
parent
65e7f7f44b
commit
51cd14efba
|
|
@ -44,6 +44,8 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
|
|||
switch (tokens[0])
|
||||
{
|
||||
case "RewriteBase":
|
||||
// the notion of the path base spans across all rules, not just mod_rewrite
|
||||
// So not implemented for now
|
||||
throw new NotImplementedException("RewriteBase is not implemented");
|
||||
case "RewriteCond":
|
||||
try
|
||||
|
|
@ -91,7 +93,8 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
|
|||
}
|
||||
break;
|
||||
case "RewriteMap":
|
||||
throw new NotImplementedException("RewriteMap to be added soon.");
|
||||
// Lack of use
|
||||
throw new NotImplementedException("RewriteMap are not implemented");
|
||||
case "RewriteEngine":
|
||||
// Explicitly do nothing here, no notion of turning on regex engine.
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -132,16 +132,19 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
|
|||
condition.Match = new IsFileMatch(input.Invert);
|
||||
break;
|
||||
case OperationType.SymbolicLink:
|
||||
throw new NotImplementedException("Symbolic links are not implemented");
|
||||
// TODO see if FileAttributes.ReparsePoint works for this?
|
||||
throw new NotImplementedException("Symbolic links are not supported because " +
|
||||
"of cross platform implementation");
|
||||
case OperationType.Size:
|
||||
condition.Match = new FileSizeMatch(input.Invert);
|
||||
break;
|
||||
case OperationType.ExistingUrl:
|
||||
throw new NotImplementedException("Existing Url lookups not implemented");
|
||||
throw new NotSupportedException("Existing Url lookups not supported because it requires a subrequest");
|
||||
case OperationType.Executable:
|
||||
throw new NotImplementedException("Executable Property search is not implemented");
|
||||
throw new NotSupportedException("Executable Property is not supported because Windows " +
|
||||
"requires a pinvoke to get this property");
|
||||
default:
|
||||
throw new ArgumentException("Invalid operation for property comparison.");
|
||||
throw new ArgumentException("Invalid operation for property comparison");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -166,7 +169,6 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
|
|||
Pattern pattern,
|
||||
Flags flags)
|
||||
{
|
||||
// first create pre conditions
|
||||
string flag;
|
||||
if (flags.GetValue(FlagType.Cookie, out flag))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,51 +38,51 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
|
|||
case "HTTP_FORWARDED":
|
||||
return new HeaderSegment("Forwarded");
|
||||
case "AUTH_TYPE":
|
||||
throw new NotImplementedException("Auth-Type server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the AUTH_TYPE server variable are not supported");
|
||||
case "CONN_REMOTE_ADDR":
|
||||
return new RemoteAddressSegment();
|
||||
case "CONTEXT_PREFIX":
|
||||
throw new NotImplementedException("Context-prefix server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the CONTEXT_PREFIX server variable are not supported");
|
||||
case "CONTEXT_DOCUMENT_ROOT":
|
||||
throw new NotImplementedException("Context-Document-Root server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the CONTEXT_DOCUMENT_ROOT server variable are not supported");
|
||||
case "IPV6":
|
||||
return new IsIPV6Segment();
|
||||
case "PATH_INFO":
|
||||
throw new NotImplementedException("Path-Info server variable is not supported");
|
||||
throw new NotImplementedException("Rules using the PATH_INFO server variable are not implemented");
|
||||
case "QUERY_STRING":
|
||||
return new QueryStringSegment();
|
||||
case "REMOTE_ADDR":
|
||||
return new RemoteAddressSegment();
|
||||
case "REMOTE_HOST":
|
||||
throw new NotImplementedException("Remote-Host server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the REMOTE_HOST server variable are not supported");
|
||||
case "REMOTE_IDENT":
|
||||
throw new NotImplementedException("Remote-Identity server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the REMOTE_IDENT server variable are not supported");
|
||||
case "REMOTE_PORT":
|
||||
return new RemotePortSegment();
|
||||
case "REMOTE_USER":
|
||||
throw new NotImplementedException("Remote-User server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the REMOTE_USER server variable are not supported");
|
||||
case "REQUEST_METHOD":
|
||||
return new RequestMethodSegment();
|
||||
case "SCRIPT_FILENAME":
|
||||
throw new NotImplementedException("Script-Filename server variable is not supported");
|
||||
return new RequestFileNameSegment();
|
||||
case "DOCUMENT_ROOT":
|
||||
throw new NotImplementedException("Document-Root server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the DOCUMENT_ROOT server variable are not supported");
|
||||
case "SCRIPT_GROUP":
|
||||
throw new NotImplementedException("Script-Group server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the SCRIPT_GROUP server variable are not supported");
|
||||
case "SCRIPT_USER":
|
||||
throw new NotImplementedException("Script-User server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the SCRIPT_USER server variable are not supported");
|
||||
case "SERVER_ADDR":
|
||||
return new LocalAddressSegment();
|
||||
case "SERVER_ADMIN":
|
||||
throw new NotImplementedException("Server-Admin server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the SERVER_ADMIN server variable are not supported");
|
||||
case "SERVER_NAME":
|
||||
throw new NotImplementedException("Server-Name server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the SERVER_NAME server variable are not supported");
|
||||
case "SERVER_PORT":
|
||||
return new LocalPortSegment();
|
||||
case "SERVER_PROTOCOL":
|
||||
return new ServerProtocolSegment();
|
||||
case "SERVER_SOFTWARE":
|
||||
throw new NotImplementedException("Server-Software server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the SERVER_SOFTWARE server variable are not supported");
|
||||
case "TIME_YEAR":
|
||||
return new DateTimeSegment(variable);
|
||||
case "TIME_MON":
|
||||
|
|
@ -100,13 +100,13 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
|
|||
case "TIME":
|
||||
return new DateTimeSegment(variable);
|
||||
case "API_VERSION":
|
||||
throw new NotImplementedException();
|
||||
throw new NotSupportedException();
|
||||
case "HTTPS":
|
||||
return new IsHttpsModSegment();
|
||||
case "HTTP2":
|
||||
throw new NotImplementedException("Http2 server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the HTTP2 server variable are not supported");
|
||||
case "IS_SUBREQ":
|
||||
throw new NotImplementedException("Is-Subrequest server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the IS_SUBREQ server variable are not supported");
|
||||
case "REQUEST_FILENAME":
|
||||
return new RequestFileNameSegment();
|
||||
case "REQUEST_SCHEME":
|
||||
|
|
@ -114,7 +114,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ModRewrite
|
|||
case "REQUEST_URI":
|
||||
return new UrlSegment();
|
||||
case "THE_REQUEST":
|
||||
throw new NotImplementedException("The-Request server variable is not supported");
|
||||
throw new NotSupportedException("Rules using the THE_REQUEST server variable are not supported");
|
||||
default:
|
||||
throw new FormatException(Resources.FormatError_InputParserUnrecognizedParameter(variable, context.Index));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
|
|||
public ChangeCookieAction(string cookie)
|
||||
{
|
||||
// TODO
|
||||
throw new NotImplementedException(cookie);
|
||||
throw new NotImplementedException("Changing the cookie is not implemented");
|
||||
}
|
||||
|
||||
public override void ApplyAction(RewriteContext context, MatchResults ruleMatch, MatchResults condMatch)
|
||||
{
|
||||
// modify the cookies
|
||||
|
||||
throw new NotImplementedException("Changing the cookie is not implemented");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
|
|||
public ChangeEnvironmentAction(string env)
|
||||
{
|
||||
// TODO
|
||||
throw new NotImplementedException();
|
||||
throw new NotImplementedException("Changing the environment is not implemented");
|
||||
}
|
||||
|
||||
public override void ApplyAction(RewriteContext context, MatchResults ruleMatch, MatchResults condMatch)
|
||||
{
|
||||
// Do stuff to modify the env
|
||||
throw new NotImplementedException();
|
||||
throw new NotImplementedException("Changing the environment is not implemented");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
|
|||
}
|
||||
case "UrlDecode":
|
||||
{
|
||||
throw new NotImplementedException("UrlDecode is not supported.");
|
||||
throw new NotImplementedException("UrlDecode is not implemented because of no great library available");
|
||||
}
|
||||
case "UrlEncode":
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
|
|||
{
|
||||
// TODO Add all server variables here.
|
||||
case "ALL_RAW":
|
||||
throw new NotImplementedException("All-Raw server variable not implemented");
|
||||
throw new NotSupportedException("Rules using the AUTH_TYPE server variable are not supported");
|
||||
case "APP_POOL_ID":
|
||||
throw new NotImplementedException("All-Pool-Id server variable not implemented");
|
||||
throw new NotSupportedException("Rules using the AUTH_TYPE server variable are not supported");
|
||||
case "CONTENT_LENGTH":
|
||||
return new HeaderSegment(HeaderNames.ContentLength);
|
||||
case "CONTENT_TYPE":
|
||||
|
|
@ -41,13 +41,13 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
|
|||
case "LOCAL_ADDR":
|
||||
return new LocalAddressSegment();
|
||||
case "HTTP_PROXY_CONNECTION":
|
||||
throw new NotSupportedException("Proxy Connections not supported");
|
||||
throw new NotSupportedException("Rules using the AUTH_TYPE server variable are not supported");
|
||||
case "QUERY_STRING":
|
||||
return new QueryStringSegment();
|
||||
case "REMOTE_ADDR":
|
||||
return new RemoteAddressSegment();
|
||||
case "REMOTE_HOST":
|
||||
throw new NotImplementedException("Remote-Host server variable not implemented");
|
||||
throw new NotSupportedException("Rules using the REMOTE_HOST server variable are not supported");
|
||||
case "REMOTE_PORT":
|
||||
return new RemotePortSegment();
|
||||
case "REQUEST_FILENAME":
|
||||
|
|
@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
|
|||
case "REQUEST_URI":
|
||||
return new UrlSegment();
|
||||
default:
|
||||
throw new FormatException("Unrecognized server variable.");
|
||||
throw new FormatException("Unrecognized server variable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,10 +53,9 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
|
|||
_action = new RedirectAction(statusCode, url, appendQueryString);
|
||||
break;
|
||||
case ActionType.AbortRequest:
|
||||
throw new NotImplementedException("Abort Requests are not supported");
|
||||
throw new NotImplementedException("Abort Requests are not implemented");
|
||||
case ActionType.CustomResponse:
|
||||
// TODO
|
||||
throw new NotImplementedException("Custom Responses are not supported");
|
||||
throw new NotImplementedException("Custom Responses are not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +78,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
|
|||
break;
|
||||
}
|
||||
case PatternSyntax.WildCard:
|
||||
throw new NotImplementedException("Wildcard syntax is not supported");
|
||||
throw new NotSupportedException("Wildcard syntax is not supported");
|
||||
case PatternSyntax.ExactMatch:
|
||||
_initialMatch = new ExactMatch(ignoreCase, input, negate);
|
||||
break;
|
||||
|
|
@ -132,7 +131,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlRewrite
|
|||
break;
|
||||
}
|
||||
case PatternSyntax.WildCard:
|
||||
throw new NotImplementedException("Wildcard syntax is not supported");
|
||||
throw new NotSupportedException("Wildcard syntax is not supported");
|
||||
case PatternSyntax.ExactMatch:
|
||||
if (pattern == null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue