Replaced System.Web.Routing with referencesources own implementation.
authorPablo Ruiz <pablo.ruiz@gmail.com>
Mon, 29 Feb 2016 17:59:05 +0000 (18:59 +0100)
committerPablo Ruiz <pablo.ruiz@gmail.com>
Wed, 2 Mar 2016 00:45:29 +0000 (01:45 +0100)
16 files changed:
mcs/class/System.Web.Routing/System.Web.Routing-net_4_x.csproj
mcs/class/System.Web.Routing/System.Web.Routing.dll.sources
mcs/class/System.Web/System.Web.Routing/HttpMethodConstraint.cs [deleted file]
mcs/class/System.Web/System.Web.Routing/PageRouteHandler.cs [deleted file]
mcs/class/System.Web/System.Web.Routing/PatternParser.cs [deleted file]
mcs/class/System.Web/System.Web.Routing/PatternToken.cs [deleted file]
mcs/class/System.Web/System.Web.Routing/PatternTokenType.cs [deleted file]
mcs/class/System.Web/System.Web.Routing/Route.cs [deleted file]
mcs/class/System.Web/System.Web.Routing/RouteCollection.cs [deleted file]
mcs/class/System.Web/System.Web.Routing/RouteValueDictionaryExtensions.cs [deleted file]
mcs/class/System.Web/System.Web.Routing/UrlRoutingHandler.cs [deleted file]
mcs/class/System.Web/System.Web.Routing/UrlRoutingModule.cs [deleted file]
mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs
mcs/class/System.Web/System.Web.UI/Util.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.dll.sources

index ce17132a1379db4f5358d52b2bb865a79508c2db..f398e0ea8e3e6414aac757942ca7518d37df4531 100644 (file)
@@ -46,7 +46,6 @@
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
     <Compile Include="..\..\build\common\Consts.cs" />\r
-    <Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index c030663c148c81734a972b51eaf0f05025a806d3..e49bef543921b8bbe347191d4ebda280e1a6b3bc 100644 (file)
@@ -1,3 +1,2 @@
 ../../build/common/Consts.cs
-../../build/common/MonoTODOAttribute.cs
 Assembly/AssemblyInfo.cs
