You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Eric Covener <co...@gmail.com> on 2011/10/17 13:56:21 UTC

LUA hook ordering & block/section form

I'm thinking of tweaking mod_lua to allow most LuaHook* to run "early'
or "late".

Currently they all run APR_HOOK_MIDDLE which can be kind of limiting.

Would it be acceptable to just register three hooks for each phase
(early/middle/late) and continue to bail out quickly if no lua code is
registered?  Or  does it need to be smarter about registering the
hooks as the admin asks for "early" or "late" scripts or blocks?

I am tentatively using APR_HOOK_FIRST-1 and APR_HOOK_LAST+1 for the
alternate ordering, since you can't provide predecessors/successors
and APR_HOOK_FIRST would still have you bumping into e.g. mod_rewrite.
APR_HOOK_REALLY_FIRST/LAST also seems like it would step on the toes
of things (in an unpredictable way).

If we let the user pick an exact order (but still no
predecssors/successors) I guess we could register the exact hook
ordinals as we see them but this seems like too much.

Also, is there any reason the block/config-section forms of each Lua
directive are not documented?

Re: LUA hook ordering & block/section form

Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Monday 17 October 2011, Eric Covener wrote:
> I'm thinking of tweaking mod_lua to allow most LuaHook* to run
> "early' or "late".
> 
> Currently they all run APR_HOOK_MIDDLE which can be kind of
> limiting.
> 
> Would it be acceptable to just register three hooks for each phase
> (early/middle/late) and continue to bail out quickly if no lua code
> is registered?  Or  does it need to be smarter about registering
> the hooks as the admin asks for "early" or "late" scripts or
> blocks?

I think simple is ok for now. We can always optimize later.

> I am tentatively using APR_HOOK_FIRST-1 and APR_HOOK_LAST+1 for the
> alternate ordering, since you can't provide predecessors/successors
> and APR_HOOK_FIRST would still have you bumping into e.g.
> mod_rewrite. APR_HOOK_REALLY_FIRST/LAST also seems like it would
> step on the toes of things (in an unpredictable way).

Sounds ok. I agree that APR_HOOK_REALLY_FIRST/LAST should be out of 
bounds.

> If we let the user pick an exact order (but still no
> predecssors/successors) I guess we could register the exact hook
> ordinals as we see them but this seems like too much.

Is it possible to configure the hooks in .htaccess? You can't register 
new hooks in .htaccess, so if yes, you would be limited to the 
preregistered hooks, anyway.