Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@@ -140,6 +140,10 @@ namespace System.Web {
// Event signals that ASP.NET has started processing a request.
// Overload used only for deducing ETW parameters; use the public entry point instead.
//
// Visual Studio Online #222067 - This event is hardcoded to opt-out of EventSource activityID tracking.
// This would normally be done by setting ActivityOptions = EventActivityOptions.Disable in the
// Event attribute, but this causes a dependency between System.Web and mscorlib that breaks servicing.
//
// !! WARNING !!
// The logic in RequestStartedImpl must be kept in [....] with these parameters, otherwise
// type safety violations could occur.
@@ -150,6 +154,10 @@ namespace System.Web {
}
// Event signals that ASP.NET has completed processing a request.
//
// Visual Studio Online #222067 - This event is hardcoded to opt-out of EventSource activityID tracking.
// This would normally be done by setting ActivityOptions = EventActivityOptions.Disable in the
// Event attribute, but this causes a dependency between System.Web and mscorlib that breaks servicing.
[Event((int)Events.RequestCompleted, Level = EventLevel.Informational, Task = (EventTask)Tasks.Request, Opcode = EventOpcode.Stop, Version = 1)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void RequestCompleted() {

View File

@@ -909,10 +909,11 @@ namespace System.Web.Caching {
return false;
}
//
// This method will return only the file dependencies from this dependency
//
internal virtual string[] GetFileDependencies()
/// <summary>
/// This method will return only the file dependencies from this dependency
/// </summary>
/// <returns></returns>
public virtual string[] GetFileDependencies()
{
#if USE_MEMORY_CACHE
if (CacheInternal.UseMemoryCache) {
@@ -1121,11 +1122,12 @@ namespace System.Web.Caching {
return true;
}
//
// This method will return only the file dependencies from this dependency
//
internal override string[] GetFileDependencies()
/// <summary>
/// This method will return only the file dependencies from this dependency
/// </summary>
/// <returns></returns>
public override string[] GetFileDependencies()
{
ArrayList fileNames = null;
CacheDependency[] dependencies = null;

View File

@@ -10,6 +10,7 @@ namespace System.Web.Caching {
internal class SRef {
private static Type s_type = Type.GetType("System.SizedReference", true, false);
private Object _sizedRef;
private long _lastReportedSize; // This helps tremendously when looking at large dumps
internal SRef(Object target) {
_sizedRef = HttpRuntime.CreateNonPublicInstance(s_type, new object[] {target});
@@ -24,7 +25,7 @@ namespace System.Web.Caching {
_sizedRef, // target
null, // args
CultureInfo.InvariantCulture);
return (long) o;
return _lastReportedSize = (long) o;
}
}

View File

@@ -519,13 +519,14 @@ namespace System.Web.Caching {
internal Cache _cachePublic;
internal protected CacheMemoryStats _cacheMemoryStats;
private object _timerLock = new object();
private Timer _timer;
private DisposableGCHandleRef<Timer> _timerHandleRef;
private int _currentPollInterval = MEMORYSTATUS_INTERVAL_30_SECONDS;
internal int _inCacheManagerThread;
internal bool _enableMemoryCollection;
internal bool _enableExpiration;
internal bool _internalConfigRead;
internal SRefMultiple _srefMultiple;
private int _disposed = 0;
internal CacheCommon() {
_cachePublic = new Cache(0);
@@ -537,13 +538,16 @@ namespace System.Web.Caching {
internal void Dispose(bool disposing) {
if (disposing) {
EnableCacheMemoryTimer(false);
_cacheMemoryStats.Dispose();
// This method must be tolerant to multiple calls to Dispose on the same instance
if (Interlocked.Exchange(ref _disposed, 1) == 0) {
EnableCacheMemoryTimer(false);
_cacheMemoryStats.Dispose();
}
}
}
internal void AddSRefTarget(CacheInternal c) {
_srefMultiple.AddSRefTarget(c);
internal void AddSRefTarget(object o) {
_srefMultiple.AddSRefTarget(o);
}
internal void SetCacheInternal(CacheInternal cacheInternal) {
@@ -591,19 +595,20 @@ namespace System.Web.Caching {
if (enable) {
if (_timer == null) {
if (_timerHandleRef == null) {
// <cache privateBytesPollTime> has not been read yet
_timer = new Timer(new TimerCallback(this.CacheManagerTimerCallback), null, _currentPollInterval, _currentPollInterval);
Timer timer = new Timer(new TimerCallback(this.CacheManagerTimerCallback), null, _currentPollInterval, _currentPollInterval);
_timerHandleRef = new DisposableGCHandleRef<Timer>(timer);
Debug.Trace("Cache", "Started CacheMemoryTimers");
}
else {
_timer.Change(_currentPollInterval, _currentPollInterval);
_timerHandleRef.Target.Change(_currentPollInterval, _currentPollInterval);
}
}
else {
Timer timer = _timer;
if (timer != null && Interlocked.CompareExchange(ref _timer, null, timer) == timer) {
timer.Dispose();
var timerHandleRef = _timerHandleRef;
if (timerHandleRef != null && Interlocked.CompareExchange(ref _timerHandleRef, null, timerHandleRef) == timerHandleRef) {
timerHandleRef.Dispose();
Debug.Trace("Cache", "Stopped CacheMemoryTimers");
}
}
@@ -620,7 +625,7 @@ namespace System.Web.Caching {
void AdjustTimer() {
lock (_timerLock) {
if (_timer == null)
if (_timerHandleRef == null)
return;
// the order of these if statements is important
@@ -629,7 +634,7 @@ namespace System.Web.Caching {
if (_cacheMemoryStats.IsAboveHighPressure()) {
if (_currentPollInterval > MEMORYSTATUS_INTERVAL_5_SECONDS) {
_currentPollInterval = MEMORYSTATUS_INTERVAL_5_SECONDS;
_timer.Change(_currentPollInterval, _currentPollInterval);
_timerHandleRef.Target.Change(_currentPollInterval, _currentPollInterval);
}
return;
}
@@ -641,7 +646,7 @@ namespace System.Web.Caching {
int newPollInterval = Math.Min(CacheMemorySizePressure.PollInterval, MEMORYSTATUS_INTERVAL_30_SECONDS);
if (_currentPollInterval != newPollInterval) {
_currentPollInterval = newPollInterval;
_timer.Change(_currentPollInterval, _currentPollInterval);
_timerHandleRef.Target.Change(_currentPollInterval, _currentPollInterval);
}
return;
}
@@ -649,7 +654,7 @@ namespace System.Web.Caching {
// there is no pressure, interval should be the value from config
if (_currentPollInterval != CacheMemorySizePressure.PollInterval) {
_currentPollInterval = CacheMemorySizePressure.PollInterval;
_timer.Change(_currentPollInterval, _currentPollInterval);
_timerHandleRef.Target.Change(_currentPollInterval, _currentPollInterval);
}
}
}
@@ -666,7 +671,7 @@ namespace System.Web.Caching {
#endif
try {
// Dev10 633335: if the timer has been disposed, return without doing anything
if (_timer == null)
if (_timerHandleRef == null)
return 0;
// The timer thread must always call Update so that the CacheManager
@@ -1188,7 +1193,7 @@ namespace System.Web.Caching {
_usage = new CacheUsage(this);
_lock = new object();
_insertBlock = new ManualResetEvent(true);
cacheCommon.AddSRefTarget(this);
cacheCommon.AddSRefTarget(new { _entries, _expires, _usage });
}
/*
@@ -1880,24 +1885,32 @@ namespace System.Web.Caching {
class CacheMultiple : CacheInternal {
int _disposed;
CacheSingle[] _caches;
DisposableGCHandleRef<CacheSingle>[] _cachesRefs;
int _cacheIndexMask;
internal CacheMultiple(CacheCommon cacheCommon, int numSingleCaches) : base(cacheCommon) {
Debug.Assert(numSingleCaches > 1, "numSingleCaches is not greater than 1");
Debug.Assert((numSingleCaches & (numSingleCaches - 1)) == 0, "numSingleCaches is not a power of 2");
_cacheIndexMask = numSingleCaches - 1;
_caches = new CacheSingle[numSingleCaches];
// Each CacheSingle will have its own SRef reporting the size of the data it references.
// Objects in this CacheSingle may have refs to the root Cache and therefore reference other instances of CacheSingle.
// This leads to an unbalanced tree of SRefs and makes GC less efficient while calculating multiple SRefs on multiple cores.
// Using DisposableGCHandleRef here prevents SRefs from calculating data that does not belong to other CacheSingle instances.
_cachesRefs = new DisposableGCHandleRef<CacheSingle>[numSingleCaches];
for (int i = 0; i < numSingleCaches; i++) {
_caches[i] = new CacheSingle(cacheCommon, this, i);
_cachesRefs[i] = new DisposableGCHandleRef<CacheSingle>(new CacheSingle(cacheCommon, this, i));
}
}
protected override void Dispose(bool disposing) {
if (disposing) {
if (Interlocked.Exchange(ref _disposed, 1) == 0) {
foreach (CacheSingle cacheSingle in _caches) {
cacheSingle.Dispose();
foreach (var cacheSingleRef in _cachesRefs) {
// Unfortunately the application shutdown logic allows user to access cache even after its disposal.
// We'll keep the GCHandle inside cacheSingleRef until it gets reclaimed during appdomain shutdown.
// And we'll only dispose the Target to preserve the old behavior.
cacheSingleRef.Target.Dispose();
}
}
}
@@ -1908,8 +1921,8 @@ namespace System.Web.Caching {
internal override int PublicCount {
get {
int count = 0;
foreach (CacheSingle cacheSingle in _caches) {
count += cacheSingle.PublicCount;
foreach (var cacheSingleRef in _cachesRefs) {
count += cacheSingleRef.Target.PublicCount;
}
return count;
@@ -1919,8 +1932,8 @@ namespace System.Web.Caching {
internal override long TotalCount {
get {
long count = 0;
foreach (CacheSingle cacheSingle in _caches) {
count += cacheSingle.TotalCount;
foreach (var cacheSingleRef in _cachesRefs) {
count += cacheSingleRef.Target.TotalCount;
}
return count;
@@ -1928,22 +1941,23 @@ namespace System.Web.Caching {
}
internal override IDictionaryEnumerator CreateEnumerator() {
IDictionaryEnumerator[] enumerators = new IDictionaryEnumerator[_caches.Length];
for (int i = 0, c = _caches.Length; i < c; i++) {
enumerators[i] = _caches[i].CreateEnumerator();
IDictionaryEnumerator[] enumerators = new IDictionaryEnumerator[_cachesRefs.Length];
for (int i = 0, c = _cachesRefs.Length; i < c; i++) {
enumerators[i] = _cachesRefs[i].Target.CreateEnumerator();
}
return new AggregateEnumerator(enumerators);
}
internal CacheSingle GetCacheSingle(int hashCode) {
Debug.Assert(_caches != null && _caches.Length != 0);
Debug.Assert(_cachesRefs != null && _cachesRefs.Length != 0);
// Dev10 865907: Math.Abs throws OverflowException for Int32.MinValue
if (hashCode < 0) {
hashCode = (hashCode == Int32.MinValue) ? 0 : -hashCode;
}
int index = (hashCode & _cacheIndexMask);
return _caches[index];
Debug.Assert(_cachesRefs[index].Target != null);
return _cachesRefs[index].Target;
}
internal override CacheEntry UpdateCache(
@@ -1960,15 +1974,15 @@ namespace System.Web.Caching {
internal override long TrimIfNecessary(int percent) {
long count = 0;
foreach (CacheSingle cacheSingle in _caches) {
count += cacheSingle.TrimIfNecessary(percent);
foreach (var cacheSingleRef in _cachesRefs) {
count += cacheSingleRef.Target.TrimIfNecessary(percent);
}
return count;
}
internal override void EnableExpirationTimer(bool enable) {
foreach (CacheSingle cacheSingle in _caches) {
cacheSingle.EnableExpirationTimer(enable);
foreach (var cacheSingleRef in _cachesRefs) {
cacheSingleRef.Target.EnableExpirationTimer(enable);
}
}
}

View File

@@ -1 +1 @@
9f26b6ed449d60e2c96baeff70f3bf474eaf9ecf
65f0272002f410cb2fa2a9ac6d2b7c2ef979c154

View File

@@ -61,6 +61,7 @@ internal class PreservationFileReader {
}
[SuppressMessage("Microsoft.Security", "MSEC1207:UseXmlReaderForLoad", Justification = "Xml file is created by us and only accessible to admins.")]
[SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Xml file is created by us and only accessible to admins.")]
private BuildResult ReadFileInternal(VirtualPath virtualPath, string preservationFile, long hashCode, bool ensureIsUpToDate) {
XmlDocument doc = new XmlDocument();

View File

@@ -30,6 +30,7 @@ using TypedDataSetGenerator=System.Data.Design.TypedDataSetGenerator;
internal class XsdBuildProvider: BuildProvider {
[SuppressMessage("Microsoft.Security", "MSEC1207:UseXmlReaderForLoad", Justification = "Developer-controlled .xsd files in application directory are implicitly trusted by ASP.Net.")]
[SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Developer-controlled .xml files in application directory are implicitly trusted by ASP.Net.")]
public override void GenerateCode(AssemblyBuilder assemblyBuilder) {
#if !FEATURE_PAL // FEATURE_PAL does not support System.Data.Design
// Get the namespace that we will use

View File

@@ -32,6 +32,7 @@ namespace System.Web.Configuration {
using Microsoft.Build.Utilities;
using Microsoft.CSharp;
using System.Diagnostics.CodeAnalysis;
[PermissionSet(SecurityAction.LinkDemand, Unrestricted = true)]
[PermissionSet(SecurityAction.InheritanceDemand, Unrestricted = true)]
@@ -400,6 +401,7 @@ namespace System.Web.Configuration {
return false;
}
[SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Developer-controlled .xml files in application directory are implicitly trusted by ASP.Net.")]
protected void ProcessBrowserFiles(bool useVirtualPath, string virtualDir) {
_browserTree = new BrowserTree();
_defaultTree = new BrowserTree();
@@ -507,6 +509,7 @@ namespace System.Web.Configuration {
ProcessCustomBrowserFiles(false, String.Empty);
}
[SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Developer-controlled .xml files in application directory are implicitly trusted by ASP.Net.")]
internal void ProcessCustomBrowserFiles(bool useVirtualPath, string virtualDir) {
//get all custom browser files and put them in the "tree"
DirectoryInfo browserDirInfo = null;

View File

@@ -8,6 +8,7 @@ namespace System.Web.Configuration {
using System.Collections;
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Security;
using System.Security.Permissions;
@@ -15,7 +16,6 @@ namespace System.Web.Configuration {
using System.Web.Configuration;
using System.Web.Util;
using System.Xml;
using Pair = System.Web.UI.Pair;
//
@@ -276,6 +276,7 @@ namespace System.Web.Configuration {
//
// ResolveFiles - parse files referenced with <file src="" />
//
[SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Developer-controlled .xml files in application directory are implicitly trusted by ASP.Net.")]
static void ResolveFiles(ParseState parseState, object configurationContext) {
//

View File

@@ -21,6 +21,7 @@ namespace System.Web.Configuration {
using System.Security.AccessControl;
#endif // !FEATURE_PAL
using System.Security.Permissions;
using System.Diagnostics.CodeAnalysis;
#if !FEATURE_PAL // FEATURE_PAL does not enable COM
@@ -215,6 +216,7 @@ namespace System.Web.Configuration {
return sb.ToString();
}
[SuppressMessage("Microsoft.Security.Xml", "CA3057:DoNotUseLoadXml", Justification = "Developer-controlled xml contents are implicitly trusted by ASP.Net.")]
public string DoEncryptOrDecrypt(bool doEncrypt, string xmlString, string protectionProviderName, string protectionProviderType, string[] paramKeys, string[] paramValues)
{
Type t = Type.GetType(protectionProviderType, true);

View File

@@ -6,11 +6,21 @@
namespace System.Web.Handlers {
using System;
using System.Threading.Tasks;
using System.Web.Hosting;
internal class TransferRequestHandler : IHttpHandler {
public void ProcessRequest(HttpContext context) {
internal class TransferRequestHandler : IHttpAsyncHandler {
public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
{
return TaskAsyncHelper.BeginTask(() => ProcessRequestAsync(context), cb, extraData);
}
public void EndProcessRequest(IAsyncResult result)
{
TaskAsyncHelper.EndTask(result);
}
private Task ProcessRequestAsync(HttpContext context) {
IIS7WorkerRequest wr = context.WorkerRequest as IIS7WorkerRequest;
if (wr == null) {
throw new PlatformNotSupportedException(SR.GetString(SR.Requires_Iis_Integrated_Mode));
@@ -24,14 +34,26 @@ namespace System.Web.Handlers {
context.Request.EntityBody,
null,
preserveUser: false);
// force the completion of the current request so that the
// child execution can be performed immediately after unwind
context.ApplicationInstance.EnsureReleaseState();
var releaseStateTask = context.ApplicationInstance.EnsureReleaseStateAsync();
// DevDiv Bugs 162750: IIS7 Integrated Mode: TransferRequest performance issue
// Instead of calling Response.End we call HttpApplication.CompleteRequest()
context.ApplicationInstance.CompleteRequest();
if (releaseStateTask.IsCompleted) {
context.ApplicationInstance.CompleteRequest();
return TaskAsyncHelper.CompletedTask;
}
else {
return releaseStateTask.ContinueWith((_) => context.ApplicationInstance.CompleteRequest());
}
}
public void ProcessRequest(HttpContext context)
{
string errorMessage = SR.GetString(SR.HttpTaskAsyncHandler_CannotExecuteSynchronously, GetType());
throw new NotSupportedException(errorMessage);
}
public bool IsReusable {

View File

@@ -82,6 +82,9 @@ namespace System.Web.Hosting {
// delegate OnRespondToPing
private WaitCallback _onRespondToPingWaitCallback;
// flag indicates whether any fatal exception has been recorded
private bool _fatalExceptionRecorded = false;
// single instance of app manager
private static ApplicationManager _theAppManager;
@@ -154,6 +157,16 @@ namespace System.Web.Hosting {
}
}
private bool FatalExceptionRecorded
{
get {
return _fatalExceptionRecorded;
}
set {
_fatalExceptionRecorded = value;
}
}
internal static void RecordFatalException(Exception e) {
RecordFatalException(AppDomain.CurrentDomain, e);
}
@@ -168,7 +181,7 @@ namespace System.Web.Hosting {
}
}
private static void OnUnhandledException(Object sender, UnhandledExceptionEventArgs eventArgs) {
internal static void OnUnhandledException(Object sender, UnhandledExceptionEventArgs eventArgs) {
// if the CLR is not terminating, ignore the notification
if (!eventArgs.IsTerminating) {
return;
@@ -184,6 +197,15 @@ namespace System.Web.Hosting {
return;
}
// If any fatal exception was recorded in applicaiton AppDomains,
// we wouldn't record exceptions in the default AppDomain.
var appManager = GetApplicationManager();
if (AppDomain.CurrentDomain.IsDefaultAppDomain() && appManager.FatalExceptionRecorded) {
return;
}
appManager.FatalExceptionRecorded = true;
RecordFatalException(appDomain, exception);
}

View File

@@ -184,6 +184,11 @@ namespace System.Web.Hosting {
// start watching for app domain unloading
_onAppDomainUnload = new EventHandler(OnAppDomainUnload);
Thread.GetDomain().DomainUnload += _onAppDomainUnload;
// VSO 160528: We used to listen to the default AppDomain's UnhandledException only.
// However, non-serializable exceptions cannot be passed to the default domain. Therefore
// we should try to log exceptions in application AppDomains.
Thread.GetDomain().UnhandledException += new UnhandledExceptionEventHandler(ApplicationManager.OnUnhandledException);
}
internal long TrimCache(int percent) {

View File

@@ -1 +1 @@
eff422558e332b96b845c2f140b46d0117076596
41564928cced4f99e96ceacbe00249c8cc3066cd

View File

@@ -39,10 +39,11 @@ namespace System.Web {
_ignoreParams = -1;
}
/*
* Reset based on the cached vary headers.
*/
internal void ResetFromParams(String[] parameters) {
/// <summary>
/// Set the Parameters in Cache Vary
/// </summary>
/// <param name="parameters"></param>
public void SetParams(string[] parameters) {
int i, n;
Reset();
@@ -75,16 +76,20 @@ namespace System.Web {
return _ignoreParams == 1 || _paramsStar || _parameters != null;
}
internal String[] GetParams() {
String[] s = null;
/// <summary>
/// Get the Parameters in Cache Vary
/// </summary>
/// <returns></returns>
public string[] GetParams() {
string[] s = null;
Object item;
int i, j, c, n;
if (_ignoreParams == 1) {
s = new String[1] {String.Empty};
s = new string[1] {string.Empty};
}
else if (_paramsStar) {
s = new String[1] {"*"};
s = new string[1] {"*"};
}
else if (_parameters != null) {
n = _parameters.Size;
@@ -102,7 +107,7 @@ namespace System.Web {
for (i = 0; i < n; i++) {
item = _parameters.GetValue(i);
if (item != null) {
s[j] = (String) item;
s[j] = (string) item;
j++;
}
}
@@ -116,7 +121,7 @@ namespace System.Web {
//
// Public methods and properties
//
//
/// <devdoc>

View File

@@ -30,7 +30,7 @@ namespace System.Web {
//
// Public constants for cache-control
//
/// <devdoc>
/// <para>
@@ -573,12 +573,10 @@ namespace System.Web {
int i, n;
string[] fields;
_utcTimestampRequest = utcTimestampRequest;
_varyByContentEncodings.ResetFromContentEncodings(settings.VaryByContentEncodings);
_varyByHeaders.ResetFromHeaders(settings.VaryByHeaders);
_varyByParams.ResetFromParams(settings.VaryByParams);
_varyByContentEncodings.SetContentEncodings(settings.VaryByContentEncodings);
_varyByHeaders.SetHeaders(settings.VaryByHeaders);
_varyByParams.SetParams(settings.VaryByParams);
_isModified = settings.IsModified;
_hasSetCookieHeader = settings.hasSetCookieHeader;
@@ -645,7 +643,11 @@ namespace System.Web {
}
}
internal bool IsModified() {
/// <summary>
/// Return true if the CachePolicy has been modified
/// </summary>
/// <returns></returns>
public bool IsModified() {
return _isModified || _varyByContentEncodings.IsModified() || _varyByHeaders.IsModified() || _varyByParams.IsModified();
}
@@ -771,20 +773,18 @@ namespace System.Web {
return;
}
Debug.Assert((_utcTimestampCreated == DateTime.MinValue && _utcTimestampRequest == DateTime.MinValue) ||
(_utcTimestampCreated != DateTime.MinValue && _utcTimestampRequest != DateTime.MinValue),
"_utcTimestampCreated and _utcTimestampRequest are out of [....] in UpdateCachedHeaders");
//To enable Out of Band OutputCache Module support, we will always refresh the UtcTimestampRequest.
if (_utcTimestampCreated == DateTime.MinValue) {
_utcTimestampCreated = _utcTimestampRequest = response.Context.UtcTimestamp;
_utcTimestampCreated = response.Context.UtcTimestamp;
}
_utcTimestampRequest = response.Context.UtcTimestamp;
if (_slidingExpiration != 1) {
_slidingDelta = TimeSpan.Zero;
}
else if (_isMaxAgeSet) {
_slidingDelta = _maxAge;
}
}
else if (_isExpiresSet) {
_slidingDelta = _utcExpires - _utcTimestampCreated;
}
@@ -840,7 +840,7 @@ namespace System.Web {
}
sb.Append('\"');
}
}
if (_noStore) {
AppendValueToHeader(sb, "no-store");
@@ -1056,10 +1056,10 @@ namespace System.Web {
headers.Add(_headerVaryBy);
}
}
/*
* Public methods
*/
* Public methods
*/
internal HttpCachePolicySettings GetCurrentSettings(HttpResponse response) {
String[] varyByContentEncodings;
@@ -1191,6 +1191,16 @@ namespace System.Web {
return absoluteExpiration;
}
// Expose this property to OutputCacheUtility class
// In order to enable Out of Band output cache module to access the Validation Callback Info
internal IEnumerable GetValidationCallbacks() {
if (_validationCallbackInfo == null) {
return new ArrayList();
}
return _validationCallbackInfo;
}
/*
* Cache at server?
*/
@@ -1203,7 +1213,11 @@ namespace System.Web {
_noServerCaching = true;
}
internal bool GetNoServerCaching() {
/// <summary>
/// Return True if we should stops all server caching for current response
/// </summary>
/// <returns></returns>
public bool GetNoServerCaching() {
return _noServerCaching;
}
@@ -1229,6 +1243,13 @@ namespace System.Web {
_varyByCustom = custom;
}
/// <summary>
/// Get the Vary by Custom Value
/// </summary>
/// <returns></returns>
public string GetVaryByCustom() {
return _varyByCustom;
}
/*
* Cache-Control: extension
*/
@@ -1250,6 +1271,14 @@ namespace System.Web {
}
}
/// <summary>
/// Get Cache Extensions Value
/// </summary>
/// <returns></returns>
public string GetCacheExtensions() {
return _cacheExtension;
}
/*
* Cache-Control: no-transform
*/
@@ -1263,11 +1292,27 @@ namespace System.Web {
_noTransforms = true;
}
/// <summary>
/// Return true if No-transform directive, enables the sending of the CacheControl
/// </summary>
/// <returns></returns>
public bool GetNoTransforms() {
return _noTransforms;
}
internal void SetIgnoreRangeRequests() {
Dirtied();
_ignoreRangeRequests = true;
}
/// <summary>
/// Return true if ignore range request
/// </summary>
/// <returns></returns>
public bool GetIgnoreRangeRequests() {
return _ignoreRangeRequests;
}
/// <devdoc>
/// <para>Contains policy for the Vary: header.</para>
/// </devdoc>
@@ -1320,11 +1365,15 @@ namespace System.Web {
}
}
internal HttpCacheability GetCacheability() {
/// <summary>
/// Get the Cache-control (public, private and no-cache) directive
/// </summary>
/// <returns></returns>
public HttpCacheability GetCacheability() {
return _cacheability;
}
/// <devdoc>
/// <para>Sets the Cache-Control header to one of the values of HttpCacheability in
/// conjunction with a field-level exclusion directive.</para>
@@ -1376,6 +1425,14 @@ namespace System.Web {
Dirtied();
_hasUserProvidedDependencies = hasUserProvidedDependencies;
}
/// <summary>
/// return true if no store is set
/// </summary>
/// <returns></returns>
public bool GetNoStore() {
return _noStore;
}
/*
* Expiration policy.
@@ -1405,6 +1462,14 @@ namespace System.Web {
}
}
/// <summary>
/// Return the expire header as absolute expire datetime
/// </summary>
/// <returns></returns>
public DateTime GetExpires() {
return _utcExpires;
}
/*
* Cache-Control: max-age=delta-seconds
*/
@@ -1428,6 +1493,14 @@ namespace System.Web {
}
}
/// <summary>
/// Get the Cache-Control Max Age
/// </summary>
/// <returns></returns>
public TimeSpan GetMaxAge() {
return _maxAge;
}
// Suppress max-age and s-maxage in cache-control header (required for IIS6 kernel mode cache)
internal void SetNoMaxAgeInCacheControl() {
_noMaxAgeInCacheControl = true;
@@ -1452,6 +1525,14 @@ namespace System.Web {
}
}
/// <summary>
/// Get the Cache-Control: Proxy Max Age Value
/// </summary>
/// <returns></returns>
public TimeSpan GetProxyMaxAge() {
return _proxyMaxAge;
}
/*
* Sliding Expiration
*/
@@ -1470,6 +1551,17 @@ namespace System.Web {
}
}
/// <summary>
/// Return true if to make expiration sliding. that is, if cached, it should be renewed with each
/// response. This feature is identical in spirit to the IIS
/// configuration option to add an expiration header relative to the current response
/// time. This feature is identical in spirit to the IIS configuration option to add
/// an expiration header relative to the current response time.
/// </summary>
/// <returns></returns>
public bool HasSlidingExpiration() {
return _slidingExpiration == 1;
}
public void SetValidUntilExpires(bool validUntilExpires) {
if (_validUntilExpires == -1 || _validUntilExpires == 1) {
@@ -1478,6 +1570,13 @@ namespace System.Web {
}
}
/// <summary>
/// Return true if valid until expires
/// </summary>
/// <returns></returns>
public bool IsValidUntilExpires() {
return _validUntilExpires == 1;
}
public void SetAllowResponseInBrowserHistory(bool allow) {
if (_allowInHistory == -1 || _allowInHistory == 1) {
@@ -1512,7 +1611,17 @@ namespace System.Web {
}
}
/*
/// <summary>
/// Get the Cache-Control: header to reflect either the must-revalidate or
/// proxy-revalidate directives.
/// The default is to not send either of these directives unless explicitly enabled using this method.
/// </summary>
/// <returns></returns>
public HttpCacheRevalidation GetRevalidation() {
return _revalidation;
}
/*
* Etag
*/
@@ -1537,6 +1646,16 @@ namespace System.Web {
_etag = etag;
}
/// <summary>
/// Get the ETag header. Once an ETag is set,
/// subsequent attempts to set it will fail and an exception will be thrown.
/// </summary>
/// <returns></returns>
public string GetETag() {
return _etag;
}
/*
* Last-Modified: RFC Date
*/
@@ -1577,6 +1696,14 @@ namespace System.Web {
}
}
/// <summary>
/// Get the Last-Modified header.
/// </summary>
/// <returns></returns>
public DateTime GetUtcLastModified() {
return _utcLastModified;
}
/// <devdoc>
/// <para>Sets the Last-Modified: header based on the timestamps of the
@@ -1587,6 +1714,15 @@ namespace System.Web {
_generateLastModifiedFromFiles = true;
}
/// <summary>
/// Return true if the Last-Modified header is set to base on the timestamps of the
/// file dependencies of the handler.
/// </summary>
/// <returns></returns>
public bool GetLastModifiedFromFileDependencies() {
return _generateLastModifiedFromFiles;
}
/// <devdoc>
/// <para>Sets the Etag header based on the timestamps of the file
@@ -1601,6 +1737,14 @@ namespace System.Web {
_generateEtagFromFiles = true;
}
/// <summary>
/// Return true if the Etag header has been set to base on the timestamps of the file
/// dependencies of the handler
/// </summary>
/// <returns></returns>
public bool GetETagFromFileDependencies() {
return _generateEtagFromFiles;
}
public void SetOmitVaryStar(bool omit) {
Dirtied();
@@ -1610,6 +1754,13 @@ namespace System.Web {
}
}
/// <summary>
/// Return true if to omit Vary Star
/// </summary>
/// <returns></returns>
public int GetOmitVaryStar() {
return _omitVaryStar;
}
/// <devdoc>
/// <para>Registers a validation callback for the current response.</para>
@@ -1628,5 +1779,16 @@ namespace System.Web {
_validationCallbackInfo.Add(new ValidationCallbackInfo(handler, data));
}
/// <summary>
/// Utc Timestamp Created
/// </summary>
public DateTime UtcTimestampCreated {
get {
return _utcTimestampCreated;
}
set {
_utcTimestampCreated = value;
}
}
}
}

View File

@@ -37,10 +37,12 @@ namespace System.Web {
_headers = null;
}
/*
* Reset based on the cached vary headers.
*/
internal void ResetFromHeaders(String[] headers) {
/// <summary>
/// Set the Headers in Cache Vary
/// </summary>
/// <param name="headers"></param>
public void SetHeaders(string[] headers) {
int i, n;
if (headers == null) {
@@ -48,7 +50,7 @@ namespace System.Web {
_varyStar = false;
_headers = null;
}
else {
else {
_isModified = true;
if (headers[0].Equals("*")) {
Debug.Assert(headers.Length == 1, "headers.Length == 1");
@@ -97,19 +99,19 @@ namespace System.Web {
return null;
}
/// <summary>
/// Get the Headers in Cache Vary
/// </summary>
/// <returns></returns>
public string[] GetHeaders() {
string[] s = null;
/*
* Returns the headers, for package access only.
*
* @return the headers.
*/
internal String[] GetHeaders() {
String[] s = null;
Object item;
int i, j, c, n;
if (_varyStar) {
return new String[1] {"*"};
return new string[1] {"*"};
}
else if (_headers != null) {
n = _headers.Size;
@@ -127,7 +129,7 @@ namespace System.Web {
for (i = 0; i < n; i++) {
item = _headers.GetValue(i);
if (item != null) {
s[j] = (String) item;
s[j] = (string) item;
j++;
}
}
@@ -138,7 +140,7 @@ namespace System.Web {
return s;
}
//
// Public methods and properties
//

View File

@@ -32,11 +32,13 @@ namespace System.Web {
_isModified = false;
_contentEncodings = null;
}
/// <summary>
/// Set the Content Encodings in Cache Vary
/// </summary>
/// <param name="contentEncodings"></param>
public void SetContentEncodings(string[] contentEncodings) {
/*
* Reset based on content encodings.
*/
internal void ResetFromContentEncodings(String[] contentEncodings) {
Reset();
if (contentEncodings != null) {
_isModified = true;
@@ -75,9 +77,18 @@ namespace System.Web {
internal bool IsModified() {
return _isModified;
}
internal String[] GetContentEncodings() {
return _contentEncodings;
/// <summary>
/// Get the Content Encodings in Cache Vary
/// </summary>
/// <returns></returns>
public string[] GetContentEncodings() {
if (_contentEncodings != null) {
string[] contentEncodings = new string[_contentEncodings.Length];
_contentEncodings.CopyTo(contentEncodings, 0);
return contentEncodings;
}
return null;
}
//

View File

@@ -22,6 +22,7 @@ namespace System.Web {
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Remoting.Messaging;
using System.Security.Permissions;
using System.Security.Principal;
@@ -1009,6 +1010,8 @@ namespace System.Web {
if (_delayedSessionState) {
lock (this) {
if (_delayedSessionState) {
Debug.Assert(_sessionStateModule != null, "_sessionStateModule != null");
// If it's not null, it means we have a delayed session state item
_sessionStateModule.InitStateStoreItem(true);
_delayedSessionState = false;
@@ -1020,8 +1023,21 @@ namespace System.Web {
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
internal void EnsureSessionStateIfNecessary() {
Debug.Assert(_sessionStateModule != null, "_sessionStateModule != null");
if (_sessionStateModule == null)
{
// If _sessionStateModule is null, we wouldn't be able to call
// _sessionStateModule.EnsureStateStoreItemLocked(), so we return here.
// _sessionStateModule could be null in the following cases,
// 1. No session state acquired.
// 2. HttpResponse.Flush() happens after session state being released.
// 3. The session state module in use is not System.Web.SessionState.SessionStateModule.
//
// This method is for the in-framework SessionStateModule only.
// OOB SessionStateModule can achieve this by using HttpResponse.AddOnSendingHeaders.
return;
}
HttpSessionState session = (HttpSessionState)Items[SessionStateUtility.SESSION_KEY];
@@ -1042,7 +1058,6 @@ namespace System.Web {
}
internal void RemoveHttpSessionStateModule() {
Debug.Assert(_sessionStateModule != null, "_sessionStateModule != null");
_delayedSessionState = false;
_sessionStateModule = null;
}

View File

@@ -1 +1 @@
b92ce62520ba19dc4df09601e85545381237d6a8
db4f721437c45c7d9fe7606f9d2221e0256a32a8

Some files were not shown because too many files have changed in this diff Show More