Re: Overriding mod_rewrite from another module

2010-12-31 Thread Joshua Marantz
Thanks for the quick response and the promising idea for a hack.  Looking at
mod_rewrite.c this does indeed look a lot more surgical, if, perhaps,
fragile, as mod_rewrite.c doesn't expose that string-constant in any formal
interface (even as a #define in a .h).  Nevertheless the solution is
easy-to-implement and easy-to-test, so...thanks!

I'm also still wondering if there's a good source of official documentation
for the detailed semantics of interfaces like ap_hook_translate_name.
 Neither a Google Search, a  stackoverflow.com search, nor the Apache
Modulesbook
offer much detail.
code.google.com fares a little better but just points to 4 existing usages.

-Josh

On Fri, Dec 31, 2010 at 1:50 PM, Ben Noordhuis  wrote:

> On Fri, Dec 31, 2010 at 18:17, Joshua Marantz  wrote:
> > Is there a better way to solve the original problem: preventing
> mod_rewrite
> > from corrupting mod_pagespeed's resources?
>
> From memory and from a quick peek at mod_rewrite.c: in your
> translate_name hook, set a "mod_rewrite_rewritten" note in r->notes
> with value "0" and return DECLINED. That'll trick mod_rewrite into
> thinking that it has already processed the request.
>


Re: Overriding mod_rewrite from another module

2010-12-31 Thread Ben Noordhuis
On Fri, Dec 31, 2010 at 18:17, Joshua Marantz  wrote:
> Is there a better way to solve the original problem: preventing mod_rewrite
> from corrupting mod_pagespeed's resources?

>From memory and from a quick peek at mod_rewrite.c: in your
translate_name hook, set a "mod_rewrite_rewritten" note in r->notes
with value "0" and return DECLINED. That'll trick mod_rewrite into
thinking that it has already processed the request.


Overriding mod_rewrite from another module

2010-12-31 Thread Joshua Marantz
I need to find the best way to prevent mod_rewrite from renaming resources
that are generated by a different module, specifically mod_pagespeed.  This
needs to be done from within mod_pagespeed, rather than asking the site
admin to tweak his rule set.

By reading mod_rewrite.c, I found a mechanism that appears to work.  But it
has its own issues and I'm having trouble finding any relevant doc about the
mechanism:

ap_hook_translate_name(bypass_translators, APR_HOOK_FIRST -1);

bypass_translators returns OK for resources generated by the module,
preventing mod_rewrite from disturbing them.  It returns DECLINED for other
resources.

The trouble is that httpd seems to report error messages in the log for the
lack of a filename.  We can set the request->filename to something but that
causes the requests to fail completely on some servers.  We haven't isolated
the difference between servers that can handle the fake filename and ones
that can't yet.

Is there a better way to solve the original problem: preventing mod_rewrite
from corrupting mod_pagespeed's resources?

Or is there better doc on the semantics of the request.filename field in the
context of a resource that is not stored as a file?  Or on
ap_hook_translate_name?

sent from my android