On Fri, Oct 29, 2010 at 3:18 PM, Ruediger Pluem <[email protected]> wrote:
>
>
> On 10/29/2010 04:43 PM, [email protected] wrote:
>> Author: covener
>> Date: Fri Oct 29 14:43:49 2010
>> New Revision: 1028778
>>
>> URL: http://svn.apache.org/viewvc?rev=1028778&view=rev
>> Log:
>> Add an END flag to RewriteRule that acts like L=LAST but also prevents
>> further rounds of rewrite processing due to per-directory substitutions.
>>
>>
>> Modified:
>> httpd/httpd/trunk/CHANGES
>> httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml
>> httpd/httpd/trunk/docs/manual/rewrite/flags.xml
>> httpd/httpd/trunk/modules/mappers/mod_rewrite.c
>>
>
>> Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1028778&r1=1028777&r2=1028778&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
>> +++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Fri Oct 29 14:43:49 2010
>
>> @@ -4129,6 +4134,11 @@ static int apply_rewrite_list(request_re
>> break;
>> }
>>
>> + if (p->flags & RULEFLAG_END) {
>> + rewritelog((r, 8, perdir, "Rule has END flag, no further
>> rewriting for this request"));
>> + apr_pool_userdata_set("1", really_last_key,
>> apr_pool_cleanup_null, r->pool);
>
> Why not using r->notes?
Whoops, I saw it was a new table but missed that it was overlayed -- thanks
>
>> + break;
>> + }
>> /*
>> * Stop processing also on proxy pass-through and
>> * last-rule and new-round flags.
>> @@ -4319,6 +4330,13 @@ static int hook_uri2file(request_rec *r)
>> return DECLINED;
>> }
>>
>> + /* END flag was used as a RewriteRule flag on this request */
>> + apr_pool_userdata_get(&skipdata, really_last_key, r->pool);
>> + if (skipdata != NULL) {
>> + rewritelog((r, 8, NULL, "Declining, no further rewriting due to END
>> flag"));
>> + return DECLINED;
>> + }
>> +
>
> Why is this needed here? How can we run through this hook twice for the same
> request?
If a sub is made in the fixup (perdir) hook, rewrites redirect_handler
will call ap_internal_redirect() which runs the translate_name hook.
There might be vhost context rules that apply in this second go-around
--
Eric Covener
[email protected]