Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl
Modperl handler status code. Handler invoked two times per request.
 

Index | Next | Previous | View Flat


reisub at ya

Jul 1, 2012, 4:50 PM


Views: 605
Permalink
Modperl handler status code. Handler invoked two times per request.

Hello.

I've found unexpected behavior of modperl handler. If handler return
Apache2::Const::HTTP_OK status all is ok. But other HTTP_*
status code (tested with Apache2::Const::HTTP_NOT_FOUND;
Apache2::Const::HTTP_FORBIDDEN and Apache2::Const::SERVER_ERROR)
invoke handler again.

Configuration:

<VirtualHost *:80>
DocumentRoot "/srv/http/err/htdocs"
ServerName err.localhost
SetHandler perl-script

PerlRequire /srv/http/err/htdocs/Main.pm
PerlResponseHandler XYZ::Main
</VirtualHost>

Module:
package XYZ::Main;

use strict;
use APR::Table;
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile => qw/:common :http/;
use CGI;

sub handler{
`echo "call" >>/tmp/inv`;
return Apache2::Const::OK;
return Apache2::Const::HTTP_OK;
return Apache2::Const::HTTP_NOT_FOUND;
}

1;

Mainly, in some cases I want to show Apache2
default pages (like for HTTP_NOF_FOUND and HTTP_SERVER_ERROR) and
don't know right way to implement that. It seems that similar
Apache2::Const::HTTP* status code from handler is a good way but now I
have to use method-handler technique
(https://perl.apache.org/docs/2.0/user/coding/coding.html#Method_Handlers)
to avoid second handler invocations.

So, whats wrong?

Regards,
Nick.

===
Apache/2.2.22 (Unix) DAV/2 PHP/5.4.4 mod_perl/2.0.7 Perl/v5.16.0 Server
at err.localhost Port 80Server version: Apache/2.2.22 (Unix)

Subject User Time
Modperl handler status code. Handler invoked two times per request. reisub at ya Jul 1, 2012, 4:50 PM
    Re: Modperl handler status code. Handler invoked two times per request. vv.lists at wanadoo Jul 12, 2012, 6:59 AM
    Re: Modperl handler status code. Handler invoked two times per request. vv.lists at wanadoo Jul 12, 2012, 7:13 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.