You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl-cvs@perl.apache.org by ri...@apache.org on 2004/08/17 08:17:59 UTC
cvs commit: embperl/test/conf httpd.min.conf.src
richter 2004/08/16 23:17:59
Modified: . Changes.pod MANIFEST Makefile.PL epdom.c epinit.c
mod_embperl.c test.pl
Added: test/conf httpd.min.conf.src
Log:
fix segfault on apache -t
Revision Changes Path
1.247 +1 -0 embperl/Changes.pod
Index: Changes.pod
===================================================================
RCS file: /home/cvs/embperl/Changes.pod,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -r1.246 -r1.247
--- Changes.pod 16 Aug 2004 07:36:13 -0000 1.246
+++ Changes.pod 17 Aug 2004 06:17:58 -0000 1.247
@@ -19,6 +19,7 @@
- Fixed some memory leaks
- Fixed problem that checkboxes or options or not correctly selected
on the second request when value was html escaped
+ - Fixed Segfault under Apache 1.3 when doing a syntax check
=head1 2.0b11 15. March 2004
1.96 +1 -0 embperl/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /home/cvs/embperl/MANIFEST,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- MANIFEST 16 Aug 2004 07:36:14 -0000 1.95
+++ MANIFEST 17 Aug 2004 06:17:58 -0000 1.96
@@ -368,6 +368,7 @@
test/cmp/varerr.htm56
test/cmp/xhtml.htm
test/conf/httpd.conf.src
+test/conf/httpd.min.conf.src
test/conf/httpd.stop.conf.src
test/conf/null
test/conf/ssldisable.conf
1.73 +2 -2 embperl/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/embperl/Makefile.PL,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- Makefile.PL 16 Aug 2004 07:36:14 -0000 1.72
+++ Makefile.PL 17 Aug 2004 06:17:58 -0000 1.73
@@ -1292,7 +1292,7 @@
'DEFINE' => "$d \$(DEFS)",
'INC' => $i,
'EXE_FILES' => [ 'embpexec.pl', 'embpmsgid.pl' ],
- 'clean' => { FILES => 'dirent.h test/conf/httpd.conf test/conf/httpd.stop.conf test/tmp/* Embperl.c $(OBJECT)' },
+ 'clean' => { FILES => 'dirent.h test/conf/httpd.conf test/conf/httpd.stop.conf test/conf/httpd.min.conf test/tmp/* Embperl.c $(OBJECT)' },
'realclean' => { FILES => 'embpmsgid.pl embpexec.pl embpexec.bat embpcgi.pl embpcgi.test.pl embpcgi.bat epocgi.pl epocgi.bat epocgi.test.pl embpfastcgi.pl test/conf/config.pl xs/mmargs.pl' },
'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz'},
'dynamic_lib' => $dynlib,
1.24 +3 -1 embperl/epdom.c
Index: epdom.c
===================================================================
RCS file: /home/cvs/embperl/epdom.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- epdom.c 16 Aug 2004 07:36:15 -0000 1.23
+++ epdom.c 17 Aug 2004 06:17:58 -0000 1.24
@@ -74,6 +74,8 @@
void mydie (/*in*/ tApp * a,
char * msg)
{
+ epaTHX_
+
LogErrorParam (a, 9999, msg, "") ;
puts (msg) ;
#ifdef EPDEBUG
1.21 +2 -2 embperl/epinit.c
Index: epinit.c
===================================================================
RCS file: /home/cvs/embperl/epinit.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- epinit.c 16 Aug 2004 07:36:15 -0000 1.20
+++ epinit.c 17 Aug 2004 06:17:58 -0000 1.21
@@ -843,9 +843,9 @@
{
/* when running under mod_perl only register the module */
/* rest will be call from module initialzation when config has been read */
+ ap_s = epxs_sv2_Apache__Server(pApacheSrvSV) ;
embperl_ApacheAddModule () ;
#ifdef APACHE2
- ap_s = epxs_sv2_Apache__Server(pApacheSrvSV) ;
#else
return ok ;
#endif
1.25 +90 -30 embperl/mod_embperl.c
Index: mod_embperl.c
===================================================================
RCS file: /home/cvs/embperl/mod_embperl.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- mod_embperl.c 16 Aug 2004 18:45:15 -0000 1.24
+++ mod_embperl.c 17 Aug 2004 06:17:58 -0000 1.25
@@ -45,10 +45,30 @@
#endif
#endif
+#ifndef APACHE2
+/* from mod_perl 1.x */
+apr_pool_t * perl_get_startup_pool (void)
+{
+ SV *sv ;
+ dTHX ;
+ sv = perl_get_sv("Apache::__POOL", FALSE);
+ if(sv) {
+ IV tmp = SvIV((SV*)SvRV(sv));
+ return (pool *)tmp;
+ }
+ return NULL;
+}
+#endif
+
+
/* debugging by default off, enable with httpd -D EMBPERL_APDEBUG */
static int bApDebug = 0 ;
static int bApInit = 0 ;
+/* subpool to get notified on unload */
+static apr_pool_t * unload_subpool ;
+
+
/* --- declare config datastructure --- */
@@ -203,6 +223,45 @@
return 0 ; /* bInitDone ; */
}
+/*---------------------------------------------------------------------------
+* embperl_ApacheInitUnload
+*/
+/*!
+*
+* \_en
+* Apache 1: Register subpool to get notified on unload
+* Apache 2: nothing
+* \endif
+*
+* \_de
+* Apache 1: Subppol registrieren um einen Unload mitzubekommen
+* Apache 2: nichts
+* \endif
+*
+* ------------------------------------------------------------------------ */
+
+
+
+static int embperl_ApacheInitUnload (apr_pool_t *p)
+
+ {
+#ifdef APACHE2
+ /* apr_pool_sub_make(&subpool, p, NULL); */
+ /* apr_pool_cleanup_register(subpool, NULL, embperl_ApacheInitCleanup, embperl_ApacheInitCleanup); */
+#else
+ if (!unload_subpool && p)
+ {
+ unload_subpool = ap_make_sub_pool(p);
+ ap_register_cleanup(unload_subpool, NULL, embperl_ApacheInitCleanup, embperl_ApacheInitCleanup);
+ if (bApDebug)
+ ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, APLOG_STATUSCODE NULL, "EmbperlDebug: ApacheInitUnload [%d/%d]\n", getpid(), gettid()) ;
+ }
+#endif
+
+
+ }
+
+
/*---------------------------------------------------------------------------
* embperl_ApacheAddModule
@@ -224,34 +283,26 @@
void embperl_ApacheAddModule (void)
{
- /*apr_pool_t * pool ;*/
-
bApDebug |= ap_exists_config_define("EMBPERL_APDEBUG") ;
#ifdef APACHE2
if (bApDebug)
ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, APLOG_STATUSCODE NULL, "EmbperlDebug: Perl part initialization start [%d/%d]\n", getpid(), gettid()) ;
return ;
- /*
- void * p = dlsym (0, "apr_global_hook_pool") ;
-
- if (!p)
- {
- ap_log_error (APLOG_MARK, APLOG_ERR, APLOG_STATUSCODE NULL, "EmbperlDebug: Cannot get address of apr_global_hook_pool [%d/%d]\n", getpid(), gettid()) ;
- return ;
- }
-
- pool = *((apr_pool_t * *)(p)) ;
- */
#else
if (!ap_find_linked_module("mod_embperl.c"))
{
+ apr_pool_t * pool ;
+
if (bApDebug)
ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, APLOG_STATUSCODE NULL, "EmbperlDebug: About to add mod_embperl.c as dynamic module [%d/%d]\n", getpid(), gettid()) ;
ap_add_module (&embperl_module) ;
+
+ pool = perl_get_startup_pool () ;
+ embperl_ApacheInitUnload (pool) ;
}
else
if (bApDebug)
@@ -260,6 +311,7 @@
}
+
/*---------------------------------------------------------------------------
* embperl_ApacheInit
*/
@@ -286,16 +338,13 @@
#endif
{
- apr_pool_t * subpool ;
#ifndef APACHE2
int rc;
#endif
dTHX ;
-#ifdef APACHE2
- apr_pool_sub_make(&subpool, p, NULL);
-#else
- subpool = ap_make_sub_pool(p);
+#ifndef APACHE2
+ embperl_ApacheInitUnload (p) ;
#endif
bApDebug |= ap_exists_config_define("EMBPERL_APDEBUG") ;
@@ -304,12 +353,10 @@
ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, APLOG_STATUSCODE NULL, "EmbperlDebug: ApacheInit [%d/%d]\n", getpid(), gettid()) ;
#ifdef APACHE2
- /* apr_pool_cleanup_register(subpool, NULL, embperl_ApacheInitCleanup, embperl_ApacheInitCleanup); */
ap_add_version_component (p, "Embperl/"VERSION) ;
bApInit = 1 ;
return APR_SUCCESS ;
#else
- ap_register_cleanup(subpool, NULL, embperl_ApacheInitCleanup, embperl_ApacheInitCleanup);
ap_add_version_component ("Embperl/"VERSION) ;
if ((rc = embperl_Init (aTHX_ NULL, NULL, s)) != ok)
@@ -356,7 +403,7 @@
{
if (bApDebug)
ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, APLOG_STATUSCODE NULL, "EmbperlDebug: ApacheInitCleanup: mod_perl.c dynamicly loaded -> remove mod_embperl.c [%d/%d]\n", getpid(), gettid()) ;
- embperl_EndPass1 () ;
+ /*embperl_EndPass1 () ;*/
ap_remove_module (&embperl_module) ;
}
else
@@ -508,6 +555,8 @@
tApacheDirConfig *cfg ;
apr_pool_t * subpool ;
+ embperl_ApacheInitUnload (p) ;
+
#ifdef APACHE2
apr_pool_sub_make(&subpool, p, NULL);
#else
@@ -550,6 +599,8 @@
bApDebug |= ap_exists_config_define("EMBPERL_APDEBUG") ;
+ embperl_ApacheInitUnload (p) ;
+
embperl_DefaultReqConfig (&cfg -> ReqConfig) ;
embperl_DefaultAppConfig (&cfg -> AppConfig) ;
embperl_DefaultComponentConfig (&cfg -> ComponentConfig) ;
@@ -621,27 +672,32 @@
}
#undef EPCFG_SAVE
+
+#ifdef PERL_IMPLICIT_CONTEXT
+#define dTHXCond if (!aTHX) aTHX = PERL_GET_THX ;
+#else
+#define dTHXCond
+#endif
+
#define EPCFG_SAVE(STRUCT,TYPE,NAME,CFGNAME) \
if (add -> set_##STRUCT##NAME) \
{ \
mrg -> set_##STRUCT##NAME = 1 ; \
mrg -> STRUCT.NAME = add -> STRUCT.NAME ; \
- if (mrg -> STRUCT.NAME) \
- SvREFCNT_inc((SV *)mrg -> STRUCT.NAME) ; \
mrg -> save_##STRUCT##NAME = add -> save_##STRUCT##NAME ; \
- if (mrg -> STRUCT.NAME) \
- SvREFCNT_inc((SV *)mrg -> STRUCT.NAME) ; \
if (bApDebug) \
ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, APLOG_STATUSCODE NULL, "EmbperlDebug: Merge "#CFGNAME" (type="#TYPE") => %s\n", mrg -> save_##STRUCT##NAME?mrg -> save_##STRUCT##NAME:"<null>") ; \
} \
else \
{ \
- if (mrg -> STRUCT.NAME) \
- SvREFCNT_inc((SV *)mrg -> STRUCT.NAME) ; \
if (bApDebug && mrg -> set_##STRUCT##NAME) \
ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, APLOG_STATUSCODE NULL, "EmbperlDebug: Merge "#CFGNAME" (type="#TYPE") stays %s\n", mrg -> save_##STRUCT##NAME?mrg -> save_##STRUCT##NAME:"<null>") ; \
- }
-
+ } \
+ if (mrg -> STRUCT.NAME) \
+ { \
+ dTHXCond \
+ SvREFCNT_inc((SV *)mrg -> STRUCT.NAME) ; \
+ }
/*---------------------------------------------------------------------------
* embperl_merge_dir_config
@@ -657,6 +713,10 @@
tApacheDirConfig *base = (tApacheDirConfig *)basev;
tApacheDirConfig *add = (tApacheDirConfig *)addv;
apr_pool_t * subpool ;
+#ifdef PERL_IMPLICIT_CONTEXT
+ pTHX ;
+ aTHX = NULL ;
+#endif
#ifdef APACHE2
apr_pool_sub_make(&subpool, p, NULL);
1.143 +7 -2 embperl/test.pl
Index: test.pl
===================================================================
RCS file: /home/cvs/embperl/test.pl,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -r1.142 -r1.143
--- test.pl 16 Aug 2004 07:36:18 -0000 1.142
+++ test.pl 17 Aug 2004 06:17:58 -0000 1.143
@@ -1152,6 +1152,7 @@
$httpdconf = "$confpath/httpd.conf" ;
$httpdstopconf = "$confpath/httpd.stop.conf" ;
+$httpdminconf = "$confpath/httpd.min.conf" ;
$httpderr = "$tmppath/httpd.err.log" ;
$offlineerr = "$tmppath/test.err.log" ;
$outfile = "$tmppath/out.htm" ;
@@ -2495,14 +2496,18 @@
}
#### Start httpd
- print "\n\nStarting httpd... " ;
unlink "$tmppath/httpd.pid" ;
unlink $httpderr ;
chmod 0666, $logfile ;
$XX = $opt_multchild && !($opt_gdb || $opt_ddd)?'':'-X' ;
+ print "\n\nPerforming httpd syntax check 1 ...\n" ;
+ $rc = system ("\"$EPHTTPD\" " . ($opt_cfgdebug?"-D EMBPERL_APDEBUG ":'') . " -t -f \"$EPPATH/$httpdminconf\" ") ; #and die "***Cannot check syntax by $EPHTTPD (rc=$rc)" ;
+ print "\n\nPerforming httpd syntax check 2 ...\n" ;
+ $rc = system ("\"$EPHTTPD\" " . ($opt_cfgdebug?"-D EMBPERL_APDEBUG ":'') . " -t -f \"$EPPATH/$httpdconf\" ") ; #and die "***Cannot check syntax by $EPHTTPD (rc=$rc)" ;
+ print "\n\nStarting httpd... " ;
if ($EPWIN32)
{
#$ENV{PATH} .= ";$EPHTTPDDLL;$EPHTTPDDLL\\..\\os\\win32\\release;$EPHTTPDDLL\\..\\os\\win32\\debug" if ($EPWIN32) ;
1.1 embperl/test/conf/httpd.min.conf.src
Index: httpd.min.conf.src
===================================================================
# $Id: httpd.min.conf.src,v 1.1 2004/08/17 06:17:59 richter Exp $
$minstartup = $EPSTARTUP ;
$minstartup =~ s/startup.pl/startup_dso.pl/ ;
print OFH <<EOD ;
#
# Testconfig for Embperl make test
#
# This file is automaticly generated each time you run make test/make start/make stop
#
ServerType standalone
HostnameLookups off
ServerAdmin webmaster
ServerRoot \"$EPPATH/test\"
ServerName localhost
DocumentRoot \"$EPPATH/test\"
Listen $EPPORT
EOD
if ($^O ne 'MSWin32')
{
print OFH <<EOD ;
User $EPUSER
Group $EPGROUP
MinSpareServers 1
MaxSpareServers 30
StartServers 3
MaxClients 10
MaxRequestsPerChild 0
EOD
}
print OFH "$EPMODPERL\n" ;
print OFH "LoadModule embperl_module \"$EPPATH/blib/arch/auto/Embperl/Embperl.so\"\n" if ($MP2) ;
print OFH <<EOD ;
ErrorLog tmp/httpd.err.log
PidFile tmp/httpd.pid
AccessConfig conf/null
ResourceConfig conf/null
TypesConfig conf/null
LockFile tmp/httpd.lock
PerlRequire \"$EPPATH/test/conf/$minstartup\"
PerlModule Embperl
EOD
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-cvs-help@perl.apache.org