Imported Upstream version 3.12.0

Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
Jo Shields
2015-01-13 10:44:36 +00:00
parent 8b9b85e7f5
commit 181b81b4a4
659 changed files with 12743 additions and 16300 deletions

View File

@@ -67,6 +67,7 @@ namespace System.Web.Configuration {
static readonly char[] pathTrimChars = { '/' };
static readonly object suppressAppReloadLock = new object ();
static readonly object saveLocationsCacheLock = new object ();
static readonly object getSectionLock = new object ();
// See comment for the cacheLock field at top of System.Web.Caching/Cache.cs
static readonly ReaderWriterLockSlim sectionCacheLock;
@@ -517,7 +518,10 @@ namespace System.Web.Configuration {
cachePath = path;
}
ConfigurationSection section = c.GetSection (sectionName);
ConfigurationSection section;
lock (getSectionLock) {
section = c.GetSection (sectionName);
}
if (section == null)
return null;
@@ -529,7 +533,7 @@ namespace System.Web.Configuration {
value = collection;
}
#else
object value = SettingsMappingManager.MapSection (get_runtime_object.Invoke (section, new object [0]));
object value = SettingsMappingManager.MapSection (section.GetRuntimeObject ());
#endif
if (cachePath != null)
cacheKey = baseCacheKey ^ cachePath.GetHashCode ();
@@ -677,7 +681,9 @@ namespace System.Web.Configuration {
configurations.Remove (GetCurrentPath (ctx));
}
#if TARGET_J2EE
readonly static MethodInfo get_runtime_object = typeof (ConfigurationSection).GetMethod ("GetRuntimeObject", BindingFlags.NonPublic | BindingFlags.Instance);
#endif
public static object GetWebApplicationSection (string sectionName)
{

View File

@@ -160,7 +160,9 @@ namespace System.Web.Hosting {
{
if (obj == null)
throw new ArgumentNullException ("obj");
Host.RegisterObject (obj, false);
if (Host != null)
Host.RegisterObject (obj, false);
}
public static void RegisterVirtualPathProvider (VirtualPathProvider virtualPathProvider)
@@ -200,7 +202,9 @@ namespace System.Web.Hosting {
{
if (obj == null)
throw new ArgumentNullException ("obj");
Host.UnregisterObject (obj);
if (Host != null)
Host.UnregisterObject (obj);
}
}
}

View File

@@ -180,6 +180,11 @@ namespace System.Web.Security
if (context.Response.StatusCode != 401 || context.Request.QueryString ["ReturnUrl"] != null)
return;
#if NET_4_5
if (context.Response.StatusCode == 401 && context.Response.SuppressFormsAuthenticationRedirect)
return;
#endif
string loginPage;
InitConfig (context);
#if NET_2_0

View File

@@ -94,7 +94,7 @@ namespace System.Web.Security
internal void UpdateUser ()
{
MembershipUser newUser = Provider.GetUser (name, false);
MembershipUser newUser = Provider.GetUser (UserName, false);
UpdateSelf (newUser);
}

View File

@@ -230,6 +230,10 @@ namespace System.Web
}
} catch (Exception e) {
initialization_exception = e;
Console.Error.WriteLine("Exception while initOnce: "+e.ToString());
// Once initialization_exception != null, we always respond with this exception
// You have to restart the HttpApplication to "unlock" it
Console.Error.WriteLine("Please restart your app to unlock it");
} finally {
if (mustNullContext)
context = null;
@@ -1549,6 +1553,7 @@ namespace System.Web
if (initialization_exception != null) {
Exception e = initialization_exception;
HttpException exc = HttpException.NewWithCode (String.Empty, e, WebEventCodes.RuntimeErrorRequestAbort);
context.Response.StatusCode = 500;
FinalErrorWrite (context.Response, exc.GetHtmlErrorMessage ());
PipelineDone ();
return;

View File

@@ -400,6 +400,13 @@ namespace System.Web
set;
}
#if NET_4_5
public bool SuppressFormsAuthenticationRedirect {
get;
set;
}
#endif
public bool TrySkipIisCustomErrors {
get;
set;

View File

@@ -56,7 +56,7 @@ namespace System.Web {
StringBuilder sb = new StringBuilder ();
string [] keys = AllKeys;
for (int i = 0; i < count; i++) {
sb.AppendFormat ("{0}={1}&", keys [i], this [keys [i]]);
sb.AppendFormat ("{0}={1}&", keys [i], UrlEncode (this [keys [i]]));
}
if (sb.Length > 0)
sb.Length--;

View File

@@ -233,6 +233,7 @@ namespace System.Web
mimeTypes.Add ("la", "audio/nspaudio");
mimeTypes.Add ("lam", "audio/x-liveaudio");
mimeTypes.Add ("latex", "application/x-latex");
mimeTypes.Add ("less", "text/css");
mimeTypes.Add ("list", "text/plain");
mimeTypes.Add ("lma", "audio/nspaudio");
mimeTypes.Add ("log", "text/plain");
@@ -529,7 +530,7 @@ namespace System.Web
mimeTypes.Add ("wmls", "text/vnd.wap.wmlscript");
mimeTypes.Add ("wml", "text/vnd.wap.wml");
mimeTypes.Add ("wmp", "video/x-ms-wmp");
mimeTypes.Add ("woff", "application/x-woff");
mimeTypes.Add ("woff", "application/font-woff");
mimeTypes.Add ("word", "application/msword");
mimeTypes.Add ("wp5", "application/wordperfect");
mimeTypes.Add ("wp6", "application/wordperfect");

View File

@@ -0,0 +1,34 @@
//
// ReadEntityBodyMode.cs
//
// Author: Martin Thwaites (github@my2cents.co.uk)
//
// Copyright (C) 2014 Martin Thwaites
//
// 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.
namespace System.Web {
public enum ReadEntityBodyMode {
None,
Classic,
Bufferless,
Buffered,
}
}

View File

@@ -35,6 +35,10 @@ using System.Web.UI;
using MonoTests.SystemWeb.Framework;
namespace MonoTests.System.Web.Hosting {
public class MyRegisteredObject : IRegisteredObject {
public void Stop(bool immediate) {}
}
[TestFixture]
public class HostingEnvironmentTest {
[Test]
@@ -105,6 +109,15 @@ namespace MonoTests.System.Web.Hosting {
{
Assert.IsNull (HostingEnvironment.MapPath ("hola"));
}
[Test]
public void RegisterAndUnregisterObject ()
{
var registered = new MyRegisteredObject ();
HostingEnvironment.RegisterObject (registered);
HostingEnvironment.UnregisterObject (registered);
}
}
}
#endif

View File

@@ -861,6 +861,15 @@ namespace MonoTests.System.Web {
@"&#160;&#161;&#162;&#163;&#164;&#165;&#166;&#167;&#168;&#169;&#170;&#171;&#172;&#173;&#174;&#175;&#176;&#177;&#178;&#179;&#180;&#181;&#182;&#183;&#184;&#185;&#186;&#187;&#188;&#189;&#190;&#191;&#192;&#193;&#194;&#195;&#196;&#197;&#198;&#199;&#200;&#201;&#202;&#203;&#204;&#205;&#206;&#207;&#208;&#209;&#210;&#211;&#212;&#213;&#214;&#215;&#216;&#217;&#218;&#219;&#220;&#221;&#222;&#223;&#224;&#225;&#226;&#227;&#228;&#229;&#230;&#231;&#232;&#233;&#234;&#235;&#236;&#237;&#238;&#239;&#240;&#241;&#242;&#243;&#244;&#245;&#246;&#247;&#248;&#249;&#250;&#251;&#252;&#253;&#254;&#255;",
};
[Test]
public void ToStringEncoding ()
{
var queryStringNameValues = HttpUtility.ParseQueryString(string.Empty);
queryStringNameValues.Add("ReturnUrl", @"http://localhost/login/authenticate?ReturnUrl=http://localhost/secured_area&__provider__=google");
var expected = "ReturnUrl=http%3a%2f%2flocalhost%2flogin%2fauthenticate%3fReturnUrl%3dhttp%3a%2f%2flocalhost%2fsecured_area%26__provider__%3dgoogle";
Assert.AreEqual (expected, queryStringNameValues.ToString());
}
}
}

View File

@@ -1,3 +1,5 @@
#include net_4_0_System.Web.dll.sources
System.Web/MimeMapping.cs
System.Web/ReadEntityBodyMode.cs