Author: robertj
Date: 2006-03-19 10:18:57 -0500 (Sun, 19 Mar 2006)
New Revision: 58154
Modified:
branches/mono-1-1-13/mcs/class/System.Web/System.Web.Caching/ChangeLog
branches/mono-1-1-13/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs
branches/mono-1-1-13/mcs/class/System.Web/System.Web/ChangeLog
branches/mono-1-1-13/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
Log:
Backport from HEAD r58152:58153
Modified: branches/mono-1-1-13/mcs/class/System.Web/System.Web/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/System.Web/System.Web/ChangeLog
2006-03-19 15:15:15 UTC (rev 58153)
+++ branches/mono-1-1-13/mcs/class/System.Web/System.Web/ChangeLog
2006-03-19 15:18:57 UTC (rev 58154)
@@ -1,3 +1,8 @@
+2006-03-18 Robert Jordan <[EMAIL PROTECTED]>
+
+ * HttpCachePolicy.cs: expose the validation callbacks.
+ Fixes bug #77825.
+
2006-03-18 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* HttpApplication.cs: fix upper bound when iterating through the module
Modified:
branches/mono-1-1-13/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
2006-03-19 15:15:15 UTC (rev 58153)
+++ branches/mono-1-1-13/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
2006-03-19 15:18:57 UTC (rev 58154)
@@ -113,6 +113,10 @@
get { return expire_date; }
}
+ internal ArrayList ValidationCallbacks {
+ get { return validation_callbacks; }
+ }
+
#endregion // Properties
#region Methods
Modified: branches/mono-1-1-13/mcs/class/System.Web/System.Web.Caching/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/System.Web/System.Web.Caching/ChangeLog
2006-03-19 15:15:15 UTC (rev 58153)
+++ branches/mono-1-1-13/mcs/class/System.Web/System.Web.Caching/ChangeLog
2006-03-19 15:18:57 UTC (rev 58154)
@@ -1,3 +1,8 @@
+2006-03-18 Robert Jordan <[EMAIL PROTECTED]>
+
+ * OutputCacheModule.cs: invoke the validation callbacks of
+ HttpCachePolicy. Fixes bug #77825.
+
2006-03-14 Robert Jordan <[EMAIL PROTECTED]>
* CachedVaryBy.cs: Fixed VaryByParam="*". Replaced request.Param
Modified:
branches/mono-1-1-13/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs
2006-03-19 15:15:15 UTC (rev 58153)
+++
branches/mono-1-1-13/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs
2006-03-19 15:18:57 UTC (rev 58154)
@@ -30,6 +30,7 @@
using System.IO;
using System.Web;
+using System.Web.UI;
using System.Web.Util;
using System.Collections;
@@ -70,21 +71,55 @@
key = varyby.CreateKey (vary_key, context);
c = context.Cache [key] as CachedRawResponse;
+
+ if (c == null)
+ return;
+
+ ArrayList callbacks = c.Policy.ValidationCallbacks;
+ if (callbacks != null && callbacks.Count > 0) {
+ bool isValid = true;
+ bool isIgnored = false;
+
+ foreach (Pair p in callbacks) {
+ HttpCacheValidateHandler validate =
(HttpCacheValidateHandler)p.First;
+ object data = p.Second;
+ HttpValidationStatus status =
HttpValidationStatus.Valid;
+
+ try {
+ validate (context, data, ref
status);
+ } catch {
+ // MS.NET hides the exception
+ isValid = false;
+ break;
+ }
+
+ if (status ==
HttpValidationStatus.Invalid) {
+ isValid = false;
+ break;
+ } else if (status ==
HttpValidationStatus.IgnoreThisRequest) {
+ isIgnored = true;
+ }
+ }
+
+ if (!isValid) {
+ OnRawResponseRemoved (key, c,
CacheItemRemovedReason.Removed);
+ return;
+ } else if (isIgnored) {
+ return;
+ }
+ }
- if (c != null) {
-
- context.Response.ClearContent ();
- context.Response.BinaryWrite (c.GetData (), 0,
c.ContentLength);
+ context.Response.ClearContent ();
+ context.Response.BinaryWrite (c.GetData (), 0,
c.ContentLength);
- context.Response.ClearHeaders ();
- c.DateHeader.Value = TimeUtil.ToUtcTimeString
(DateTime.Now);
- context.Response.SetCachedHeaders (c.Headers);
+ context.Response.ClearHeaders ();
+ c.DateHeader.Value = TimeUtil.ToUtcTimeString
(DateTime.Now);
+ context.Response.SetCachedHeaders (c.Headers);
- context.Response.StatusCode = c.StatusCode;
- context.Response.StatusDescription =
c.StatusDescription;
+ context.Response.StatusCode = c.StatusCode;
+ context.Response.StatusDescription =
c.StatusDescription;
- app.CompleteRequest ();
- }
+ app.CompleteRequest ();
}
void OnUpdateRequestCache (object o, EventArgs args)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches