Philippe M. Chiasson wrote:
Stas Bekman wrote:Configuring PostConfig phase via push_handlers on the vhost server is silently ignored under mp2. For example a custom directive handler FooBar: sub FooBar { my ($self, $parms, $arg) = @_; my $s = $parms->server; # XXX: calling it on the non-vhost server works #Apache2::ServerUtil->server->push_handlers( $s->push_handlers( PerlPostConfigHandler => \&post_config); ... See the attached tarball that reproduces the problem. I think the solution should be either change modperl_post_config_handler to iterate over vhosts or it should explode when a user tries to register the callback on a vhost server (but it'll affect the push_handlers run-time performance a bit), to handle the special case.I've been looking over this issue, and I think that iterating over vhosts does sound tempting, but it would mean different behaviour than it's related httpd API.
Another problem is that if you put PerlPostConfigHandler inside vhost in httpd.conf it does get run (via base server)
The main problem is that you can't get hold of the correct vhost server object from within PerlPostConfigHandler (which does work when using a custom directive or with <perl> using your latest fix).
I do not like the fact that a vhost-registered postconfig hook just ends up not running at all though. I would avoid the overhead by carefull documentation "PostConfig and OpenLog *must* be called on the main server !!!"
But who reads the docs? mod_perl has more than one problem on the startup where commands are silently ignored and real errors aren't preventing Apache from starting (and errors being silented).
Since this is a startup and performance is a non-issue, may be some function pointer manipulation could do? I.e. during the startup it will use a heavier version and after child_init switch to the light one. Probably an overkill...
I've quickly implemented this looping over vhosts, and the problem it causes is that handlers defined in the main server are being run over and over for each vhost ;-S
That's because they aren't registered per-vhost, but altogether. -- _____________________________________________________________ Stas Bekman mailto:[EMAIL PROTECTED] http://stason.org/ MailChannels: Assured Messaging(TM) http://mailchannels.com/ The "Practical mod_perl" book http://modperlbook.org/ http://perl.apache.org/ http://perl.org/ http://logilune.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
