httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1042255 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_rewrite.xml modules/mappers/mod_rewrite.c
Date Sat, 04 Dec 2010 22:33:46 GMT
Author: covener
Date: Sat Dec  4 22:33:46 2010
New Revision: 1042255

URL: http://svn.apache.org/viewvc?rev=1042255&view=rev
Log:
PR 39313: allow the user to configure which rules come first when RewriteRules
are merged with RewriteOptions Inherit.

Submitted By: Jérôme Grandjanny <jerome.grandjanny cea.fr> 
Reviewed By: covener

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml
    httpd/httpd/trunk/modules/mappers/mod_rewrite.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1042255&r1=1042254&r2=1042255&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Dec  4 22:33:46 2010
@@ -2,6 +2,10 @@
 
 Changes with Apache 2.3.10
 
+  *) mod_rewrite: Add 'RewriteOptions InheritBefore' to put the base 
+     rules/conditions before the overridden rules/conditions.  PR 39313.
+     [Jérôme Grandjanny <jerome.grandjanny cea.fr>]
+
   *) mod_autoindex: add IndexIgnoreReset to reset the list of IndexIgnored
      filenames in higher precedence configuration sections.  PR 24243.
      [Eric Covener]

Modified: httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml?rev=1042255&r1=1042254&r2=1042255&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml Sat Dec  4 22:33:46 2010
@@ -140,7 +140,7 @@ later</compatibility>
       only be one of the following:</p>
 
       <dl>
-      <dt><code>inherit</code></dt>
+      <dt><code>Inherit</code></dt>
       <dd>
       
       <p>This forces the current configuration to inherit the
@@ -163,7 +163,16 @@ later</compatibility>
       <strong>after</strong> rules specified in the child scope.
       </note>
       </dd>
+
+      <dt><code>InheritBefore</code></dt>
+      <dd>
+      <p> Like <code>Inherit</code> above, but the rules from the parent
scope
+      are applied <strong>after</strong> rules specified in the child scope.
 
+      Available in Apache HTTP Server 2.3.10 and later.</p>
+      </dd>
+      
       </dl>
+
 </usage>
 
 </directivesynopsis>

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1042255&r1=1042254&r2=1042255&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Sat Dec  4 22:33:46 2010
@@ -187,6 +187,7 @@ static const char* really_last_key = "re
 
 #define OPTION_NONE                 1<<0
 #define OPTION_INHERIT              1<<1
+#define OPTION_INHERIT_BEFORE       1<<2
 
 #ifndef RAND_MAX
 #define RAND_MAX 32767
@@ -2745,6 +2746,18 @@ static void *config_server_merge(apr_poo
         a->rewriterules    = apr_array_append(p, overrides->rewriterules,
                                               base->rewriterules);
     }
+    else if (a->options & OPTION_INHERIT_BEFORE) {
+        /*
+         *  local directives override
+         *  and anything else is inherited (preserving order)
+         */
+        a->rewritemaps     = apr_hash_overlay(p, base->rewritemaps,
+                                              overrides->rewritemaps);
+        a->rewriteconds    = apr_array_append(p, base->rewriteconds,
+                                              overrides->rewriteconds);
+        a->rewriterules    = apr_array_append(p, base->rewriterules, 
+                                              overrides->rewriterules);
+    }
     else {
         /*
          *  local directives override
@@ -2810,6 +2823,12 @@ static void *config_perdir_merge(apr_poo
         a->rewriterules = apr_array_append(p, overrides->rewriterules,
                                            base->rewriterules);
     }
+    else if (a->options & OPTION_INHERIT_BEFORE) {
+        a->rewriteconds    = apr_array_append(p, base->rewriteconds,
+                                              overrides->rewriteconds);
+        a->rewriterules    = apr_array_append(p, base->rewriterules,
+                                              overrides->rewriterules);
+    }
     else {
         a->rewriteconds = overrides->rewriteconds;
         a->rewriterules = overrides->rewriterules;
@@ -2853,6 +2872,9 @@ static const char *cmd_rewriteoptions(cm
         if (!strcasecmp(w, "inherit")) {
             options |= OPTION_INHERIT;
         }
+        else if (!strcasecmp(w, "inheritbefore")) {
+            options |= OPTION_INHERIT_BEFORE;
+        }
         else if (!strncasecmp(w, "MaxRedirects=", 13)) {
             ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
                          "RewriteOptions: MaxRedirects option has been "



Mime
View raw message