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)

Reply via email to