perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran...@apache.org
Subject svn commit: r436617 - in /perl/modperl/trunk: Changes src/modules/perl/modperl_callback.c t/hooks/TestHooks/error.pm t/hooks/error.t
Date Fri, 25 Aug 2006 02:15:24 GMT
Author: randyk
Date: Thu Aug 24 19:15:23 2006
New Revision: 436617

URL: http://svn.apache.org/viewvc?rev=436617&view=rev
Log:
Fix bug concerning 'error-notes' having no value on
errordocument redirect [supplied by Guy Albertelli II
<guy@albertelli.com>].

Added:
    perl/modperl/trunk/t/hooks/TestHooks/error.pm
    perl/modperl/trunk/t/hooks/error.t
Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/src/modules/perl/modperl_callback.c

Modified: perl/modperl/trunk/Changes
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/Changes?rev=436617&r1=436616&r2=436617&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Thu Aug 24 19:15:23 2006
@@ -12,6 +12,10 @@
 
 =item 2.0.3-dev
 
+Fix bug concerning 'error-notes' having no value on 
+errordocument redirect.
+[Guy Albertelli II <guy@albertelli.com>]
+
 Multi-line $PerlConfig is now working [Gozer]
 
 PerlOptions None was previously incorrectly reported as invalid

Modified: perl/modperl/trunk/src/modules/perl/modperl_callback.c
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_callback.c?rev=436617&r1=436616&r2=436617&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_callback.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_callback.c Thu Aug 24 19:15:23 2006
@@ -130,7 +130,7 @@
 
     if (status == HTTP_INTERNAL_SERVER_ERROR) {
         if (r && r->notes) {
-            apr_table_mergen(r->notes, "error-notes", SvPV_nolen(ERRSV));
+            apr_table_merge(r->notes, "error-notes", SvPV_nolen(ERRSV));
         }
     }
 

Added: perl/modperl/trunk/t/hooks/TestHooks/error.pm
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/t/hooks/TestHooks/error.pm?rev=436617&view=auto
==============================================================================
--- perl/modperl/trunk/t/hooks/TestHooks/error.pm (added)
+++ perl/modperl/trunk/t/hooks/TestHooks/error.pm Thu Aug 24 19:15:23 2006
@@ -0,0 +1,43 @@
+package TestHooks::error;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+
+use Apache2::RequestRec ();
+use Apache2::RequestIO ();
+
+use Apache2::Const -compile => 'OK';
+
+use APR::Table ();
+
+sub handler {
+    my $r = shift;
+    my $args = $r->args();
+    if (defined($args) && $args ne '') {
+        $r->notes->set('error-notes' => $args);
+    }
+    &bomb();
+    Apache2::Const::OK;
+}
+
+sub fail {
+    my $r = shift;
+    $r->print('Error: '.$r->prev->notes->get('error-notes'));
+    Apache2::Const::OK;
+}
+
+1;
+__DATA__
+<NoAutoConfig>
+  <Location /TestHooks__error>
+      SetHandler modperl
+      PerlResponseHandler TestHooks::error
+      ErrorDocument 500 /TestHooks__error__fail
+  </Location>
+  <Location /TestHooks__error__fail>
+      SetHandler modperl
+      PerlResponseHandler TestHooks::error::fail
+  </Location>
+</NoAutoConfig>

Added: perl/modperl/trunk/t/hooks/error.t
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/t/hooks/error.t?rev=436617&view=auto
==============================================================================
--- perl/modperl/trunk/t/hooks/error.t (added)
+++ perl/modperl/trunk/t/hooks/error.t Thu Aug 24 19:15:23 2006
@@ -0,0 +1,27 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+use Apache::TestRequest;
+
+plan tests => 2;
+
+{
+    # this registers and performs cleanups, but we test whether the
+    # cleanup was run only in the next sub-test
+    my $location = "/TestHooks__error";
+    my $expected = qr/^Error: Undefined subroutine/;
+    my $received = GET_BODY $location;
+    ok t_cmp($received, $expected, "error-notes set on ErrorDocument");
+}
+
+{
+    # this registers and performs cleanups, but we test whether the
+    # cleanup was run only in the next sub-test
+    my $error_seed_text = 'seed_text';
+    my $location = "/TestHooks__error?$error_seed_text";
+    my $expected = qr/^Error: \Q$error_seed_text\E, Undefined subroutine/;
+    my $received = GET_BODY $location;
+    ok t_cmp($received, $expected, "seeded error-notes set on ErrorDocument");
+}



Mime
View raw message