diff --git a/mcs/class/System.Web/System.Web.Routing/HttpMethodConstraint.cs b/mcs/class/System.Web/System.Web.Routing/HttpMethodConstraint.cs
deleted file mode 100644 (file)
index c163c73..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// HttpMethodConstraint.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using System.Security.Permissions;
-using System.Web;
-
-namespace System.Web.Routing
-{
-       [TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
-       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-       public class HttpMethodConstraint : IRouteConstraint
-       {
-               public HttpMethodConstraint (params string[] allowedMethods)
-               {
-                       if (allowedMethods == null)
-                               throw new ArgumentNullException ("allowedMethods");
-                       AllowedMethods = allowedMethods;
-               }
-
-               public ICollection<string> AllowedMethods { get; private set; }
-
-               bool IRouteConstraint.Match (HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
-               {
-                       return Match (httpContext, route, parameterName, values, routeDirection);
-               }
-
-               protected virtual bool Match (HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
-               {
-                       if (httpContext == null)
-                               throw new ArgumentNullException ("httpContext");
-                       if (route == null)
-                               throw new ArgumentNullException ("route");
-                       if (parameterName == null)
-                               throw new ArgumentNullException ("parameterName");
-                       if (values == null)
-                               throw new ArgumentNullException ("values");
-
-                       switch (routeDirection) {
-                       case RouteDirection.IncomingRequest:
-                               // LAMESPEC: .NET allows case-insensitive comparison, which violates RFC 2616
-                               return AllowedMethods.Contains (httpContext.Request.HttpMethod);
-
-                       case RouteDirection.UrlGeneration:
-                               // See: aspnetwebstack's WebAPI equivalent for details.
-                               object method;
-
-                               if (!values.TryGetValue (parameterName, out method))
-                                       return true;
-
-                               // LAMESPEC: .NET allows case-insensitive comparison, which violates RFC 2616
-                               return AllowedMethods.Contains (Convert.ToString (method));
-
-                       default:
-                               throw new ArgumentException ("Invalid routeDirection: " + routeDirection);
-                       }
-               }
-       }
-}
diff --git a/mcs/class/System.Web/System.Web.Routing/PageRouteHandler.cs b/mcs/class/System.Web/System.Web.Routing/PageRouteHandler.cs
deleted file mode 100644 (file)
index b19e9b3..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// System.Web.Compilation.BuildManager
-//
-// Authors:
-//      Marek Habersack (mhabersack@novell.com)
-//
-// (C) 2009-2010 Novell, Inc (http://www.novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Text;
-using System.Web;
-using System.Web.UI;
-using System.Web.Compilation;
-
-namespace System.Web.Routing
-{
-       public class PageRouteHandler : IRouteHandler
-       {
-               public bool CheckPhysicalUrlAccess { get; private set; }
-               
-               public string VirtualPath { get; private set; }
-               
-               public PageRouteHandler (string virtualPath)
-                       : this (virtualPath, true)
-               {
-               }
-
-               public PageRouteHandler (string virtualPath, bool checkPhysicalUrlAccess)
-               {
-                       if (String.IsNullOrEmpty (virtualPath) || !virtualPath.StartsWith ("~/"))
-                               throw new ArgumentException ("VirtualPath must be a non empty string starting with ~/", "virtualPath");
-                       
-                       VirtualPath = virtualPath;
-                       CheckPhysicalUrlAccess = checkPhysicalUrlAccess;
-               }
-
-               [MonoTODO ("Implement checking physical URL access")]
-               public virtual IHttpHandler GetHttpHandler (RequestContext requestContext)
-               {
-                       if (requestContext == null)
-                               throw new ArgumentNullException ("requestContext");
-
-                       string vpath = GetSubstitutedVirtualPath (requestContext);
-                       int idx = vpath.IndexOf ('?');
-                       if (idx > -1)
-                               vpath = vpath.Substring (0, idx);
-
-                       if (String.IsNullOrEmpty (vpath))
-                               return null;
-                       
-                       return BuildManager.CreateInstanceFromVirtualPath (vpath, typeof (Page)) as IHttpHandler;
-               }
-
-               public string GetSubstitutedVirtualPath (RequestContext requestContext)
-               {
-                       if (requestContext == null)
-                               throw new ArgumentNullException ("requestContext");
-
-                       RouteData rd = requestContext.RouteData;
-                       Route route = rd != null ? rd.Route as Route: null;
-                       if (route == null)
-                               return VirtualPath;
-                       
-                       VirtualPathData vpd = new Route (VirtualPath.Substring (2), this).GetVirtualPath (requestContext, rd.Values);
-                       if (vpd == null)
-                               return VirtualPath;
-
-                       return "~/" + vpd.VirtualPath;
-               }
-       }
-}
diff --git a/mcs/class/System.Web/System.Web.Routing/PatternParser.cs b/mcs/class/System.Web/System.Web.Routing/PatternParser.cs
deleted file mode 100644 (file)
index 080a7bf..0000000
+++ /dev/null
@@ -1,721 +0,0 @@
-//
-// PatternParser.cs
-//
-// Author:
-//      Atsushi Enomoto <atsushi@ximian.com>
-//      Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2008-2010 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections.Generic;
-using System.Security.Permissions;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Web;
-using System.Web.Util;
-using System.Diagnostics;
-using System.Globalization;
-
-namespace System.Web.Routing
-{
-       sealed class PatternParser
-       {
-               struct PatternSegment
-               {
-                       public bool AllLiteral;
-                       public List <PatternToken> Tokens;
-               }
-               
-               static readonly char[] placeholderDelimiters = { '{', '}' };
-               
-               PatternSegment[] segments;
-               Dictionary <string, bool> parameterNames;
-               PatternToken[] tokens;
-               
-               int segmentCount;
-               bool haveSegmentWithCatchAll;
-               
-               public string Url {
-                       get;
-                       private set;
-               }
-               
-               public PatternParser (string pattern)
-               {
-                       this.Url = pattern;
-                       Parse ();
-               }
-
-               void Parse ()
-               {
-                       string url = Url;
-                       parameterNames = new Dictionary <string, bool> (StringComparer.OrdinalIgnoreCase);
-                       
-                       if (!String.IsNullOrEmpty (url)) {
-                               if (url [0] == '~' || url [0] == '/')
-                                       throw new ArgumentException ("Url must not start with '~' or '/'");
-                               if (url.IndexOf ('?') >= 0)
-                                       throw new ArgumentException ("Url must not contain '?'");
-                       } else {
-                               segments = new PatternSegment [0];
-                               tokens = new PatternToken [0];
-                               return;
-                       }
-                       
-                       string[] parts = url.Split ('/');
-                       int partsCount = segmentCount = parts.Length;
-                       var allTokens = new List <PatternToken> ();
-                       PatternToken tmpToken;
-                       
-                       segments = new PatternSegment [partsCount];
-                       
-                       for (int i = 0; i < partsCount; i++) {
-                               if (haveSegmentWithCatchAll)
-                                       throw new ArgumentException ("A catch-all parameter can only appear as the last segment of the route URL");
-                               
-                               int catchAlls = 0;
-                               string part = parts [i];
-                               int partLength = part.Length;
-                               var tokens = new List <PatternToken> ();
-
-                               if (partLength == 0 && i < partsCount - 1)
-                                       throw new ArgumentException ("Consecutive URL segment separators '/' are not allowed");
-
-                               if (part.IndexOf ("{}") != -1)
-                                       throw new ArgumentException ("Empty URL parameter name is not allowed");
-
-                               if (i > 0)
-                                       allTokens.Add (null);
-                               
-                               if (part.IndexOfAny (placeholderDelimiters) == -1) {
-                                       // no placeholders here, short-circuit it
-                                       tmpToken = new PatternToken (PatternTokenType.Literal, part);
-                                       tokens.Add (tmpToken);
-                                       allTokens.Add (tmpToken);
-                                       segments [i].AllLiteral = true;
-                                       segments [i].Tokens = tokens;
-                                       continue;
-                               }
-
-                               string tmp;
-                               int from = 0, start;
-                               bool allLiteral = true;
-                               while (from < partLength) {
-                                       start = part.IndexOf ('{', from);
-                                       if (start >= partLength - 2)
-                                               throw new ArgumentException ("Unterminated URL parameter. It must contain matching '}'");
-
-                                       if (start < 0) {
-                                               if (part.IndexOf ('}', from) >= from)
-                                                       throw new ArgumentException ("Unmatched URL parameter closer '}'. A corresponding '{' must precede");
-                                               tmp = part.Substring (from);
-                                               tmpToken = new PatternToken (PatternTokenType.Literal, tmp);
-                                               tokens.Add (tmpToken);
-                                               allTokens.Add (tmpToken);
-                                               from += tmp.Length;
-                                               break;
-                                       }
-
-                                       if (from == 0 && start > 0) {
-                                               tmpToken = new PatternToken (PatternTokenType.Literal, part.Substring (0, start));
-                                               tokens.Add (tmpToken);
-                                               allTokens.Add (tmpToken);
-                                       }
-                                       
-                                       int end = part.IndexOf ('}', start + 1);
-                                       int next = part.IndexOf ('{', start + 1);
-                                       
-                                       if (end < 0 || next >= 0 && next < end)
-                                               throw new ArgumentException ("Unterminated URL parameter. It must contain matching '}'");
-                                       if (next == end + 1)
-                                               throw new ArgumentException ("Two consecutive URL parameters are not allowed. Split into a different segment by '/', or a literal string.");
-
-                                       if (next == -1)
-                                               next = partLength;
-                                       
-                                       string token = part.Substring (start + 1, end - start - 1);
-                                       PatternTokenType type;
-                                       if (token [0] == '*') {
-                                               catchAlls++;
-                                               haveSegmentWithCatchAll = true;
-                                               type = PatternTokenType.CatchAll;
-                                               token = token.Substring (1);
-                                       } else
-                                               type = PatternTokenType.Standard;
-
-                                       if (!parameterNames.ContainsKey (token))
-                                               parameterNames.Add (token, true);
-
-                                       tmpToken = new PatternToken (type, token);
-                                       tokens.Add (tmpToken);
-                                       allTokens.Add (tmpToken);
-                                       allLiteral = false;
-                                       
-                                       if (end < partLength - 1) {
-                                               token = part.Substring (end + 1, next - end - 1);
-                                               tmpToken = new PatternToken (PatternTokenType.Literal, token);
-                                               tokens.Add (tmpToken);
-                                               allTokens.Add (tmpToken);
-                                               end += token.Length;
-                                       }
-
-                                       if (catchAlls > 1 || (catchAlls == 1 && tokens.Count > 1))
-                                               throw new ArgumentException ("A path segment that contains more than one section, such as a literal section or a parameter, cannot contain a catch-all parameter.");
-                                       from = end + 1;
-                               }
-                               
-                               segments [i].AllLiteral = allLiteral;
-                               segments [i].Tokens = tokens;
-                       }
-
-                       if (allTokens.Count > 0)
-                               this.tokens = allTokens.ToArray ();
-                       allTokens = null;
-               }
-
-               RouteValueDictionary AddDefaults (RouteValueDictionary dict, RouteValueDictionary defaults)
-               {
-                       if (defaults != null && defaults.Count > 0) {
-                               string key;
-                               foreach (var def in defaults) {
-                                       key = def.Key;
-                                       if (dict.ContainsKey (key))
-                                               continue;
-                                       dict.Add (key, def.Value);
-                               }
-                       }
-
-                       return dict;
-               }
-
-               static bool ParametersAreEqual (object a, object b)
-               {
-                       if (a is string && b is string) {
-                               return String.Equals (a as string, b as string, StringComparison.OrdinalIgnoreCase);
-                       } else {
-                               // Parameter may be a boxed value type, need to use .Equals() for comparison
-                               return object.Equals (a, b);
-                       }
-               }
-
-               static bool ParameterIsNonEmpty (object param)
-               {
-                       if (param is string)
-                               return !string.IsNullOrEmpty (param as string);
-
-                       return param != null;
-               }
-
-               bool IsParameterRequired (string parameterName, RouteValueDictionary defaultValues, out object defaultValue)
-               {
-                       foreach (var token in tokens) {
-                               if (token == null)
-                                       continue;
-
-                               if (string.Equals (token.Name, parameterName, StringComparison.OrdinalIgnoreCase)) {
-                                       if (token.Type == PatternTokenType.CatchAll) {
-                                               defaultValue = null;
-                                               return false;
-                                       }
-                               }
-                       }
-
-                       if (defaultValues == null)
-                               throw new ArgumentNullException ("defaultValues is null?!");
-
-                       return !defaultValues.TryGetValue (parameterName, out defaultValue);
-               }
-
-               static string EscapeReservedCharacters (Match m)
-               {
-                       if (m == null)
-                               throw new ArgumentNullException("m");
-
-                       return Uri.HexEscape (m.Value[0]);
-               }
-
-               static string UriEncode (string str)
-               {
-                       if (string.IsNullOrEmpty (str))
-                               return str;
-
-                       string escape = Uri.EscapeUriString (str);
-                       return Regex.Replace (escape, "([#?])", new MatchEvaluator (EscapeReservedCharacters));
-               }
-
-               bool MatchSegment (int segIndex, int argsCount, string[] argSegs, List <PatternToken> tokens, RouteValueDictionary ret)
-               {
-                       string pathSegment = argSegs [segIndex];
-                       int pathSegmentLength = pathSegment != null ? pathSegment.Length : -1;
-                       int startIndex = pathSegmentLength - 1;
-                       PatternTokenType tokenType;
-                       int tokensCount = tokens.Count;
-                       PatternToken token;
-                       string tokenName;
-
-                       for (int tokenIndex = tokensCount - 1; tokenIndex > -1; tokenIndex--) {
-                               token = tokens [tokenIndex];
-                               if (startIndex < 0)
-                                       return false;
-
-                               tokenType = token.Type;
-                               tokenName = token.Name;
-
-                               if (segIndex > segmentCount - 1 || tokenType == PatternTokenType.CatchAll) {
-                                       var sb = new StringBuilder ();
-
-                                       for (int j = segIndex; j < argsCount; j++) {
-                                               if (j > segIndex)
-                                                       sb.Append ('/');
-                                               sb.Append (argSegs [j]);
-                                       }
-                                               
-                                       ret.Add (tokenName, sb.ToString ());
-                                       break;
-                               }
-
-                               int scanIndex;
-                               if (token.Type == PatternTokenType.Literal) {
-                                       int nameLen = tokenName.Length;
-                                       if (startIndex + 1 < nameLen)
-                                               return false;
-                                       scanIndex = startIndex - nameLen + 1;
-                                       if (String.Compare (pathSegment, scanIndex, tokenName, 0, nameLen, StringComparison.OrdinalIgnoreCase) != 0)
-                                               return false;
-                                       startIndex = scanIndex - 1;
-                                       continue;
-                               }
-
-                               // Standard token
-                               int nextTokenIndex = tokenIndex - 1;
-                               if (nextTokenIndex < 0) {
-                                       // First token
-                                       ret.Add (tokenName, pathSegment.Substring (0, startIndex + 1));
-                                       continue;
-                               }
-
-                               if (startIndex == 0)
-                                       return false;
-                               
-                               var nextToken = tokens [nextTokenIndex];
-                               string nextTokenName = nextToken.Name;
-
-                               // Skip one char, since there can be no empty segments and if the
-                               // current token's value happens to be the same as preceeding
-                               // literal text, we'll save some time and complexity.
-                               scanIndex = startIndex - 1;
-                               int lastIndex = pathSegment.LastIndexOf (nextTokenName, scanIndex, StringComparison.OrdinalIgnoreCase);
-                               if (lastIndex == -1)
-                                       return false;
-
-                               lastIndex += nextTokenName.Length - 1;
-                                               
-                               string sectionValue = pathSegment.Substring (lastIndex + 1, startIndex - lastIndex);
-                               if (String.IsNullOrEmpty (sectionValue))
-                                       return false;
-
-                               ret.Add (tokenName, sectionValue);
-                               startIndex = lastIndex;
-                       }
-                       
-                       return true;
-               }
-
-               public RouteValueDictionary Match (string path, RouteValueDictionary defaults)
-               {
-                       var ret = new RouteValueDictionary ();
-                       string url = Url;
-                       string [] argSegs;
-                       int argsCount;
-                       
-                       if (String.IsNullOrEmpty (path)) {
-                               argSegs = null;
-                               argsCount = 0;
-                       } else {
-                               // quick check
-                               if (String.Compare (url, path, StringComparison.Ordinal) == 0 && url.IndexOf ('{') < 0)
-                                       return AddDefaults (ret, defaults);
-
-                               argSegs = path.Split ('/');
-                               argsCount = argSegs.Length;
-
-                               if (String.IsNullOrEmpty (argSegs [argsCount - 1]))
-                                       argsCount--; // path ends with a trailinig '/'
-                       }
-                       bool haveDefaults = defaults != null && defaults.Count > 0;
-
-                       if (argsCount == 1 && String.IsNullOrEmpty (argSegs [0]))
-                               argsCount = 0;
-                       
-                       if (!haveDefaults && ((haveSegmentWithCatchAll && argsCount < segmentCount) || (!haveSegmentWithCatchAll && argsCount != segmentCount)))
-                               return null;
-
-                       int i = 0;
-
-                       foreach (PatternSegment segment in segments) {
-                               if (i >= argsCount)
-                                       break;
-                               
-                               if (segment.AllLiteral) {
-                                       if (String.Compare (argSegs [i], segment.Tokens [0].Name, StringComparison.OrdinalIgnoreCase) != 0)
-                                               return null;
-                                       i++;
-                                       continue;
-                               }
-
-                               if (!MatchSegment (i, argsCount, argSegs, segment.Tokens, ret))
-                                       return null;
-                               i++;
-                       }
-
-                       // Check the remaining segments, if any, and see if they are required
-                       //
-                       // If a segment has more than one section (i.e. there's at least one
-                       // literal, then it cannot match defaults
-                       //
-                       // All of the remaining segments must have all defaults provided and they
-                       // must not be literals or the match will fail.
-                       if (i < segmentCount) {
-                               if (!haveDefaults)
-                                       return null;
-                               
-                               for (;i < segmentCount; i++) {
-                                       var segment = segments [i];
-                                       if (segment.AllLiteral)
-                                               return null;
-                                       
-                                       var tokens = segment.Tokens;
-                                       if (tokens.Count != 1)
-                                               return null;
-
-                                       // if token is catch-all, we're done.
-                                       if (tokens [0].Type == PatternTokenType.CatchAll)
-                                               break;
-
-                                       if (!defaults.ContainsKey (tokens [0].Name))
-                                               return null;
-                               }
-                       } else if (!haveSegmentWithCatchAll && argsCount > segmentCount)
-                               return null;
-                       
-                       return AddDefaults (ret, defaults);
-               }
-               
-               public string BuildUrl (Route route, RequestContext requestContext, RouteValueDictionary userValues, RouteValueDictionary constraints, out RouteValueDictionary usedValues)
-               {
-                       usedValues = null;
-
-                       if (requestContext == null)
-                               return null;
-
-                       RouteData routeData = requestContext.RouteData;
-                       var currentValues = routeData.Values ?? new RouteValueDictionary ();
-                       var values = userValues ?? new RouteValueDictionary ();
-                       var defaultValues = (route != null ? route.Defaults : null) ?? new RouteValueDictionary ();
-
-                       // The set of values we should be using when generating the URL in this route
-                       var acceptedValues = new RouteValueDictionary ();
-
-                       // Keep track of which new values have been used
-                       HashSet<string> unusedNewValues = new HashSet<string> (values.Keys, StringComparer.OrdinalIgnoreCase);
-
-                       // This route building logic is based on System.Web.Http's Routing code (which is Apache Licensed by MS)
-                       // and which can be found at mono's external/aspnetwebstack/src/System.Web.Http/Routing/HttpParsedRoute.cs
-                       // Hopefully this will ensure a much higher compatiblity with MS.NET's System.Web.Routing logic. (pruiz)
-
-                       #region Step 1: Get the list of values we're going to use to match and generate this URL
-                       // Find out which entries in the URL are valid for the URL we want to generate.
-                       // If the URL had ordered parameters a="1", b="2", c="3" and the new values
-                       // specified that b="9", then we need to invalidate everything after it. The new
-                       // values should then be a="1", b="9", c=<no value>.
-                       foreach (var item in parameterNames) {
-                               var parameterName = item.Key;
-
-                               object newParameterValue;
-                               bool hasNewParameterValue = values.TryGetValue (parameterName, out newParameterValue);
-                               if (hasNewParameterValue) {
-                                       unusedNewValues.Remove(parameterName);
-                               }
-
-                               object currentParameterValue;
-                               bool hasCurrentParameterValue = currentValues.TryGetValue (parameterName, out currentParameterValue);
-
-                               if (hasNewParameterValue && hasCurrentParameterValue) {
-                                       if (!ParametersAreEqual (currentParameterValue, newParameterValue)) {
-                                               // Stop copying current values when we find one that doesn't match
-                                               break;
-                                       }
-                               }
-
-                               // If the parameter is a match, add it to the list of values we will use for URL generation
-                               if (hasNewParameterValue) {
-                                       if (ParameterIsNonEmpty (newParameterValue)) {
-                                               acceptedValues.Add (parameterName, newParameterValue);
-                                       }
-                               }
-                               else {
-                                       if (hasCurrentParameterValue) {
-                                               acceptedValues.Add (parameterName, currentParameterValue);
-                                       }
-                               }
-                       }
-
-                       // Add all remaining new values to the list of values we will use for URL generation
-                       foreach (var newValue in values) {
-                               if (ParameterIsNonEmpty (newValue.Value) && !acceptedValues.ContainsKey (newValue.Key)) {
-                                       acceptedValues.Add (newValue.Key, newValue.Value);
-                               }
-                       }
-
-                       // Add all current values that aren't in the URL at all
-                       foreach (var currentValue in currentValues) {
-                               if (!acceptedValues.ContainsKey (currentValue.Key) && !parameterNames.ContainsKey (currentValue.Key)) {
-                                       acceptedValues.Add (currentValue.Key, currentValue.Value);
-                               }
-                       }
-
-                       // Add all remaining default values from the route to the list of values we will use for URL generation
-                       foreach (var item in parameterNames) {
-                               object defaultValue;
-                               if (!acceptedValues.ContainsKey (item.Key) && !IsParameterRequired (item.Key, defaultValues, out defaultValue)) {
-                                       // Add the default value only if there isn't already a new value for it and
-                                       // only if it actually has a default value, which we determine based on whether
-                                       // the parameter value is required.
-                                       acceptedValues.Add (item.Key, defaultValue);
-                               }
-                       }
-
-                       // All required parameters in this URL must have values from somewhere (i.e. the accepted values)
-                       foreach (var item in parameterNames) {
-                               object defaultValue;
-                               if (IsParameterRequired (item.Key, defaultValues, out defaultValue) && !acceptedValues.ContainsKey (item.Key)) {
-                                       // If the route parameter value is required that means there's
-                                       // no default value, so if there wasn't a new value for it
-                                       // either, this route won't match.
-                                       return null;
-                               }
-                       }
-
-                       // All other default values must match if they are explicitly defined in the new values
-                       var otherDefaultValues = new RouteValueDictionary (defaultValues);
-                       foreach (var item in parameterNames) {
-                               otherDefaultValues.Remove (item.Key);
-                       }
-
-                       foreach (var defaultValue in otherDefaultValues) {
-                               object value;
-                               if (values.TryGetValue (defaultValue.Key, out value)) {
-                                       unusedNewValues.Remove (defaultValue.Key);
-                                       if (!ParametersAreEqual (value, defaultValue.Value)) {
-                                               // If there is a non-parameterized value in the route and there is a
-                                               // new value for it and it doesn't match, this route won't match.
-                                               return null;
-                                       }
-                               }
-                       }
-                       #endregion
-
-                       #region Step 2: If the route is a match generate the appropriate URL
-
-                       var uri = new StringBuilder ();
-                       var pendingParts = new StringBuilder ();
-                       var pendingPartsAreAllSafe = false;
-                       bool blockAllUriAppends = false;
-                       var allSegments = new List<PatternSegment?> ();
-
-                       // Build a list of segments plus separators we can use as template.
-                       foreach (var segment in segments) {
-                               if (allSegments.Count > 0)
-                                       allSegments.Add (null); // separator exposed as null.
-                               allSegments.Add (segment);
-                       }
-
-                       // Finally loop thru al segment-templates building the actual uri.
-                       foreach (var item in allSegments) {
-                               var segment = item.GetValueOrDefault ();
-
-                               // If segment is a separator..
-                               if (item == null) {
-                                       if (pendingPartsAreAllSafe) {
-                                               // Accept
-                                               if (pendingParts.Length > 0) {
-                                                       if (blockAllUriAppends)
-                                                               return null;
-
-                                                       // Append any pending literals to the URL
-                                                       uri.Append (pendingParts.ToString ());
-                                                       pendingParts.Length = 0;
-                                               }
-                                       }
-                                       pendingPartsAreAllSafe = false;
-
-                                       // Guard against appending multiple separators for empty segments
-                                       if (pendingParts.Length > 0 && pendingParts[pendingParts.Length - 1] == '/') {
-                                               // Dev10 676725: Route should not be matched if that causes mismatched tokens
-                                               // Dev11 86819: We will allow empty matches if all subsequent segments are null
-                                               if (blockAllUriAppends)
-                                                       return null;
-
-                                               // Append any pending literals to the URI (without the trailing slash) and prevent any future appends
-                                               uri.Append(pendingParts.ToString (0, pendingParts.Length - 1));
-                                               pendingParts.Length = 0;
-                                       } else {
-                                               pendingParts.Append ("/");
-                                       }
-#if false
-                               } else if (segment.AllLiteral) {
-                                       // Spezial (optimized) case: all elements of segment are literals.
-                                       pendingPartsAreAllSafe = true;
-                                       foreach (var tk in segment.Tokens)
-                                               pendingParts.Append (tk.Name);
-#endif
-                               } else {
-                                       // Segments are treated as all-or-none. We should never output a partial segment.
-                                       // If we add any subsegment of this segment to the generated URL, we have to add
-                                       // the complete match. For example, if the subsegment is "{p1}-{p2}.xml" and we
-                                       // used a value for {p1}, we have to output the entire segment up to the next "/".
-                                       // Otherwise we could end up with the partial segment "v1" instead of the entire
-                                       // segment "v1-v2.xml".
-                                       bool addedAnySubsegments = false;
-
-                                       foreach (var token in segment.Tokens) {
-                                               if (token.Type == PatternTokenType.Literal) {
-                                                       // If it's a literal we hold on to it until we are sure we need to add it
-                                                       pendingPartsAreAllSafe = true;
-                                                       pendingParts.Append (token.Name);
-                                               } else {
-                                                       if (token.Type == PatternTokenType.Standard || token.Type == PatternTokenType.CatchAll) {
-                                                               if (pendingPartsAreAllSafe) {
-                                                                       // Accept
-                                                                       if (pendingParts.Length > 0) {
-                                                                               if (blockAllUriAppends)
-                                                                                       return null;
-
-                                                                               // Append any pending literals to the URL
-                                                                               uri.Append (pendingParts.ToString ());
-                                                                               pendingParts.Length = 0;
-
-                                                                               addedAnySubsegments = true;
-                                                                       }
-                                                               }
-                                                               pendingPartsAreAllSafe = false;
-
-                                                               // If it's a parameter, get its value
-                                                               object acceptedParameterValue;
-                                                               bool hasAcceptedParameterValue = acceptedValues.TryGetValue (token.Name, out acceptedParameterValue);
-                                                               if (hasAcceptedParameterValue)
-                                                                       unusedNewValues.Remove (token.Name);
-
-                                                               object defaultParameterValue;
-                                                               defaultValues.TryGetValue (token.Name, out defaultParameterValue);
-
-                                                               if (ParametersAreEqual (acceptedParameterValue, defaultParameterValue)) {
-                                                                       // If the accepted value is the same as the default value, mark it as pending since
-                                                                       // we won't necessarily add it to the URL we generate.
-                                                                       pendingParts.Append (Convert.ToString (acceptedParameterValue, CultureInfo.InvariantCulture));
-                                                               } else {
-                                                                       if (blockAllUriAppends)
-                                                                               return null;
-
-                                                                       // Add the new part to the URL as well as any pending parts
-                                                                       if (pendingParts.Length > 0) {
-                                                                               // Append any pending literals to the URL
-                                                                               uri.Append (pendingParts.ToString ());
-                                                                               pendingParts.Length = 0;
-                                                                       }
-                                                                       uri.Append (Convert.ToString (acceptedParameterValue, CultureInfo.InvariantCulture));
-
-                                                                       addedAnySubsegments = true;
-                                                               }
-                                                       } else {
-                                                               Debug.Fail ("Invalid path subsegment type");
-                                                       }
-                                               }
-                                       }
-
-                                       if (addedAnySubsegments) {
-                                               // See comment above about why we add the pending parts
-                                               if (pendingParts.Length > 0) {
-                                                       if (blockAllUriAppends)
-                                                               return null;
-
-                                                       // Append any pending literals to the URL
-                                                       uri.Append (pendingParts.ToString ());
-                                                       pendingParts.Length = 0;
-                                               }
-                                       }
-                               }
-                       }
-
-                       if (pendingPartsAreAllSafe) {
-                               // Accept
-                               if (pendingParts.Length > 0) {
-                                       if (blockAllUriAppends)
-                                               return null;
-
-                                       // Append any pending literals to the URI
-                                       uri.Append (pendingParts.ToString ());
-                               }
-                       }
-
-                       // Process constraints keys
-                       if (constraints != null) {
-                               // If there are any constraints, mark all the keys as being used so that we don't
-                               // generate query string items for custom constraints that don't appear as parameters
-                               // in the URI format.
-                               foreach (var constraintsItem in constraints) {
-                                       unusedNewValues.Remove (constraintsItem.Key);
-                               }
-                       }
-
-                       // Encode the URI before we append the query string, otherwise we would double encode the query string
-                       var encodedUri = new StringBuilder ();
-                       encodedUri.Append (UriEncode (uri.ToString ()));
-                       uri = encodedUri;
-
-                       // Add remaining new values as query string parameters to the URI
-                       if (unusedNewValues.Count > 0) {
-                               // Generate the query string
-                               bool firstParam = true;
-                               foreach (string unusedNewValue in unusedNewValues) {
-                                       object value;
-                                       if (acceptedValues.TryGetValue (unusedNewValue, out value)) {
-                                               uri.Append (firstParam ? '?' : '&');
-                                               firstParam = false;
-                                               uri.Append (Uri.EscapeDataString (unusedNewValue));
-                                               uri.Append ('=');
-                                               uri.Append (Uri.EscapeDataString (Convert.ToString (value, CultureInfo.InvariantCulture)));
-                                       }
-                               }
-                       }
-
-                       #endregion
-
-                       usedValues = acceptedValues;
-                       return uri.ToString();
-               }
-       }
-}
-
diff --git a/mcs/class/System.Web/System.Web.Routing/PatternToken.cs b/mcs/class/System.Web/System.Web.Routing/PatternToken.cs
deleted file mode 100644 (file)
index 5f40cee..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// PatternToken.cs
-//
-// Author:
-//     Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2009 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Text;
-using System.Web;
-
-namespace System.Web.Routing
-{
-       sealed class PatternToken
-       {
-               public PatternTokenType Type {
-                       get;
-                       private set;
-               }
-
-               public string Name {
-                       get;
-                       private set;
-               }
-
-               public PatternToken (PatternTokenType type, string name)
-               {
-                       this.Type = type;
-                       this.Name = name;
-               }
-
-               public override string ToString ()
-               {
-                       StringBuilder sb = new StringBuilder ();
-
-                       switch (Type) {
-                               case PatternTokenType.Standard:
-                                       sb.Append ("PatternToken_Standard");
-                                       break;
-
-                               case PatternTokenType.Literal:
-                                       sb.Append ("PatternToken_Literal");
-                                       break;
-
-                               case PatternTokenType.CatchAll:
-                                       sb.Append ("PatternToken_CatchAll");
-                                       break;
-
-                               default:
-                                       sb.Append ("PatternToken_UNKNOWN");
-                                       break;
-                       }
-
-                       sb.AppendFormat (" [Name = '{0}']", Name);
-
-                       return sb.ToString ();
-               }
-       }
-}
diff --git a/mcs/class/System.Web/System.Web.Routing/PatternTokenType.cs b/mcs/class/System.Web/System.Web.Routing/PatternTokenType.cs
deleted file mode 100644 (file)
index 7321ca1..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// PatternTokenType.cs
-//
-// Author:
-//     Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2009 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace System.Web.Routing
-{
-       enum PatternTokenType
-       {
-               Standard,
-               Literal,
-               CatchAll
-       }
-}
diff --git a/mcs/class/System.Web/System.Web.Routing/Route.cs b/mcs/class/System.Web/System.Web.Routing/Route.cs
deleted file mode 100644 (file)
index 0e28483..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-//
-// Route.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Runtime.CompilerServices;
-using System.Security.Permissions;
-using System.Text.RegularExpressions;
-using System.Web;
-using System.Globalization;
-
-namespace System.Web.Routing
-{
-       [TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
-       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-       public class Route : RouteBase
-       {
-               static readonly Type httpRequestBaseType = typeof (HttpRequestBase);
-               PatternParser url;
-
-               public RouteValueDictionary Constraints { get; set; }
-
-               public RouteValueDictionary DataTokens { get; set; }
-
-               public RouteValueDictionary Defaults { get; set; }
-
-               public IRouteHandler RouteHandler { get; set; }
-
-               public string Url {
-                       get { return url != null ? url.Url : String.Empty; }
-                       set { url = value != null ? new PatternParser (value) : new PatternParser (String.Empty); }
-               }
-
-               public Route (string url, IRouteHandler routeHandler)
-                       : this (url, null, routeHandler)
-               {
-               }
-
-               public Route (string url, RouteValueDictionary defaults, IRouteHandler routeHandler)
-                       : this (url, defaults, null, routeHandler)
-               {
-               }
-
-               public Route (string url, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteHandler routeHandler)
-                       : this (url, defaults, constraints, null, routeHandler)
-               {
-               }
-
-               public Route (string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler)
-               {
-                       Url = url;
-                       Defaults = defaults;
-                       Constraints = constraints;
-                       DataTokens = dataTokens;
-                       RouteHandler = routeHandler;
-               }
-
-               public override RouteData GetRouteData (HttpContextBase httpContext)
-               {
-                       var path = httpContext.Request.AppRelativeCurrentExecutionFilePath;
-                       var pathInfo = httpContext.Request.PathInfo;
-
-                       if (!String.IsNullOrEmpty (pathInfo))
-                               path += pathInfo;
-
-                       // probably code like this causes ArgumentOutOfRangeException under .NET.
-                       // It somehow allows such path that is completely equivalent to the Url. Dunno why.
-                       if (Url != path && path.Substring (0, 2) != "~/")
-                               return null;
-                       path = path.Substring (2);
-
-                       var values = url.Match (path, Defaults);
-                       if (values == null)
-                               return null;
-
-                       if (!ProcessConstraints (httpContext, values, RouteDirection.IncomingRequest))
-                               return null;
-                       
-                       var rd = new RouteData (this, RouteHandler);
-                       RouteValueDictionary rdValues = rd.Values;
-                       
-                       foreach (var p in values)
-                               rdValues.Add (p.Key, p.Value);
-
-                       RouteValueDictionary dataTokens = DataTokens;
-                       if (dataTokens != null) {
-                               RouteValueDictionary rdDataTokens = rd.DataTokens;
-                               foreach (var token in dataTokens)
-                                       rdDataTokens.Add (token.Key, token.Value);
-                       }
-                       
-                       return rd;
-               }
-
-               public override VirtualPathData GetVirtualPath (RequestContext requestContext, RouteValueDictionary values)
-               {
-                       if (requestContext == null)
-                               throw new ArgumentNullException ("requestContext");
-                       if (url == null)
-                               return new VirtualPathData (this, String.Empty);
-
-                       // null values is allowed.
-                       // if (values == null)
-                       //      values = requestContext.RouteData.Values;
-
-                       RouteValueDictionary usedValues;
-                       string resultUrl = url.BuildUrl (this, requestContext, values, Constraints, out usedValues);
-
-                       if (resultUrl == null)
-                               return null;
-
-                       if (!ProcessConstraints (requestContext.HttpContext, usedValues, RouteDirection.UrlGeneration))
-                               return null;
-
-                       var result = new VirtualPathData (this, resultUrl);
-
-                       RouteValueDictionary dataTokens = DataTokens;
-                       if (dataTokens != null) {
-                               foreach (var item in dataTokens)
-                                       result.DataTokens[item.Key] = item.Value;
-                       }
-
-                       return result;
-               }
-
-               private bool ProcessConstraintInternal (HttpContextBase httpContext, Route route, object constraint, string parameterName,
-                                                               RouteValueDictionary values, RouteDirection routeDirection, RequestContext reqContext,
-                                                               out bool invalidConstraint)
-               {
-                       invalidConstraint = false;
-                       IRouteConstraint irc = constraint as IRouteConstraint;
-                       if (irc != null)
-                               return irc.Match (httpContext, route, parameterName, values, routeDirection);
-
-                       string s = constraint as string;
-                       if (s != null) {
-                               string v = null;
-                               object o;
-
-                               // NOTE: If constraint was not an IRouteConstraint, is is asumed
-                               // to be an object 'convertible' to string, or at least this is how
-                               // ASP.NET seems to work by the tests i've done latelly. (pruiz)
-
-                               if (values != null && values.TryGetValue (parameterName, out o))
-                                       v = Convert.ToString (o, CultureInfo.InvariantCulture);
-
-                               if (!String.IsNullOrEmpty (v))
-                                       return MatchConstraintRegex (v, s);
-                               else if (reqContext != null) {
-                                       RouteData rd = reqContext != null ? reqContext.RouteData : null;
-                                       RouteValueDictionary rdValues = rd != null ? rd.Values : null;
-
-                                       if (rdValues == null || rdValues.Count == 0)
-                                               return false;
-                                       
-                                       if (!rdValues.TryGetValue (parameterName, out o))
-                                               return false;
-
-                                       v = Convert.ToString (o, CultureInfo.InvariantCulture);
-                                       if (String.IsNullOrEmpty (v))
-                                               return false;
-
-                                       return MatchConstraintRegex (v, s);
-                               }
-                               return false;
-                       }
-
-                       invalidConstraint = true;
-                       return false;
-               }
-
-               static bool MatchConstraintRegex (string value, string constraint)
-               {
-                       int len = constraint.Length;
-                       if (len > 0) {
-                               // Bug #651966 - regexp constraints must be treated
-                               // as absolute expressions
-                               if (constraint [0] != '^') {
-                                       constraint = "^" + constraint;
-                                       len++;
-                               }
-
-                               if (constraint [len - 1] != '$')
-                                       constraint += "$";
-                       }
-
-                       return Regex.IsMatch (value, constraint, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Compiled);
-               }
-               
-               protected virtual bool ProcessConstraint (HttpContextBase httpContext, object constraint, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
-               {
-                       if (parameterName == null)
-                               throw new ArgumentNullException ("parameterName");
-
-                       // .NET "compatibility"
-                       if (values == null)
-                               throw new NullReferenceException ();
-
-                       RequestContext reqContext;
-                       reqContext = SafeGetContext (httpContext != null ? httpContext.Request : null);
-                       bool invalidConstraint;
-                       bool ret = ProcessConstraintInternal (httpContext, this, constraint, parameterName, values, routeDirection, reqContext, out invalidConstraint);
-                       
-                       if (invalidConstraint)
-                               throw new InvalidOperationException (
-                                       String.Format (
-                                               "Constraint parameter '{0}' on the route with URL '{1}' must have a string value type or be a type which implements IRouteConstraint",
-                                               parameterName, Url
-                                       )
-                               );
-
-                       return ret;
-               }
-
-               private bool ProcessConstraints (HttpContextBase httpContext, RouteValueDictionary values, RouteDirection routeDirection)
-               {
-                       var constraints = Constraints;
-
-                       if (Constraints != null) {
-                               foreach (var p in constraints)
-                                       if (!ProcessConstraint (httpContext, p.Value, p.Key, values, routeDirection))
-                                               return false;
-                       }
-
-                       return true;
-               }
-
-               RequestContext SafeGetContext (HttpRequestBase req)
-               {
-                       if (req == null || req.GetType () != httpRequestBaseType)
-                               return null;
-                               
-                       return req.RequestContext;
-               }
-       }
-}
diff --git a/mcs/class/System.Web/System.Web.Routing/RouteCollection.cs b/mcs/class/System.Web/System.Web.Routing/RouteCollection.cs
deleted file mode 100644 (file)
index a8ae41d..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-//
-// RouteCollection.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.IO;
-using System.Runtime.CompilerServices;
-using System.Security.Permissions;
-using System.Web;
-using System.Web.Hosting;
-
-namespace System.Web.Routing
-{
-       [TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
-       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-       public class RouteCollection : Collection<RouteBase>
-       {
-               class Lock : IDisposable
-               {
-                       //RouteCollection owner;
-                       //bool read;
-
-                       public Lock (RouteCollection owner, bool read)
-                       {
-                               //this.owner = owner;
-                               //this.read = read;
-                       }
-
-                       public void Dispose ()
-                       {
-                               //if (read)
-                               //      owner.read_lock = null;
-                               //else
-                               //      owner_write_lock = null;
-                       }
-               }
-
-               public RouteCollection ()
-                       : this (null)
-               {
-               }
-
-               public RouteCollection (VirtualPathProvider virtualPathProvider)
-               {
-                       // null argument is allowed
-                       //provider = virtualPathProvider;
-
-                       read_lock = new Lock (this, true);
-                       write_lock = new Lock (this, false);
-               }
-
-               //VirtualPathProvider provider;
-               Dictionary<string,RouteBase> d = new Dictionary<string,RouteBase> ();
-
-               Lock read_lock, write_lock;
-
-               public RouteBase this [string name] {
-                       get {
-                               foreach (var p in d)
-                                       if (p.Key == name)
-                                               return p.Value;
-                               return null;
-                       }
-               }
-
-               public bool LowercaseUrls { get; set; }
-               public bool AppendTrailingSlash { get; set; }
-               public bool RouteExistingFiles { get; set; }
-
-               public void Add (string name, RouteBase item)
-               {
-                       lock (GetWriteLock ()) {
-                               base.Add (item);
-                               if (!String.IsNullOrEmpty (name))
-                                       d.Add (name, item);
-                       }
-               }
-
-               protected override void ClearItems ()
-               {
-                       lock (GetWriteLock ()) {
-                               base.ClearItems ();
-                               d.Clear ();
-                       }
-               }
-
-               public IDisposable GetReadLock ()
-               {
-                       return read_lock;
-               }
-
-               public RouteData GetRouteData (HttpContextBase httpContext)
-               {
-                       if (httpContext == null)
-                               throw new ArgumentNullException ("httpContext");
-
-                       if (httpContext.Request == null)
-                               throw new ArgumentException ("The context does not contain any request data.", "httpContext");
-                       if (Count == 0)
-                               return null;
-                       if (!RouteExistingFiles) {
-                               var path = httpContext.Request.AppRelativeCurrentExecutionFilePath;
-                               VirtualPathProvider vpp = HostingEnvironment.VirtualPathProvider;
-                               if (path != "~/" && vpp != null && (vpp.FileExists (path) || vpp.DirectoryExists (path)))
-                                       return null;
-                       }
-                       foreach (RouteBase rb in this) {
-                               var rd = rb.GetRouteData (httpContext);
-                               if (rd != null)
-                                       return rd;
-                       }
-
-                       return null;
-               }
-
-               public VirtualPathData GetVirtualPath (RequestContext requestContext, RouteValueDictionary values)
-               {
-                       return GetVirtualPath (requestContext, null, values);
-               }
-
-               public VirtualPathData GetVirtualPath (RequestContext requestContext, string name, RouteValueDictionary values)
-               {
-                       if (requestContext == null)
-                               throw new ArgumentNullException ("httpContext");
-                       VirtualPathData vp = null;
-                       if (!String.IsNullOrEmpty (name)) {
-                               RouteBase rb = this [name];
-                               if (rb != null)
-                                       vp = rb.GetVirtualPath (requestContext, values);
-                               else
-                                       throw new ArgumentException ("A route named '" + name + "' could not be found in the route collection.", "name");
-                       } else {
-                               foreach (RouteBase rb in this) {
-                                       vp = rb.GetVirtualPath (requestContext, values);
-                                       if (vp != null)
-                                               break;
-                               }
-                       }
-
-                       if (vp != null) {
-                               string appPath = requestContext.HttpContext.Request.ApplicationPath;
-                               if (appPath != null && (appPath.Length == 0 || !appPath.EndsWith ("/", StringComparison.Ordinal)))
-                                       appPath += "/";
-                               
-                               string pathWithApp = String.Concat (appPath, vp.VirtualPath);
-                               vp.VirtualPath = requestContext.HttpContext.Response.ApplyAppPathModifier (pathWithApp);
-                               return vp;
-                       }
-
-                       return null;
-               }
-
-               public IDisposable GetWriteLock ()
-               {
-                       return write_lock;
-               }
-               public void Ignore (string url)
-               {
-                       Ignore (url, null);
-               }
-
-               public void Ignore (string url, object constraints)
-               {
-                       if (url == null)
-                               throw new ArgumentNullException ("url");
-
-                       Add (new Route (url, null, new RouteValueDictionary (constraints), new StopRoutingHandler ()));
-               }
-               
-               public Route MapPageRoute (string routeName, string routeUrl, string physicalFile)
-               {
-                       return MapPageRoute (routeName, routeUrl, physicalFile, true, null, null, null);
-               }
-
-               public Route MapPageRoute (string routeName, string routeUrl, string physicalFile, bool checkPhysicalUrlAccess)
-               {
-                       return MapPageRoute (routeName, routeUrl, physicalFile, checkPhysicalUrlAccess, null, null, null);
-               }
-
-               public Route MapPageRoute (string routeName, string routeUrl, string physicalFile, bool checkPhysicalUrlAccess,
-                                          RouteValueDictionary defaults)
-               {
-                       return MapPageRoute (routeName, routeUrl, physicalFile, checkPhysicalUrlAccess, defaults, null, null);
-               }
-
-               public Route MapPageRoute (string routeName, string routeUrl, string physicalFile, bool checkPhysicalUrlAccess,
-                                          RouteValueDictionary defaults, RouteValueDictionary constraints)
-               {
-                       return MapPageRoute (routeName, routeUrl, physicalFile, checkPhysicalUrlAccess, defaults, constraints, null);
-               }
-
-               public Route MapPageRoute (string routeName, string routeUrl, string physicalFile, bool checkPhysicalUrlAccess,
-                                          RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens)
-               {
-                       if (routeUrl == null)
-                               throw new ArgumentNullException ("routeUrl");
-                       
-                       var route = new Route (routeUrl, defaults, constraints, dataTokens, new PageRouteHandler (physicalFile, checkPhysicalUrlAccess));
-                       Add (routeName, route);
-
-                       return route;
-               }
-               protected override void InsertItem (int index, RouteBase item)
-               {
-                       // FIXME: what happens wrt its name?
-                       lock (GetWriteLock ())
-                               base.InsertItem (index, item);
-               }
-
-               protected override void RemoveItem (int index)
-               {
-                       // FIXME: what happens wrt its name?
-                       lock (GetWriteLock ()) {
-                               string k = GetKey (index);
-                               base.RemoveItem (index);
-                               if (k != null)
-                                       d.Remove (k);
-                       }
-               }
-
-               protected override void SetItem (int index, RouteBase item)
-               {
-                       // FIXME: what happens wrt its name?
-                       lock (GetWriteLock ()) {
-                               string k = GetKey (index);
-                               base.SetItem (index, item);
-                               if (k != null)
-                                       d.Remove (k);
-                       }
-               }
-
-               string GetKey (int index)
-               {
-                       var item = this [index];
-                       foreach (var p in d)
-                               if (p.Value == item)
-                                       return p.Key;
-                       return null;
-               }
-       }
-}
diff --git a/mcs/class/System.Web/System.Web.Routing/RouteValueDictionaryExtensions.cs b/mcs/class/System.Web/System.Web.Routing/RouteValueDictionaryExtensions.cs
deleted file mode 100644 (file)
index b73719a..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// PatternParser.cs
-//
-// Author:
-//      Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2009 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-#if SYSTEMCORE_DEP
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-
-namespace System.Web.Routing
-{
-       static class RouteValueDictionaryExtensions
-       {
-               public static bool Has (this RouteValueDictionary dict, string key)
-               {
-                       if (dict == null)
-                               return false;
-                       
-                       return dict.ContainsKey (key);
-               }
-
-               public static bool Has (this RouteValueDictionary dict, string key, object value)
-               {
-                       if (dict == null)
-                               return false;
-
-                       object entryValue;
-                       if (dict.TryGetValue (key, out entryValue)) {
-                               if (value is string) {
-                                       if (!(entryValue is string))
-                                               return false;
-                                       
-                                       string s1 = value as string;
-                                       string s2 = entryValue as string;
-                                       return String.Compare (s1, s2, StringComparison.OrdinalIgnoreCase) == 0;
-                               }
-                               
-                               return entryValue == null ? value == null : entryValue.Equals (value);
-                       }
-                       
-                       return false;
-               }
-
-               public static bool GetValue (this RouteValueDictionary dict, string key, out object value)
-               {
-                       if (dict == null) {
-                               value = null;
-                               return false;
-                       }
-
-                       return dict.TryGetValue (key, out value);
-               }
-
-               [Conditional ("DEBUG")]
-               public static void Dump (this RouteValueDictionary dict, string name, string indent)
-               {
-                       if (indent == null)
-                               indent = String.Empty;
-                       
-                       if (dict == null) {
-                               Console.WriteLine (indent + "Dictionary '{0}' is null", name);
-                               return;
-                       }
-                       
-                       if (dict.Count == 0) {
-                               Console.WriteLine (indent + "Dictionary '{0}' is empty", name);
-                               return;
-                       }
-
-                       Console.WriteLine (indent + "Dictionary '{0}':", name);
-                       foreach (var de in dict)
-                               Console.WriteLine (indent + "\t'{0}' == {1}", de.Key, de.Value);
-               }
-       }
-}
-#endif
diff --git a/mcs/class/System.Web/System.Web.Routing/UrlRoutingHandler.cs b/mcs/class/System.Web/System.Web.Routing/UrlRoutingHandler.cs
deleted file mode 100644 (file)
index f067b5f..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-//
-// UrlRoutingHandler.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008-2010 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Runtime.CompilerServices;
-using System.Security.Permissions;
-using System.Web;
-
-namespace System.Web.Routing
-{
-       [TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
-       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-       public abstract class UrlRoutingHandler : IHttpHandler
-       {
-               RouteCollection routes;
-
-               bool IHttpHandler.IsReusable {
-                       get { return IsReusable; }
-               }
-
-               protected virtual bool IsReusable { get { return false; } }
-
-               public RouteCollection RouteCollection {
-                       get {
-                               if (routes == null)
-                                       routes = RouteTable.Routes;
-                               return routes;
-                       }
-                       set { routes = value; }
-               }
-
-               void IHttpHandler.ProcessRequest (HttpContext context)
-               {
-                       ProcessRequest (context);
-               }
-
-               protected virtual void ProcessRequest (HttpContext httpContext)
-               {
-                       ProcessRequest (new HttpContextWrapper (httpContext));
-               }
-
-               protected virtual void ProcessRequest (HttpContextBase httpContext)
-               {
-                       if (httpContext == null)
-                               throw new ArgumentNullException ("httpContext");
-
-                       var rd = RouteCollection.GetRouteData (httpContext);
-                       if (rd == null)
-                               throw new HttpException ("The incoming request does not match any route");
-                       if (rd.RouteHandler == null)
-                               throw new InvalidOperationException ("No  IRouteHandler is assigned to the selected route");
-
-                       RequestContext rc = new RequestContext (httpContext, rd);
-
-                       var hh = rd.RouteHandler.GetHttpHandler (rc);
-                       VerifyAndProcessRequest (hh, httpContext);
-               }
-
-               protected abstract void VerifyAndProcessRequest (IHttpHandler httpHandler, HttpContextBase httpContext);
-       }
-}
diff --git a/mcs/class/System.Web/System.Web.Routing/UrlRoutingModule.cs b/mcs/class/System.Web/System.Web.Routing/UrlRoutingModule.cs
deleted file mode 100644 (file)
index 6fad095..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-//
-// UrlRoutingModule.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Runtime.CompilerServices;
-using System.Security.Permissions;
-using System.Threading;
-using System.Web;
-
-namespace System.Web.Routing
-{
-       [TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
-       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-       public class UrlRoutingModule : IHttpModule
-       {
-               RouteCollection routes;
-               public RouteCollection RouteCollection {
-                       get {
-                               if (routes == null)
-                                       routes = RouteTable.Routes;
-                               return routes;
-                       }
-                       set { routes = value; }
-               }
-
-               protected virtual void Dispose ()
-               {
-               }
-
-               void IHttpModule.Dispose ()
-               {
-                       Dispose ();
-               }
-
-               void IHttpModule.Init (HttpApplication application)
-               {
-                       Init (application);
-               }
-
-               protected virtual void Init (HttpApplication application)
-               {
-                       application.PostMapRequestHandler += PostMapRequestHandler;
-                       application.PostResolveRequestCache += PostResolveRequestCache;
-               }
-
-               void PostMapRequestHandler (object o, EventArgs e)
-               {
-                       var app = (HttpApplication) o;
-                       PostMapRequestHandler (new HttpContextWrapper (app.Context));
-               }
-
-               void PostResolveRequestCache (object o, EventArgs e)
-               {
-                       var app = (HttpApplication) o;
-                       PostResolveRequestCache (new HttpContextWrapper (app.Context));
-               }
-               [Obsolete]
-               public virtual void PostMapRequestHandler (HttpContextBase context)
-               {
-               }
-
-               [MonoTODO]
-               public virtual void PostResolveRequestCache (HttpContextBase context)
-               {
-                       if (context == null)
-                               throw new ArgumentNullException ("context");
-
-                       var rd = RouteCollection.GetRouteData (context);
-                       if (rd == null)
-                               return; // do nothing
-
-                       if (rd.RouteHandler == null)
-                               throw new InvalidOperationException ("No  IRouteHandler is assigned to the selected route");
-
-                       if (rd.RouteHandler is StopRoutingHandler)
-                               return; //stop further processing
-                       
-                       var rc = new RequestContext (context, rd);
-
-                       IHttpHandler http = rd.RouteHandler.GetHttpHandler (rc);
-                       if (http == null)
-                               throw new InvalidOperationException ("The mapped IRouteHandler did not return an IHttpHandler");
-                       context.Request.RequestContext = rc;
-                       context.RemapHandler (http);
-               }
-       }
-}
index 9f302f07daf7e2500f458447943ce9baa86066ef..5ec2b91f7caff15252aa5ed6441cebb9408f9e88 100644 (file)
@@ -42,11 +42,21 @@ namespace System.Web.Security
        public sealed class FormsAuthenticationModule : IHttpModule
        {
                static readonly object authenticateEvent = new object ();
-               
+
+               // Config values
+               private static bool      _fAuthChecked;
+               private static bool      _fAuthRequired;
+
                AuthenticationSection _config = null;
                bool isConfigInitialized = false;
                EventHandlerList events = new EventHandlerList ();
-               
+       
+               internal static bool FormsAuthRequired {
+                       get {
+                               return _fAuthRequired;
+                       }
+               }
+
                public event FormsAuthenticationEventHandler Authenticate {
                        add { events.AddHandler (authenticateEvent, value); }
                        remove { events.RemoveHandler (authenticateEvent, value); }
@@ -57,6 +67,14 @@ namespace System.Web.Security
                        if(isConfigInitialized)
                                return;
                        _config = (AuthenticationSection) WebConfigurationManager.GetSection ("system.web/authentication");
+
+                       // authentication is an app level setting only
+                       // so we can read app config early on in an attempt to try and
+                       // skip wiring up event delegates
+                       if (!_fAuthChecked) {
+                               _fAuthRequired = (_config.Mode == AuthenticationMode.Forms);
+                               _fAuthChecked = true;
+                       }
                        isConfigInitialized = true;
                }
 
@@ -71,6 +89,7 @@ namespace System.Web.Security
 
                public void Init (HttpApplication app)
                {
+
                        app.AuthenticateRequest += new EventHandler (OnAuthenticateRequest);
                        app.EndRequest += new EventHandler (OnEndRequest);
                }
index 31ecf80334786bea456a7e9f90e1e07298c330df..eb6b890700b6674116926ca2b99c492a42665e0f 100644 (file)
@@ -77,6 +77,21 @@ namespace System.Web.Security
 
                        return config == null ? true : config.IsValidUser (user, verb);
                }
+
+               internal static void ReportUrlAuthorizationFailure(HttpContext context, object webEventSource) {
+                       // Deny access
+                       context.Response.StatusCode = 401;
+                       context.Response.Write (new HttpException(401, "Unauthorized").GetHtmlErrorMessage ());
+
+#if false // Sys.Web.Mng not implemented on mono.
+                       if (context.User != null && context.User.Identity.IsAuthenticated) {
+                               // We don't raise failure audit event for anonymous user
+                               WebBaseEvent.RaiseSystemEvent(webEventSource, WebEventCodes.AuditUrlAuthorizationFailure);
+                       }
+#endif
+                       context.ApplicationInstance.CompleteRequest();
+               }
+
        }
 }
 
diff --git a/mcs/class/System.Web/System.Web.UI/Util.cs b/mcs/class/System.Web/System.Web.UI/Util.cs
new file mode 100644 (file)
index 0000000..373d3e9
--- /dev/null
@@ -0,0 +1,52 @@
+//------------------------------------------------------------------------------
+// <copyright file="Util.cs" company="Microsoft">
+//     Copyright (c) Microsoft Corporation.  All rights reserved.
+// </copyright>
+//------------------------------------------------------------------------------
+
+/*
+ * Implements various utility functions used by the template code
+ *
+ * Copyright (c) 1998 Microsoft Corporation
+ */
+
+namespace System.Web.UI {
+    using System;
+    using System.Collections;
+    using System.Collections.Specialized;
+    using System.ComponentModel;
+    using System.Diagnostics;
+    using System.Diagnostics.CodeAnalysis;
+    using System.Drawing;
+    using System.Globalization;
+    using System.IO;
+    using System.Reflection;
+    using System.Runtime.Serialization.Formatters;
+    using System.Security;
+    using System.Security.Permissions;
+    using System.Text;
+    using System.Text.RegularExpressions;
+    using System.Web.Compilation;
+    using System.Web.Configuration;
+    using System.Web.Hosting;
+    using System.Web.Management;
+    using System.Web.Security;
+    //using System.Web.Security.Cryptography;
+    using System.Web.UI.WebControls;
+    using System.Web.Util;
+    using Microsoft.Win32;
+    //using Debug = System.Web.Util.Debug;
+
+internal static class Util {
+
+    internal static string GetUrlWithApplicationPath(HttpContextBase context, string url) {
+        string appPath = context.Request.ApplicationPath ?? String.Empty;
+        if (!appPath.EndsWith("/", StringComparison.OrdinalIgnoreCase)) {
+            appPath += "/";
+        }
+
+        return context.Response.ApplyAppPathModifier(appPath + url);
+    }
+}
+
+}
index 09fe382000b5e9f1ace1e571617c279f1fea9ef6..e379ff757b878ad10431509f1f5da9e5ea53dd56 100644 (file)
@@ -24,6 +24,7 @@ Mono.Web.Util/SettingsMapping.cs
 Mono.Web.Util/SettingsMappingManager.cs
 Mono.Web.Util/SettingsMappingWhat.cs
 
+ReferenceSources/SR.cs
 System.Web/ApplicationShutdownReason.cs
 System.Web/BeginEventHandler.cs
 System.Web.Caching/AggregateCacheDependency.cs
@@ -510,6 +511,7 @@ System.Web/TraceContextRecord.cs
 System.Web/TraceData.cs
 System.Web/TraceManager.cs
 System.Web/TraceMode.cs
+System.Web.UI/Util.cs
 System.Web.UI.Adapters/ControlAdapter.cs
 System.Web.UI.Adapters/PageAdapter.cs
 ../../../external/referencesource/System.Web/UI/WebControls/Adapters/WmlPostFieldType.cs
@@ -1251,7 +1253,6 @@ System.Web.Compilation/RouteValueExpressionBuilder.cs
 System.Web.Security/MachineKey.cs
 System.Web.Security/MachineKeyProtection.cs
 ../../../external/referencesource/System.Web/State/SessionStateBehavior.cs
-System.Web.Routing/PageRouteHandler.cs
 ../../../external/referencesource/System.Web/UI/ClientIDMode.cs
 ../../../external/referencesource/System.Web/UI/DataKeyPropertyAttribute.cs
 System.Web.UI/FileLevelMasterPageControlBuilder.cs
@@ -1276,24 +1277,31 @@ System.Web.Util/SimpleWebObjectFactory.cs
 ../../../external/referencesource/System.Web/Util/RequestValidationSource.cs
 System.Web.Util/RequestValidator.cs
 
-System.Web.Routing/HttpMethodConstraint.cs
+../../../external/referencesource/System.Web/Routing/BoundUrl.cs
+../../../external/referencesource/System.Web/Routing/ContentPathSegment.cs
+../../../external/referencesource/System.Web/Routing/HttpMethodConstraint.cs
 ../../../external/referencesource/System.Web/Routing/IRouteConstraint.cs
 ../../../external/referencesource/System.Web/Routing/IRouteHandler.cs
-System.Web.Routing/PatternParser.cs
-System.Web.Routing/PatternToken.cs
-System.Web.Routing/PatternTokenType.cs
+../../../external/referencesource/System.Web/Routing/LiteralSubsegment.cs
+../../../external/referencesource/System.Web/Routing/PageRouteHandler.cs
+../../../external/referencesource/System.Web/Routing/ParameterSubsegment.cs
+../../../external/referencesource/System.Web/Routing/ParsedRoute.cs
+../../../external/referencesource/System.Web/Routing/PathSegment.cs
+../../../external/referencesource/System.Web/Routing/PathSubsegment.cs
 ../../../external/referencesource/System.Web/Routing/RequestContext.cs
-System.Web.Routing/Route.cs
+../../../external/referencesource/System.Web/Routing/Route.cs
 ../../../external/referencesource/System.Web/Routing/RouteBase.cs
-System.Web.Routing/RouteCollection.cs
+../../../external/referencesource/System.Web/Routing/RouteCollection.cs
 ../../../external/referencesource/System.Web/Routing/RouteData.cs
 ../../../external/referencesource/System.Web/Routing/RouteDirection.cs
+../../../external/referencesource/System.Web/Routing/RouteParser.cs
 ../../../external/referencesource/System.Web/Routing/RouteTable.cs
 ../../../external/referencesource/System.Web/Routing/RouteValueDictionary.cs
-System.Web.Routing/RouteValueDictionaryExtensions.cs
+../../../external/referencesource/System.Web/Routing/SeparatorPathSegment.cs
 ../../../external/referencesource/System.Web/Routing/StopRoutingHandler.cs
-System.Web.Routing/UrlRoutingHandler.cs
-System.Web.Routing/UrlRoutingModule.cs
+../../../external/referencesource/System.Web/Routing/UrlAuthFailureHandler.cs
+../../../external/referencesource/System.Web/Routing/UrlRoutingHandler.cs
+../../../external/referencesource/System.Web/Routing/UrlRoutingModule.cs
 ../../../external/referencesource/System.Web/Routing/VirtualPathData.cs
 
 ../../../external/referencesource/System.Web/Abstractions/HttpApplicationStateBase.cs
@@ -1394,14 +1402,6 @@ ReferenceSources/SR.cs
 ../../../external/referencesource/System.Web/Hosting/IProcessHostSupportFunctions.cs
 ../../../external/referencesource/System.Web/Hosting/HTTP_COOKED_URL.cs
 ../../../external/referencesource/System.Web/Hosting/HostingEnvironmentException.cs
-../../../external/referencesource/System.Web/Routing/PathSegment.cs
-../../../external/referencesource/System.Web/Routing/PathSubsegment.cs
-../../../external/referencesource/System.Web/Routing/BoundUrl.cs
-../../../external/referencesource/System.Web/Routing/SeparatorPathSegment.cs
-../../../external/referencesource/System.Web/Routing/UrlAuthFailureHandler.cs
-../../../external/referencesource/System.Web/Routing/LiteralSubsegment.cs
-../../../external/referencesource/System.Web/Routing/ParameterSubsegment.cs
-../../../external/referencesource/System.Web/Routing/ContentPathSegment.cs
 ../../../external/referencesource/System.Web/Util/SynchronizationContextMode.cs
 ../../../external/referencesource/System.Web/Util/ISyncContextLock.cs
 ../../../external/referencesource/System.Web/Util/DoNotResetAttribute.cs