Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@ -130,6 +130,9 @@ namespace System.Web.Util {
if (settings == null || !Boolean.TryParse(settings["aspnet:EnableAsyncModelBinding"], out _enableAsyncModelBinding))
_enableAsyncModelBinding = BinaryCompatibility.Current.TargetsAtLeastFramework46;
if (settings == null || !int.TryParse(settings["aspnet:RequestQueueLimitPerSession"], out _requestQueueLimitPerSession) || _requestQueueLimitPerSession < 0)
_requestQueueLimitPerSession = BinaryCompatibility.Current.TargetsAtLeastFramework463 ? DefaultRequestQueueLimitPerSession : UnlimitedRequestsPerSession;
_settingsInitialized = true;
}
}
@ -492,5 +495,16 @@ namespace System.Web.Util {
return _enableAsyncModelBinding;
}
}
internal const int UnlimitedRequestsPerSession = Int32.MaxValue;
internal const int DefaultRequestQueueLimitPerSession = 50;
// Limit of queued requests per session
private static int _requestQueueLimitPerSession;
internal static int RequestQueueLimitPerSession {
get {
EnsureSettingsLoaded();
return _requestQueueLimitPerSession;
}
}
}
}

View File

@ -305,7 +305,7 @@
// BeginHandler hasn't yet returned, so this call may be synchronous or asynchronous.
// We can tell by comparing the current thread with the thread which called BeginHandler.
// From a correctness perspective, it is valid to invoke the AsyncCallback delegate either
// synchronously or asynchronously. From [....]: if 'CompletedSynchronously = true', then
// synchronously or asynchronously. From Microsoft: if 'CompletedSynchronously = true', then
// AsyncCallback invocation can happen either on the same thread or on a different thread,
// just as long as BeginHandler hasn't yet returned (which in true in this case).
if (!asyncResult.CompletedSynchronously) {

View File

@ -300,7 +300,7 @@ internal class AspCompatApplicationStep : HttpApplication.IExecutionStep, IManag
return;
// try cache first
CacheInternal cacheInternal = HttpRuntime.CacheInternal;
CacheStoreProvider cacheInternal = HttpRuntime.Cache.InternalCache;
String key = CacheInternal.PrefixAspCompatThreading + progidDisplayName;
String threadingModel = (String)cacheInternal.Get(key);
RegistryKey regKey = null;
@ -321,7 +321,7 @@ internal class AspCompatApplicationStep : HttpApplication.IExecutionStep, IManag
if (threadingModel == null)
threadingModel = String.Empty;
cacheInternal.UtcInsert(key, threadingModel);
cacheInternal.Insert(key, threadingModel, null);
}
if (StringUtil.EqualsIgnoreCase(threadingModel, "Apartment")) {

View File

@ -17,7 +17,13 @@ namespace System.Web.Util {
internal const string TargetFrameworkKey = "ASPNET_TARGETFRAMEWORK";
// quick accessor for the current AppDomain's instance
public static readonly BinaryCompatibility Current = new BinaryCompatibility(AppDomain.CurrentDomain.GetData(TargetFrameworkKey) as FrameworkName);
public static readonly BinaryCompatibility Current;
static BinaryCompatibility() {
Current = new BinaryCompatibility(AppDomain.CurrentDomain.GetData(TargetFrameworkKey) as FrameworkName);
TelemetryLogger.LogTargetFramework(Current.TargetFramework);
}
public BinaryCompatibility(FrameworkName frameworkName) {
// parse version from FrameworkName, otherwise use a default value
@ -32,6 +38,7 @@ namespace System.Web.Util {
TargetsAtLeastFramework452 = (version >= VersionUtil.Framework452);
TargetsAtLeastFramework46 = (version >= VersionUtil.Framework46);
TargetsAtLeastFramework461 = (version >= VersionUtil.Framework461);
TargetsAtLeastFramework463 = (version >= VersionUtil.Framework463);
}
public bool TargetsAtLeastFramework45 { get; private set; }
@ -39,6 +46,7 @@ namespace System.Web.Util {
public bool TargetsAtLeastFramework452 { get; private set; }
public bool TargetsAtLeastFramework46 { get; private set; }
public bool TargetsAtLeastFramework461 { get; private set; }
public bool TargetsAtLeastFramework463 { get; private set; }
public Version TargetFramework { get; private set; }

View File

@ -8,9 +8,17 @@ namespace System.Web.Util {
using System;
internal enum TimeUnit {
Unknown = 0,
Days,
Hours,
Minutes,
Seconds,
Milliseconds
};
internal sealed class DateTimeUtil {
private DateTimeUtil() {}
const long FileTimeOffset = 504911232000000000;
static readonly DateTime MinValuePlusOneDay = DateTime.MinValue.AddDays(1);
static readonly DateTime MaxValueMinusOneDay = DateTime.MaxValue.AddDays(-1);
@ -46,6 +54,26 @@ namespace System.Web.Util {
return utcTime.ToLocalTime();
}
static internal TimeSpan GetTimeoutFromTimeUnit(int timeoutValue, TimeUnit timeoutUnit) {
switch (timeoutUnit) {
case TimeUnit.Days:
return new TimeSpan(timeoutValue, 0, 0, 0);
case TimeUnit.Hours:
return new TimeSpan(timeoutValue, 0, 0);
case TimeUnit.Seconds:
return new TimeSpan(0, 0, timeoutValue);
case TimeUnit.Milliseconds:
return new TimeSpan(0, 0, 0, 0, timeoutValue);
case TimeUnit.Minutes:
return new TimeSpan(0, timeoutValue, 0);
case TimeUnit.Unknown:
default:
break;
}
throw new ArgumentException(SR.GetString(SR.InvalidArgumentValue, "timeoutUnit"));
}
}
}

View File

@ -92,7 +92,7 @@ namespace System.Web.Util
} else if ( monthIndex == (sbyte) 'R' ) {
//
// if s[1] is 'a' then [....], if 'p' then April
// if s[1] is 'a' then Microsoft, if 'p' then April
//
if ( s_monthIndexTable[(s[1 + startIndex]-0x40) & 0x3f] == (sbyte) 'A' ) {

View File

@ -158,7 +158,7 @@ namespace System.Web.Util {
Hashtable values = new Hashtable(param.Length);
for (int i = param.Length - 1; i >= 0; i--) {
SecUtility.CheckParameter(ref param[i], checkForNull, checkIfEmpty, checkForCommas, maxSize,
SecUtility.CheckParameter(ref param[i], checkForNull, checkIfEmpty, checkForCommas, maxSize,
paramName + "[ " + i.ToString(CultureInfo.InvariantCulture) + " ]");
if (values.Contains(param[i])) {
throw new ArgumentException(SR.GetString(SR.Parameter_duplicate_array_element, paramName), paramName);
@ -215,6 +215,17 @@ namespace System.Web.Util {
return iValue;
}
internal static TimeUnit GetTimeoutUnit(NameValueCollection config, string valueName, TimeUnit defaultValue) {
TimeUnit unit;
string sValue = config[valueName];
if (sValue == null || !Enum.TryParse(sValue, out unit)) {
return defaultValue;
}
return unit;
}
internal static int? GetNullableIntValue(NameValueCollection config, string valueName) {
int iValue;
string sValue = config[valueName];

View File

@ -24,6 +24,7 @@ namespace System.Web.Util {
public static readonly Version Framework452 = new Version(4, 5, 2);
public static readonly Version Framework46 = new Version(4, 6);
public static readonly Version Framework461 = new Version(4, 6, 1);
public static readonly Version Framework463 = new Version(4, 6, 3);
// Convenience accessor for the "default" framework version; various configuration
// switches can use this as a default value. This value must only be bumped during