Geoffrey Young wrote:
> David Wheeler wrote:
>> Hi All,
>>
>> Is it possible to install a request phase handler (via push_handler()
>> or some other method) during a request that will only execute in that
>> request, and be removed as a handler after the request completes?
>
> yeah, that's what $r->push_handlers() does... or ought to do :)
>
> but since you're asking yet know the answer, I'm assuming you've found a
> bug?
Well if it puts in MP_dRCFG which is:
typedef struct {
...
MpAV *handlers_per_dir[MP_HANDLER_NUM_PER_DIR];
MpAV *handlers_per_srv[MP_HANDLER_NUM_PER_SRV];
...
} modperl_config_req_t;
Which is allocated per request, it will be fine.
The below is somewhere in the stack supposed to accomplish this, but I'm not
convinced it does....
/*
* generic function to lookup handlers for use in modperl_callback(),
* $r->{push,set,get}_handlers, $s->{push,set,get}_handlers
* $s->push/set at startup time are the same as configuring Perl*Handlers
* $r->push/set at request time will create entries in r->request_config
* push will first merge with configured handlers, unless an entry
* in r->request_config already exists. in this case, push or set has
* already been called for the given handler,
* r->request_config entries then override those in r->per_dir_config
*/
MpAV **modperl_handler_lookup_handlers(modperl_config_dir_t *dcfg,
modperl_config_srv_t *scfg,
modperl_config_req_t *rcfg,
apr_pool_t *p,
int type, int idx,
modperl_handler_action_e action,
const char **desc)
Also see:
./hooks/TestHooks/push_handlers_same_phase.pm
Its the closest test we have -- maybe extend or duplicate and tweak to test
this and provide an example ?
--
------------------------------------------------------------------------
Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F 6A47 D55A 7172 A799 97F
"In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night."
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ /
/ /|_/ / // /\ \/ /_/ / /__
/_/ /_/\_, /___/\___\_\___/
<___/