perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r171168 - in /perl/modperl/trunk: Changes src/modules/perl/modperl_module.c t/directive/ t/response/TestDirective/perlloadmodule7.pm
Date Fri, 20 May 2005 23:01:04 GMT
Author: stas
Date: Fri May 20 16:01:03 2005
New Revision: 171168

URL: http://svn.apache.org/viewcvs?rev=171168&view=rev
Log:

Fix a bug in custom directive implementation, where a custom directive
placed into a dir container was causing a global perl context change
which was leading to a segfault in any handler called
thereafter.

Added:
    perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm   (with props)
Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/src/modules/perl/modperl_module.c
    perl/modperl/trunk/t/directive/   (props changed)

Modified: perl/modperl/trunk/Changes
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=171168&r1=171167&r2=171168&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Fri May 20 16:01:03 2005
@@ -12,6 +12,11 @@
 
 =item 2.0.1-dev
 
+Fix a bug in custom directive implementation, where a custom directive
+placed into a dir container was causing a global perl context change
+which was leading to a segfault in any handler called
+thereafter. [Stas]
+
 
 =item 2.0.0 - May 20, 2005
 

Modified: perl/modperl/trunk/src/modules/perl/modperl_module.c
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_module.c?rev=171168&r1=171167&r2=171168&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_module.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_module.c Fri May 20 16:01:03 2005
@@ -165,10 +165,9 @@
     int is_startup;
     PTR_TBL_t *table;
     SV *mrg_obj = Nullsv, *base_obj, *add_obj;
-
 #ifdef USE_ITHREADS
+    MP_PERL_CONTEXT_DECLARE;
     modperl_interp_t *interp;
-    pTHX;
 #endif
 
     /* if the module is loaded in vhost, base==NULL */
@@ -184,7 +183,7 @@
 
 #ifdef USE_ITHREADS
     interp = modperl_interp_pool_select(p, s);
-    aTHX = interp->perl;
+    MP_PERL_CONTEXT_STORE_OVERRIDE(interp->perl);
 #endif
 
     table = modperl_module_config_table_get(aTHX_ TRUE);
@@ -240,6 +239,11 @@
         modperl_module_config_obj_cleanup_register(aTHX_ p, table, mrg);
     }
 
+#ifdef USE_ITHREADS
+    modperl_interp_unselect(interp);
+    MP_PERL_CONTEXT_RESTORE;
+#endif
+    
     return (void *)mrg;
 }
 

Propchange: perl/modperl/trunk/t/directive/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri May 20 16:01:03 2005
@@ -1,5 +1,6 @@
 cmdparms.t
 env.t
 perlloadmodule.t
+perlloadmodule7.t
 pod.t
 perldo.t

Added: perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm?rev=171168&view=auto
==============================================================================
--- perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm (added)
+++ perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm Fri May 20 16:01:03 2005
@@ -0,0 +1,56 @@
+package TestDirective::perlloadmodule7;
+
+# in this test we test an early mod_perl startup caused by an
+# EXEC_ON_READ directive in vhost.
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache2::Module ();
+
+use Apache2::Const -compile => qw(OK);
+
+use constant KEY => "MyTest7";
+
+my @directives = ({ name => +KEY },);
+
+Apache2::Module::add(__PACKAGE__, \@directives);
+
+sub MyTest7 {
+    my($self, $parms, $arg) = @_;
+    $self->{+KEY} = $arg;
+}
+
+### response handler ###
+
+use Apache2::RequestRec ();
+use Apache2::RequestIO ();
+
+use Apache::Test;
+use Apache::TestUtil;
+
+use Apache2::Const -compile => qw(OK);
+
+sub handler {
+    my($r) = @_;
+
+    plan $r, tests => 1;
+
+    ok 1;
+
+    return Apache2::Const::OK;
+}
+
+1;
+__END__
+
+<NoAutoConfig>
+# APACHE_TEST_CONFIG_ORDER 950
+PerlLoadModule TestDirective::perlloadmodule7
+
+<Location /TestDirective__perlloadmodule7>
+    MyTest7 test
+    SetHandler modperl
+    PerlResponseHandler TestDirective::perlloadmodule7
+</Location>
+</NoAutoConfig>

Propchange: perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message