You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2010/12/05 16:12:22 UTC
Re: svn commit: r1042255 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_rewrite.xml
modules/mappers/mod_rewrite.c
On 12/04/2010 11:33 PM, covener@apache.org wrote:
> 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
> 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);
> + }
This means that the local rules come after the global rules in the array.
Doesn't this mean that they get applied after the global rules?
Regards
Rüdiger
Re: svn commit: r1042255 - in /httpd/httpd/trunk: CHANGES
docs/manual/mod/mod_rewrite.xml modules/mappers/mod_rewrite.c
Posted by Eric Covener <co...@gmail.com>.
> This means that the local rules come after the global rules in the array.
> Doesn't this mean that they get applied after the global rules?
Yes, this is the right behavior and the opposite of the existing
Inherit option [that runs the parent rules after the local ones]
I think of it in these terms but understand that it might not be 100%
clear without consulting the manual:
no option present: inherited rules do not run
InheritBefore: inherited rules run before local rules
Inherit[After]: inherited rules run after local rules (only option
before commit)
I'm afraid it would require a massive camel-case phrase in a directive
to make it clearer -- any short recommendations?
--
Eric Covener
covener@gmail.com