Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -60,15 +60,11 @@ using System.Web.Routing;
[assembly: AssemblyKeyFile ("../winfx.pub")]
[assembly: ComVisible (false)]
#if !NET_4_0
[assembly: ComCompatibleVersion (1, 0, 3300, 0)]
#endif
[assembly: AllowPartiallyTrustedCallers]
// FIXME: We get collisions with this internalsVisibleTo because of Consts.cs and MonoTodo
//[assembly: InternalsVisibleTo ("System.ServiceModel.Web, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
#if NET_4_0
[assembly: SecurityRules (SecurityRuleSet.Level2, SkipVerificationInFullTrust = true)]
[assembly: SecurityTransparent]
[assembly: TypeForwardedToAttribute (typeof (System.Web.Routing.RouteBase))]
@@ -86,4 +82,3 @@ using System.Web.Routing;
[assembly: TypeForwardedToAttribute (typeof (System.Web.Routing.RouteDirection))]
[assembly: TypeForwardedToAttribute (typeof (System.Web.Routing.StopRoutingHandler))]
[assembly: TypeForwardedToAttribute (typeof (System.Web.Routing.RouteValueDictionary))]
#endif

View File

@@ -9,11 +9,6 @@ LIB_MCS_FLAGS = \
/r:System.Web.dll \
/r:System.Web.Abstractions.dll
ifeq (2.0, $(FRAMEWORK_VERSION))
# This is a .NET 3.5 only assembly, but built during the 2.0 build
LIB_MCS_FLAGS += -d:NET_3_5 -d:SYSTEMCORE_DEP
endif
ifdef DEBUG
LIB_MCS_FLAGS += -define:DEBUG
endif
@@ -23,7 +18,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES =
# This is a .NET 3.5+ assembly
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
VALID_PROFILE := $(filter net_4_5, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.Web.Routing.dll
NO_INSTALL = yes

View File

@@ -36,9 +36,7 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class HttpMethodConstraint : IRouteConstraint

View File

@@ -34,12 +34,7 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#else
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
#endif
public interface IRouteConstraint
{
bool Match (HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection);

View File

@@ -34,12 +34,7 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#else
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
#endif
public interface IRouteHandler
{
IHttpHandler GetHttpHandler (RequestContext requestContext);

View File

@@ -34,20 +34,16 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class RequestContext
{
#if NET_4_0
public RequestContext ()
{
HttpContext = null;
RouteData = null;
}
#endif
public RequestContext (HttpContextBase httpContext, RouteData routeData)
{
if (httpContext == null)
@@ -59,12 +55,7 @@ namespace System.Web.Routing
RouteData = routeData;
}
#if NET_4_0
public virtual HttpContextBase HttpContext { get; set; }
public virtual RouteData RouteData { get; set; }
#else
public HttpContextBase HttpContext { get; private set; }
public RouteData RouteData { get; private set; }
#endif
}
}

View File

@@ -36,16 +36,12 @@ using System.Globalization;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class Route : RouteBase
{
#if NET_4_0
static readonly Type httpRequestBaseType = typeof (HttpRequestBase);
#endif
PatternParser url;
public RouteValueDictionary Constraints { get; set; }
@@ -176,7 +172,6 @@ namespace System.Web.Routing
if (!String.IsNullOrEmpty (v))
return MatchConstraintRegex (v, s);
#if NET_4_0
else if (reqContext != null) {
RouteData rd = reqContext != null ? reqContext.RouteData : null;
RouteValueDictionary rdValues = rd != null ? rd.Values : null;
@@ -193,7 +188,6 @@ namespace System.Web.Routing
return MatchConstraintRegex (v, s);
}
#endif
return false;
}
@@ -229,11 +223,7 @@ namespace System.Web.Routing
throw new NullReferenceException ();
RequestContext reqContext;
#if NET_4_0
reqContext = SafeGetContext (httpContext != null ? httpContext.Request : null);
#else
reqContext = null;
#endif
bool invalidConstraint;
bool ret = ProcessConstraintInternal (httpContext, this, constraint, parameterName, values, routeDirection, reqContext, out invalidConstraint);
@@ -261,7 +251,6 @@ namespace System.Web.Routing
return true;
}
#if NET_4_0
RequestContext SafeGetContext (HttpRequestBase req)
{
if (req == null || req.GetType () != httpRequestBaseType)
@@ -269,6 +258,5 @@ namespace System.Web.Routing
return req.RequestContext;
}
#endif
}
}

View File

@@ -34,9 +34,7 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public abstract class RouteBase

View File

