You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Sergij Borodych <bo...@univ.kiev.ua> on 2007/04/17 17:42:58 UTC

$r->handler and $r->set_handlers on all files

Hi,

I have configuration:
apache-2.0.59
mod_perl-2.0.3

<Directory "/somedir/htdocs">
     PerlAuthzHandler MyModule::authorize

and in authorize:

if ...
     $r->handler('perl-script');
     $r->set_handlers( (MP2 ? 'PerlResponseHandler' : 'PerlHandler') => 
\&somefunc );

If url is "/" all ok - authorize and after somefunc is called
But if I request all other files like "/test.html"
authorize called and set handlers, but somefunc not called :(

Also it called if request "/test" (try to resolve test.html I think)
and for non existing url(files) it(somefunc) called too

Where a problem?
Is a way for fix it without redirect or add new Perl*Handler 
(PerlMapToStorageHandler,PerlFixupHandler?) ?

-- 
Sergij Borodych
http://bor.org.ua

Re: $r->handler and $r->set_handlers on all files

Posted by Sergij Borodych <bo...@univ.kiev.ua>.
On 04/19/07 15:19, Perrin Harkins wrote:
> On 4/19/07, Sergij Borodych <bo...@univ.kiev.ua> wrote:
>> I check virtual hosts conf and not found difference.
> 
> The httpd.conf files on the machine that works and the one that
> doesn't are completely identical?  Make sure you are really looking at
> the correct files.
> 
>> Which apache directives can affect ?
> 
> Most of them: Location, Directory, Files, etc.
> 

As I say virtual hosts conf are identical

and httpd.conf are most default(distrib) with only contain
     <Directory />
         Options FollowSymLinks
         AllowOverride None
     </Directory>
what affect to this
I check list of modules - its seems to equal

I try discover this problem

code
$r->warn('HANDLERS: '.join(',',@{ 
$r->get_handlers('PerlResponseHandler') || [] }));

at  start
[Thu Apr 19 17:00:42 2007] [warn] HANDLERS:
after set_handlers
[Thu Apr 19 17:00:42 2007] [warn] HANDLERS: CODE(0x987005c)
at PerlFixupHandler MyModule::test phase (add for test only)
[Thu Apr 19 17:00:42 2007] [warn] HANDLERS: CODE(0x987005c)

so set_handlers work

after I found directive PerlTrace
and try set PerlTrace h (see attach)
I can't found here string like:
modperl_callback_run_handlers: running 1 PerlResponseHandler handlers
nothing about PerlResponseHandler :(

The main difference is that I run worker mpm
On other server - prefork mpm

Also I try set PerlInterpScope handler (and other)
not help :(

maybe i try recompile apache with prefork mpm and test tomorrow


-- 
Sergij Borodych
http://bor.org.ua

Re: $r->handler and $r->set_handlers on all files

Posted by Sergij Borodych <bo...@univ.kiev.ua>.
On 04/19/07 15:19, Perrin Harkins wrote:
> On 4/19/07, Sergij Borodych <bo...@univ.kiev.ua> wrote:
>> I check virtual hosts conf and not found difference.
> 
> The httpd.conf files on the machine that works and the one that
> doesn't are completely identical?  Make sure you are really looking at
> the correct files.
> 
>> Which apache directives can affect ?
> 
> Most of them: Location, Directory, Files, etc.
> 

thank for advice

fixed

I found in updir configuration

AddHandler server-parsed .html

after comment it all works fine
mod_perl not might replace this handler :(

After I change it to
AddOutputFilter Includes html
like other servers and now all ok

I will be more careful in future

-- 
Sergij Borodych
http://bor.org.ua

Re: $r->handler and $r->set_handlers on all files

Posted by Perrin Harkins <pe...@elem.com>.
On 4/19/07, Sergij Borodych <bo...@univ.kiev.ua> wrote:
> I check virtual hosts conf and not found difference.

The httpd.conf files on the machine that works and the one that
doesn't are completely identical?  Make sure you are really looking at
the correct files.

> Which apache directives can affect ?

Most of them: Location, Directory, Files, etc.

- Perrin

Re: $r->handler and $r->set_handlers on all files

Posted by Sergij Borodych <bo...@univ.kiev.ua>.
Perrin Harkins пишет:
> On 4/18/07, Sergij Borodych <bo...@univ.kiev.ua> wrote:
>> I try at another servers with
>>
>> Debian Etch
>> apache2                   2.2.3-4
>> libapache2-mod-perl2      2.0.2-2.4
>>
>> FreeBSD 6.2-STABLE
>> apache-2.0.59
>> mod_perl2-2.0.3_1,3
>>
>> and here all works fine
>>
>> maybe its Gentoo specific bug ?
> 
> More likely it's a problem in your httpd.conf.  Compare the httpd.conf
> files and see what's different.  You might have something declared
> further down that is causing a different response handler to be used.

I check virtual hosts conf and not found difference.
Which apache directives can affect ?
How I can more debug this situation ?

-- 
Sergij Borodych
http://bor.org.ua

Re: $r->handler and $r->set_handlers on all files

Posted by Perrin Harkins <pe...@elem.com>.
On 4/18/07, Sergij Borodych <bo...@univ.kiev.ua> wrote:
> I try at another servers with
>
> Debian Etch
> apache2                   2.2.3-4
> libapache2-mod-perl2      2.0.2-2.4
>
> FreeBSD 6.2-STABLE
> apache-2.0.59
> mod_perl2-2.0.3_1,3
>
> and here all works fine
>
> maybe its Gentoo specific bug ?

More likely it's a problem in your httpd.conf.  Compare the httpd.conf
files and see what's different.  You might have something declared
further down that is causing a different response handler to be used.

- Perrin

Re: $r->handler and $r->set_handlers on all files

Posted by Sergij Borodych <bo...@univ.kiev.ua>.
Sergij Borodych пишет:
> Hi,
> 
> I have configuration:
> apache-2.0.59
> mod_perl-2.0.3
> 
> <Directory "/somedir/htdocs">
>     PerlAuthzHandler MyModule::authorize
> 
> and in authorize:
> 
> if ...
>     $r->handler('perl-script');
>     $r->set_handlers( (MP2 ? 'PerlResponseHandler' : 'PerlHandler') => 
> \&somefunc );
> 
> If url is "/" all ok - authorize and after somefunc is called
> But if I request all other files like "/test.html"
> authorize called and set handlers, but somefunc not called :(
> 
> Also it called if request "/test" (try to resolve test.html I think)
> and for non existing url(files) it(somefunc) called too
> 
> Where a problem?
> Is a way for fix it without redirect or add new Perl*Handler 
> (PerlMapToStorageHandler,PerlFixupHandler?) ?
> 

I try at another servers with

Debian Etch
apache2                   2.2.3-4
libapache2-mod-perl2      2.0.2-2.4

FreeBSD 6.2-STABLE
apache-2.0.59
mod_perl2-2.0.3_1,3

and here all works fine

maybe its Gentoo specific bug ?
becouse problem exists only on
Gentoo ~x86
apache-2.0.59-r2
mod_perl-2.0.3-r1

How I discover(investigate) it ?


-- 
Sergij Borodych
http://bor.org.ua

Re: $r->handler and $r->set_handlers on all files

Posted by Sergij Borodych <bo...@univ.kiev.ua>.
Geoffrey Young пишет:
>>>> <Directory "/somedir/htdocs">
>>>>     PerlAuthzHandler MyModule::authorize
>>>>
>>>> and in authorize:
>>>>
>>>> if ...
>>>>     $r->handler('perl-script');
>>>>     $r->set_handlers( (MP2 ? 'PerlResponseHandler' : 'PerlHandler') =>
>>>> \&somefunc );
>>>
>>> why are you doing this?  those same directives in httpd.conf are a
>>> cleaner way to go - if your PerlAuthzHandler returns FORBIDDEN they will
>>> never be executed.
>>
>> I know, but I need show custom html page (with custom error message)
> 
> you can pass anything you like from your authz handler to your content
> handler using $r->pnotes :)
> 

Yes I use it :)
I pass error message to &somefunc

but problem in another thing
please reread my first(and second) letter


-- 
Sergij Borodych
http://bor.org.ua

Re: $r->handler and $r->set_handlers on all files

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>>> <Directory "/somedir/htdocs">
>>>     PerlAuthzHandler MyModule::authorize
>>>
>>> and in authorize:
>>>
>>> if ...
>>>     $r->handler('perl-script');
>>>     $r->set_handlers( (MP2 ? 'PerlResponseHandler' : 'PerlHandler') =>
>>> \&somefunc );
>>
>>
>> why are you doing this?  those same directives in httpd.conf are a
>> cleaner way to go - if your PerlAuthzHandler returns FORBIDDEN they will
>> never be executed.
> 
> 
> I know, but I need show custom html page (with custom error message)

you can pass anything you like from your authz handler to your content
handler using $r->pnotes :)

--Geoff

Re: $r->handler and $r->set_handlers on all files

Posted by Sergij Borodych <bo...@univ.kiev.ua>.
Geoffrey Young пишет:
> Sergij Borodych wrote:
>> Hi,
>>
>> I have configuration:
>> apache-2.0.59
>> mod_perl-2.0.3
>>
>> <Directory "/somedir/htdocs">
>>     PerlAuthzHandler MyModule::authorize
>>
>> and in authorize:
>>
>> if ...
>>     $r->handler('perl-script');
>>     $r->set_handlers( (MP2 ? 'PerlResponseHandler' : 'PerlHandler') =>
>> \&somefunc );
> 
> why are you doing this?  those same directives in httpd.conf are a
> cleaner way to go - if your PerlAuthzHandler returns FORBIDDEN they will
> never be executed.

I know, but I need show custom html page (with custom error message)


-- 
Sergij Borodych
http://bor.org.ua

Re: $r->handler and $r->set_handlers on all files

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Sergij Borodych wrote:
> Hi,
> 
> I have configuration:
> apache-2.0.59
> mod_perl-2.0.3
> 
> <Directory "/somedir/htdocs">
>     PerlAuthzHandler MyModule::authorize
> 
> and in authorize:
> 
> if ...
>     $r->handler('perl-script');
>     $r->set_handlers( (MP2 ? 'PerlResponseHandler' : 'PerlHandler') =>
> \&somefunc );

why are you doing this?  those same directives in httpd.conf are a
cleaner way to go - if your PerlAuthzHandler returns FORBIDDEN they will
never be executed.

--Geoff