[Rt-commit] rt branch, 4.0/die-on-perl-script-handler, updated. rt-4.0.10-80-ge4f3362

Alex Vandiver alexmv at bestpractical.com
Fri Mar 15 18:21:32 EDT 2013


The branch, 4.0/die-on-perl-script-handler has been updated
       via  e4f336255c70d1ab48e42bdca9bc5fad2bf2f177 (commit)
      from  033dd9655ca319d44cc19e4b9cdaedc93fdb5119 (commit)

Summary of changes:
 lib/RT/Interface/Web/Handler.pm | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit e4f336255c70d1ab48e42bdca9bc5fad2bf2f177
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Mar 15 18:19:09 2013 -0400

    Ensure that the error message is logged with newlines
    
    die() is verridden somewhere in the stack to s/\n/\\n/g; this makes the
    error message much less readable.
    
    Use a direct call to $RT::Logger to ensure that newlines are preserved,
    which also allows us to set the log level explicitly.  Not exiting via
    die() requires that we handle providing the HTTP response by hand, which
    also provides the opportunity to explicitly call out the
    misconfiguration.

diff --git a/lib/RT/Interface/Web/Handler.pm b/lib/RT/Interface/Web/Handler.pm
index 3fa28f1..a1784c2 100644
--- a/lib/RT/Interface/Web/Handler.pm
+++ b/lib/RT/Interface/Web/Handler.pm
@@ -225,7 +225,9 @@ sub CheckModPerlHandler{
 
     my $handler = $env->{'psgi.input'}->handler;
 
-    die <<MODPERL if defined $handler && $handler eq 'perl-script';
+    return unless defined $handler && $handler eq 'perl-script';
+
+    $RT::Logger->critical(<<MODPERL);
 RT has problems when SetHandler is set to perl-script.
 Change SetHandler in your in httpd.conf to:
 
@@ -236,7 +238,10 @@ For a complete example mod_perl configuration, see:
 https://bestpractical.com/rt/docs/@{[$RT::VERSION =~ /^(\d\.\d)/]}/web_deployment.html#mod_perl-2.xx
 MODPERL
 
-    return;
+    my $res = Plack::Response->new(500);
+    $res->content_type("text/plain");
+    $res->body("Server misconfiguration; see error log for details");
+    return $res;
 }
 
 # PSGI App
@@ -261,7 +266,10 @@ sub PSGIApp {
     return sub {
         my $env = shift;
 
-        $self->CheckModPerlHandler($env);
+        {
+            my $res = $self->CheckModPerlHandler($env);
+            return $self->_psgi_response_cb( $res->finalize ) if $res;
+        }
 
         RT::ConnectToDatabase() unless RT->InstallMode;
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list