dougm 01/05/13 20:30:40
Modified:src/modules/perl mod_perl.c modperl_interp.c modperl_types.h
t/response/TestApache cgihandler.pm
Log:
make modperl_response_handler_cgi() deal properly with "PerlInterpScope handler"
Revision ChangesPath
1.57 +11 -0 modperl-2.0/src/modules/perl/mod_perl.c
Index: mod_perl.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- mod_perl.c2001/05/08 21:08:24 1.56
+++ mod_perl.c2001/05/14 03:30:39 1.57
@@ -406,6 +406,9 @@
#ifdef USE_ITHREADS
interp = modperl_interp_select(r, r->connection, r->server);
aTHX = interp->perl;
+if (MpInterpPUTBACK(interp)) {
+rcfg->interp = interp;
+}
#endif
if (MpDirPARSE_HEADERS(dcfg)) {
@@ -422,6 +425,14 @@
modperl_io_handle_untie(aTHX_ h_stdin);
modperl_env_request_untie(aTHX_ r);
+
+#ifdef USE_ITHREADS
+if (MpInterpPUTBACK(interp)) {
+/* PerlInterpScope handler */
+modperl_interp_unselect(interp);
+rcfg->interp = NULL;
+}
+#endif
return retval;
}
1.33 +13 -0 modperl-2.0/src/modules/perl/modperl_interp.c
Index: modperl_interp.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- modperl_interp.c 2001/04/25 05:27:17 1.32
+++ modperl_interp.c 2001/05/14 03:30:39 1.33
@@ -248,6 +248,7 @@
server_rec *s)
{
MP_dSCFG(s);
+MP_dRCFG;
modperl_config_dir_t *dcfg = modperl_config_dir_get(r);
const char *desc = NULL;
modperl_interp_t *interp = NULL;
@@ -263,6 +264,18 @@
/* XXX: if no VirtualHosts w/ PerlOptions +Parent we can skip this */
PERL_SET_CONTEXT(scfg->mip->parent->perl);
return scfg->mip->parent;
+}
+
+if (rcfg && rcfg->interp) {
+/* if scope is per-handler and something selected an interpreter
+ * before modperl_callback_run_handlers() and is still holding it,
+ * e.g. modperl_response_handler_cgi(), that interpreter will
+ * be here
+ */
+MP_TRACE_i(MP_FUNC,
+ "found interp 0x%lx in request config\n",
+ (unsigned long)rcfg->interp);
+return rcfg->interp;
}
/*
1.41 +1 -0 modperl-2.0/src/modules/perl/modperl_types.h
Index: modperl_types.h
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- modperl_types.h 2001/05/08 21:08:30 1.40
+++ modperl_types.h 2001/05/14 03:30:39 1.41
@@ -204,6 +204,7 @@
modperl_wbucket_t wbucket;
MpAV *handlers_per_dir[MP_HANDLER_NUM_PER_DIR];
MpAV *handlers_per_srv[MP_HANDLER_NUM_PER_SRV];
+modperl_interp_t *interp;
} modperl_config_req_t;
typedef struct {
1.3 +1 -0 modperl-2.0/t/response/TestApache/cgihandler.pm
Index: cgihandler.pm
===
RCS file: /home/cvs/modperl-2.0/t/response/TestApache/cgihandler.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- cgihandler.pm 2001/05/08 04:25:50 1.2
+++ cgihandler.pm 2001/05/14 03:30:40 1.3
@@ -32,3 +32,4 @@
1;
__END__
SetHandler perl-script
+PerlInterpScope handler