2009-05-14 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Thu, 14 May 2009 01:18:12 +0000 (01:18 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Thu, 14 May 2009 01:18:12 +0000 (01:18 -0000)
* HandlerFactoryConfiguration.cs: if we're matching a default
handler, disallow caching.

2009-05-14  Marek Habersack  <mhabersack@novell.com>

* HttpHandlersSection.cs: if we're matching a default handler,
disallow caching.

2009-05-14  Marek Habersack  <mhabersack@novell.com>

* HttpApplication.cs: LocateHandler won't cache if a default
handler was returned.

svn path=/trunk/mcs/; revision=134097

mcs/class/System.Web/System.Web.Configuration/ChangeLog
mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs
mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
mcs/class/System.Web/System.Web.Configuration_2.0/HttpHandlersSection.cs
mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HttpApplication.cs

index befa2ebf77349d8cf31d7bd73dda6fc3d1a96053..7e3278905146d6437571385b7aadcf7c283a8aa3 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-14  Marek Habersack  <mhabersack@novell.com>
+
+       * HandlerFactoryConfiguration.cs: if we're matching a default
+       handler, disallow caching.
+
 2009-01-08  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * HandlerFactoryConfiguration.cs: Allow handlers with non-public
index d049d38332ebf63d463545867e495064ae558daa..0e90f7f84a63f6ef48b8935d1aca27cdeeb10e53 100644 (file)
@@ -184,7 +184,7 @@ namespace System.Web.Configuration {
                        return false;
                }
 
-               public object LocateHandler (string verb, string filepath)
+               public object LocateHandler (string verb, string filepath, out bool allowCache)
                {
                        int start, end;
                        int count = handlers.Count;
@@ -197,8 +197,10 @@ namespace System.Web.Configuration {
                                        HttpHandler handler = (HttpHandler) handlers [i];
 
                                        if (handler.Verbs == null){
-                                               if (handler.PathMatches (filepath))
+                                               if (handler.PathMatches (filepath)) {
+                                                       allowCache = handler.OriginalPath != "*";
                                                        return handler.GetHandlerInstance ();
+                                               }
                                                continue;
                                        }
 
@@ -207,12 +209,15 @@ namespace System.Web.Configuration {
                                                j--;
                                                if (verbs [j] != verb)
                                                        continue;
-                                               if (handler.PathMatches (filepath))
+                                               if (handler.PathMatches (filepath)) {
+                                                       allowCache = handler.OriginalPath != "*";
                                                        return handler.GetHandlerInstance ();
+                                               }
                                        }
                                }
                        }
 
+                       allowCache = false;
                        return null;
                }
        }
index f829bc62f6df46015f4078fef20cd0b03a5da9f6..40eee9ae889baf9d82093cdf164e54f722104e02 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-14  Marek Habersack  <mhabersack@novell.com>
+
+       * HttpHandlersSection.cs: if we're matching a default handler,
+       disallow caching.
+
 2009-04-03  Marek Habersack  <mhabersack@novell.com>
 
        * WebConfigurationManager.cs: added code in the static constructor
index f7b28901d2d256062975981eabe6cab4882cce6f..2625dc1a90be037c7d175815d926bc5e217076eb 100644 (file)
@@ -66,17 +66,19 @@ namespace System.Web.Configuration
                }
 
 #region CompatabilityCode
-               internal object LocateHandler (string verb, string filepath)
+               internal object LocateHandler (string verb, string filepath, out bool allowCache)
                {
                        int top = Handlers.Count;
-
+                       
                        for (int i = 0; i < top; i++){
                                HttpHandlerAction handler = (HttpHandlerAction) Handlers [i];
 
                                string[] verbs = handler.Verbs;
                                if (verbs == null){
-                                       if (handler.PathMatches (filepath))
+                                       if (handler.PathMatches (filepath)) {
+                                               allowCache = handler.Path != "*";
                                                return handler.GetHandlerInstance ();
+                                       }
                                        continue;
                                }
 
@@ -84,11 +86,14 @@ namespace System.Web.Configuration
                                        j--;
                                        if (verbs [j] != verb)
                                                continue;
-                                       if (handler.PathMatches (filepath))
+                                       if (handler.PathMatches (filepath)) {
+                                               allowCache = handler.Path != "*";
                                                return handler.GetHandlerInstance ();
+                                       }
                                }
                        }
 
+                       allowCache = false;
                        return null;
                }
 #endregion
index 7f0b9f3de8121da7ec8c3aff81424cf16ac3e00c..0f82fb22dd12bd9ab3b2d32eae79209d6b092eb4 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-14  Marek Habersack  <mhabersack@novell.com>
+
+       * HttpApplication.cs: LocateHandler won't cache if a default
+       handler was returned.
+
 2009-05-07 Gonzalo Paniagua Javier <gonzalo@novell.com>
 
        * MimeTypes.cs: add silverlight related types.
index a36a0443af0b395cd4ddd7e4113b51d15f55235c..3b6677d5144ad4a7a4cf061fac378f85511ae768 100644 (file)
@@ -1597,17 +1597,18 @@ namespace System.Web {
 
                        if (ret != null)
                                return ret;
-                       
+
+                       bool allowCache;
 #if NET_2_0
                        HttpHandlersSection httpHandlersSection = (HttpHandlersSection) WebConfigurationManager.GetWebApplicationSection ("system.web/httpHandlers");
-                       ret = httpHandlersSection.LocateHandler (verb, url);
+                       ret = httpHandlersSection.LocateHandler (verb, url, out allowCache);
 #else
                        HandlerFactoryConfiguration factory_config = (HandlerFactoryConfiguration) HttpContext.GetAppConfig ("system.web/httpHandlers");
-                       ret = factory_config.LocateHandler (verb, url);
+                       ret = factory_config.LocateHandler (verb, url, out allowCache);
 #endif
 
                        IHttpHandler handler = ret as IHttpHandler;
-                       if (handler != null && handler.IsReusable)
+                       if (allowCache && handler != null && handler.IsReusable)
                                cache [id] = ret;
                        
                        return ret;
@@ -1631,7 +1632,6 @@ namespace System.Web {
                        object o = LocateHandler (verb, url);
                        
                        factory = o as IHttpHandlerFactory;
-                       
                        if (factory == null) {
                                handler = (IHttpHandler) o;
                        } else {