httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1570288 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_rewrite.xml modules/mappers/mod_rewrite.c
Date Thu, 20 Feb 2014 18:08:32 GMT
Author: covener
Date: Thu Feb 20 18:08:31 2014
New Revision: 1570288

URL: http://svn.apache.org/r1570288
Log:
  *) mod_rewrite: Add RewriteOptions InheritDown, InheritDownBefore,
     and IgnoreInherit to allow RewriteRules to be pushed from parent scopes
     to child scopes without explicitly configuring each child scope.
     PR56153. 

Submitted By: Edward Lu
Committed 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=1570288&r1=1570287&r2=1570288&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu Feb 20 18:08:31 2014
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_rewrite: Add RewriteOptions InheritDown, InheritDownBefore, 
+     and IgnoreInherit to allow RewriteRules to be pushed from parent scopes
+     to child scopes without explicitly configuring each child scope.
+     PR56153.  [Edward Lu <Chaosed0 gmail com>] 
+
   *) mod_lua: Add r:wspeek for checking if there is any data waiting on the line
      [Daniel Gruno]
 

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=1570288&r1=1570287&r2=1570288&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml Thu Feb 20 18:08:31 2014
@@ -171,6 +171,34 @@ URLs on the fly</description>
       Available in Apache HTTP Server 2.3.10 and later.</p>
       </dd>
 
+      <dt><code>InheritDown</code></dt>
+      <dd>
+
+      <p>If this option is enabled, all child configurations will inherit
+      the configuration of the current configuration. It is equivalent to
+      specifying <code>RewriteOptions Inherit</code> in all child
+      configurations. See the <code>Inherit</code> option for more details
+      on how the parent-child relationships are handled. Available in Apache
+      HTTP Server 2.4.8 and later.</p>
+      </dd>
+
+      <dt><code>InheritDownBefore</code></dt>
+      <dd>
+
+      <p>Like <code>InheritDown</code> above, but the rules from the current
+      scope are applied <strong>before</strong> rules specified in any child's
+      scope. Available in Apache HTTP Server 2.4.8 and later.</p>
+      </dd>
+
+      <dt><code>IgnoreInherit</code></dt>
+      <dd>
+
+      <p>This option forces the current and child configurations to ignore
+      all rules that would be inherited from a parent specifying
+      <code>InheritDown</code> or <code>InheritDownBefore</code>.
Available
+      in Apache HTTP Server 2.4.8 and later.</p>
+      </dd>
+
       <dt><code>AllowNoSlash</code></dt>
       <dd>
       <p>By default, <module>mod_rewrite</module> will ignore URLs that
map to a

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1570288&r1=1570287&r2=1570288&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Thu Feb 20 18:08:31 2014
@@ -196,6 +196,9 @@ static const char* really_last_key = "re
 #define OPTION_NOSLASH              1<<3
 #define OPTION_ANYURI               1<<4
 #define OPTION_MERGEBASE            1<<5
+#define OPTION_INHERIT_DOWN         1<<6
+#define OPTION_INHERIT_DOWN_BEFORE  1<<7
+#define OPTION_IGNORE_INHERIT       1<<8
 
 #ifndef RAND_MAX
 #define RAND_MAX 32767
@@ -2769,7 +2772,9 @@ static void *config_server_merge(apr_poo
 
     a->server  = overrides->server;
 
-    if (a->options & OPTION_INHERIT) {
+    if (a->options & OPTION_INHERIT ||
+            (base->options & OPTION_INHERIT_DOWN &&
+             !(a->options & OPTION_IGNORE_INHERIT))) {
         /*
          *  local directives override
          *  and anything else is inherited
@@ -2781,7 +2786,9 @@ static void *config_server_merge(apr_poo
         a->rewriterules    = apr_array_append(p, overrides->rewriterules,
                                               base->rewriterules);
     }
-    else if (a->options & OPTION_INHERIT_BEFORE) {
+    else if (a->options & OPTION_INHERIT_BEFORE || 
+            (base->options & OPTION_INHERIT_DOWN_BEFORE &&
+             !(a->options & OPTION_IGNORE_INHERIT))) {
         /*
          *  local directives override
          *  and anything else is inherited (preserving order)
@@ -2858,13 +2865,17 @@ static void *config_perdir_merge(apr_poo
 
     a->directory  = overrides->directory;
 
-    if (a->options & OPTION_INHERIT) {
+    if (a->options & OPTION_INHERIT ||
+            (base->options & OPTION_INHERIT_DOWN &&
+             !(a->options & OPTION_IGNORE_INHERIT))) {
         a->rewriteconds = apr_array_append(p, overrides->rewriteconds,
                                            base->rewriteconds);
         a->rewriterules = apr_array_append(p, overrides->rewriterules,
                                            base->rewriterules);
     }
-    else if (a->options & OPTION_INHERIT_BEFORE) {
+    else if (a->options & OPTION_INHERIT_BEFORE || 
+            (base->options & OPTION_INHERIT_DOWN_BEFORE &&
+             !(a->options & OPTION_IGNORE_INHERIT))) {
         a->rewriteconds    = apr_array_append(p, base->rewriteconds,
                                               overrides->rewriteconds);
         a->rewriterules    = apr_array_append(p, base->rewriterules,
@@ -2916,6 +2927,15 @@ static const char *cmd_rewriteoptions(cm
         else if (!strcasecmp(w, "inheritbefore")) {
             options |= OPTION_INHERIT_BEFORE;
         }
+        else if (!strcasecmp(w, "inheritdown")) {
+            options |= OPTION_INHERIT_DOWN;
+        }
+        else if(!strcasecmp(w, "inheritdownbefore")) {
+            options |= OPTION_INHERIT_DOWN_BEFORE;
+        }
+        else if (!strcasecmp(w, "ignoreinherit")) {
+            options |= OPTION_IGNORE_INHERIT;
+        }
         else if (!strcasecmp(w, "allownoslash")) {
             options |= OPTION_NOSLASH;
         }



Mime
View raw message