@@ -39,9 +39,7 @@ using System.Web.Hosting;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class RouteCollection : Collection<RouteBase>
@@ -123,20 +121,14 @@ namespace System.Web.Routing
if (httpContext.Request == null)
throw new ArgumentException ("The context does not contain any request data.", "httpContext");
#if NET_4_0
if (Count == 0)
return null;
#endif
if (!RouteExistingFiles) {
var path = httpContext.Request.AppRelativeCurrentExecutionFilePath;
VirtualPathProvider vpp = HostingEnvironment.VirtualPathProvider;
if (path != "~/" && vpp != null && (vpp.FileExists (path) || vpp.DirectoryExists (path)))
return null;
}
#if !NET_4_0
if (Count == 0)
return null;
#endif
foreach (RouteBase rb in this) {
var rd = rb.GetRouteData (httpContext);
if (rd != null)
@@ -155,19 +147,13 @@ namespace System.Web.Routing
{
if (requestContext == null)
throw new ArgumentNullException ("httpContext");
#if !NET_4_0
if (Count == 0)
return null;
#endif
VirtualPathData vp = null;
if (!String.IsNullOrEmpty (name)) {
RouteBase rb = this [name];
if (rb != null)
vp = rb.GetVirtualPath (requestContext, values);
#if NET_4_0
else
throw new ArgumentException ("A route named '" + name + "' could not be found in the route collection.", "name");
#endif
} else {
foreach (RouteBase rb in this) {
vp = rb.GetVirtualPath (requestContext, values);
@@ -193,7 +179,6 @@ namespace System.Web.Routing
{
return write_lock;
}
#if NET_4_0
public void Ignore (string url)
{
Ignore (url, null);
@@ -240,7 +225,6 @@ namespace System.Web.Routing
return route;
}
#endif
protected override void InsertItem (int index, RouteBase item)
{
// FIXME: what happens wrt its name?

View File

@@ -34,9 +34,7 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class RouteData

View File

@@ -31,9 +31,7 @@ using System.Runtime.CompilerServices;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
public enum RouteDirection
{
IncomingRequest,

View File

@@ -34,9 +34,7 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class RouteTable

View File

@@ -39,9 +39,7 @@ using PairCollection = System.Collections.Generic.ICollection<System.Collections
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class RouteValueDictionary : IDictionary<string, object>

View File

@@ -98,4 +98,4 @@ namespace System.Web.Routing
}
}
}
#endif
#endif

View File

@@ -34,9 +34,7 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class StopRoutingHandler : IRouteHandler

View File

@@ -34,9 +34,7 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public abstract class UrlRoutingHandler : IHttpHandler

View File

@@ -35,18 +35,12 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class UrlRoutingModule : IHttpModule
{
RouteCollection routes;
#if !NET_4_0
object module_identity_key = new object ();
object original_path_key = new object ();
#endif
public RouteCollection RouteCollection {
get {
if (routes == null)
@@ -87,24 +81,9 @@ namespace System.Web.Routing
var app = (HttpApplication) o;
PostResolveRequestCache (new HttpContextWrapper (app.Context));
}
#if NET_4_0
[Obsolete]
#endif
public virtual void PostMapRequestHandler (HttpContextBase context)
{
#if !NET_4_0
if (context == null)
throw new ArgumentNullException ("context");
// FIXME: find out what it actually does.
IHttpHandler h = (IHttpHandler) context.Items [module_identity_key];
if (h != null)
context.Handler = h;
string original_path = context.Items [original_path_key] as string;
if (!String.IsNullOrEmpty (original_path))
context.RewritePath (original_path);
#endif
}
[MonoTODO]
@@ -128,21 +107,8 @@ namespace System.Web.Routing
IHttpHandler http = rd.RouteHandler.GetHttpHandler (rc);
if (http == null)
throw new InvalidOperationException ("The mapped IRouteHandler did not return an IHttpHandler");
#if NET_4_0
context.Request.RequestContext = rc;
context.RemapHandler (http);
#else
// note: It does not resolve paths using GetVirtualPath():
//var vpd = RouteCollection.GetVirtualPath (rc, rd.Values);
//context.RewritePath (vpd.VirtualPath);
context.Items [original_path_key] = context.Request.Path;
// default handler (forbidden in MVC/DynamicData projects)
context.RewritePath ("~/UrlRouting.axd");
context.Items [module_identity_key] = http;
#endif
}
}
}

View File

@@ -34,9 +34,7 @@ using System.Web;
namespace System.Web.Routing
{
#if NET_4_0
[TypeForwardedFrom ("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
#endif
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class VirtualPathData