stas 2004/01/09 18:52:20
Modified: src/modules/perl modperl_config.c modperl_config.h xs/Apache/RequestUtil Apache__RequestUtil.h xs/Apache/ServerUtil Apache__ServerUtil.h xs/maps modperl_functions.map xs/tables/current/ModPerl FunctionTable.pm . Changes Added: t/modperl perl_options.t t/response/TestModperl perl_options.pm Log: added ($r|$s)->is_perl_option_enabled($option_name), to test for PerlOptions + tests Revision Changes Path 1.1 modperl-2.0/t/modperl/perl_options.t Index: perl_options.t =================================================================== use strict; use warnings FATAL => 'all'; use Apache::Test; use Apache::TestUtil; use Apache::TestRequest; my $module = "TestModperl::perl_options"; Apache::TestRequest::module($module); my $hostport = Apache::TestRequest::hostport(Apache::Test::config()); my $location = "http://$hostport/$module"; print GET_BODY_ASSERT "http://$hostport/$module"; 1.1 modperl-2.0/t/response/TestModperl/perl_options.pm Index: perl_options.pm =================================================================== package TestModperl::perl_options; # test whether PerlOptions options are enabled use strict; use warnings FATAL => 'all'; use Apache::RequestRec (); use Apache::RequestIO (); use Apache::RequestUtil (); use Apache::ServerUtil (); use Apache::Test; use Apache::TestUtil; use Apache::Const -compile => qw(OK); my @srv_plus = qw(ChildInit ChildExit Fixup); my @srv_minus = qw(PreConnection ProcessConnection Autoload Log InputFilter OutputFilter); my @dir_plus = qw(ParseHeaders MergeHandlers); my @dir_minus = qw(SetupEnv GlobalRequest); sub handler { my $r = shift; plan $r, tests => @srv_plus + @srv_minus + @dir_plus + @dir_minus; my $s = $r->server; ok t_cmp(1, $s->is_perl_option_enabled($_), "PerlOptions +$_") for @srv_plus; ok t_cmp(0, $s->is_perl_option_enabled($_), "PerlOptions -$_") for @srv_minus; ok t_cmp(1, $r->is_perl_option_enabled($_), "PerlOptions +$_") for @dir_plus; ok t_cmp(0, $r->is_perl_option_enabled($_), "PerlOptions -$_") for @dir_minus; return Apache::OK; } 1; __DATA__ <VirtualHost TestModperl::perl_options> PerlOptions -PreConnection -ProcessConnection PerlOptions -Autoload -Log -InputFilter -OutputFilter PerlOptions +ChildInit +ChildExit PerlModule TestModperl::perl_options PerlOptions +ParseHeaders <Location /TestModperl::perl_options> SetHandler modperl PerlOptions -GlobalRequest -SetupEnv PerlOptions +MergeHandlers PerlResponseHandler TestModperl::perl_options </Location> </VirtualHost> 1.74 +35 -0 modperl-2.0/src/modules/perl/modperl_config.c Index: modperl_config.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v retrieving revision 1.73 retrieving revision 1.74 diff -u -u -r1.73 -r1.74 --- modperl_config.c 9 Jan 2004 04:59:18 -0000 1.73 +++ modperl_config.c 10 Jan 2004 02:52:20 -0000 1.74 @@ -489,3 +489,38 @@ return NULL; } + + +/* if r!=NULL check for dir PerlOptions, otherwise check for server + * PerlOptions, (s must be always set) + */ +int modperl_config_is_perl_option_enabled(pTHX_ request_rec *r, + server_rec *s, const char *name) +{ + U32 flag; + MP_dSCFG(s); + + /* XXX: should we test whether perl is disabled for this server? */ + /* if (!MpSrvENABLE(scfg)) { */ + /* return 0; */ + /* } */ + + if (r) { + if ((flag = modperl_flags_lookup_dir(name))) { + MP_dDCFG; + return MpDirFLAGS(dcfg) & flag ? 1 : 0; + } + else { + Perl_croak(aTHX_ "PerlOptions %s is not a directory option", name); + } + } + else { + if ((flag = modperl_flags_lookup_srv(name))) { + return MpSrvFLAGS(scfg) & flag ? 1 : 0; + } + else { + Perl_croak(aTHX_ "PerlOptions %s is not a server option", name); + } + } + +} 1.32 +5 -0 modperl-2.0/src/modules/perl/modperl_config.h Index: modperl_config.h =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -u -r1.31 -r1.32 --- modperl_config.h 5 Sep 2002 01:47:39 -0000 1.31 +++ modperl_config.h 10 Jan 2004 02:52:20 -0000 1.32 @@ -122,4 +122,9 @@ SV *lines, char *path, int override); + +int modperl_config_is_perl_option_enabled(pTHX_ request_rec *r, + server_rec *s, const char *name); + + #endif /* MODPERL_CONFIG_H */ 1.19 +7 -0 modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h Index: Apache__RequestUtil.h =================================================================== RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -u -r1.18 -r1.19 --- Apache__RequestUtil.h 30 Aug 2003 02:33:26 -0000 1.18 +++ Apache__RequestUtil.h 10 Jan 2004 02:52:20 -0000 1.19 @@ -248,3 +248,10 @@ return svh.sv; } +static MP_INLINE +int mpxs_Apache__RequestRec_is_perl_option_enabled(pTHX_ request_rec *r, + const char *name) +{ + return modperl_config_is_perl_option_enabled(aTHX_ r, r->server, name); +} + 1.9 +7 -0 modperl-2.0/xs/Apache/ServerUtil/Apache__ServerUtil.h Index: Apache__ServerUtil.h =================================================================== RCS file: /home/cvs/modperl-2.0/xs/Apache/ServerUtil/Apache__ServerUtil.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -u -r1.8 -r1.9 --- Apache__ServerUtil.h 19 Nov 2001 23:46:48 -0000 1.8 +++ Apache__ServerUtil.h 10 Jan 2004 02:52:20 -0000 1.9 @@ -51,6 +51,13 @@ return ap_server_root_relative(p, fname); } +static MP_INLINE +int mpxs_Apache__Server_is_perl_option_enabled(pTHX_ server_rec *s, + const char *name) +{ + return modperl_config_is_perl_option_enabled(aTHX_ NULL, s, name); +} + static void mpxs_Apache__ServerUtil_BOOT(pTHX) { newCONSTSUB(PL_defstash, "Apache::server_root", 1.64 +2 -0 modperl-2.0/xs/maps/modperl_functions.map Index: modperl_functions.map =================================================================== RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v retrieving revision 1.63 retrieving revision 1.64 diff -u -u -r1.63 -r1.64 --- modperl_functions.map 23 Dec 2003 03:02:34 -0000 1.63 +++ modperl_functions.map 10 Jan 2004 02:52:20 -0000 1.64 @@ -21,6 +21,7 @@ mpxs_Apache__RequestRec_push_handlers mpxs_Apache__RequestRec_set_handlers mpxs_Apache__RequestRec_get_handlers + mpxs_Apache__RequestRec_is_perl_option_enabled mpxs_Apache__RequestRec_location mpxs_Apache__RequestRec_as_string mpxs_Apache__RequestRec_pnotes | | r, key=Nullsv, val=Nullsv @@ -67,6 +68,7 @@ mpxs_Apache__Server_push_handlers mpxs_Apache__Server_set_handlers mpxs_Apache__Server_get_handlers + mpxs_Apache__Server_is_perl_option_enabled modperl_config_insert_server | | | add_config PACKAGE=Apache::Server 1.135 +58 -0 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm Index: FunctionTable.pm =================================================================== RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v retrieving revision 1.134 retrieving revision 1.135 diff -u -u -r1.134 -r1.135 --- FunctionTable.pm 23 Dec 2003 03:02:34 -0000 1.134 +++ FunctionTable.pm 10 Jan 2004 02:52:20 -0000 1.135 @@ -1369,6 +1369,28 @@ ] }, { + 'return_type' => 'int', + 'name' => 'modperl_config_is_perl_option_enabled', + 'args' => [ + { + 'type' => 'PerlInterpreter *', + 'name' => 'my_perl' + }, + { + 'type' => 'request_rec *', + 'name' => 's' + }, + { + 'type' => 'server_rec *', + 'name' => 's' + }, + { + 'type' => 'const char *', + 'name' => 'name' + } + ] + }, + { 'return_type' => 'apr_status_t', 'name' => 'modperl_config_req_cleanup', 'args' => [ @@ -5562,6 +5584,24 @@ ] }, { + 'return_type' => 'int', + 'name' => 'mpxs_Apache__RequestRec_is_perl_option_enabled', + 'args' => [ + { + 'type' => 'PerlInterpreter *', + 'name' => 'my_perl' + }, + { + 'type' => 'request_rec *', + 'name' => 'r' + }, + { + 'type' => 'const char *', + 'name' => 'name' + } + ] + }, + { 'return_type' => 'char *', 'name' => 'mpxs_Apache__RequestRec_location', 'args' => [ @@ -5977,6 +6017,24 @@ { 'return_type' => 'SV *', 'name' => 'mpxs_Apache__Server_get_handlers', + 'args' => [ + { + 'type' => 'PerlInterpreter *', + 'name' => 'my_perl' + }, + { + 'type' => 'server_rec *', + 'name' => 's' + }, + { + 'type' => 'const char *', + 'name' => 'name' + } + ] + }, + { + 'return_type' => 'int', + 'name' => 'mpxs_Apache__Server_is_perl_option_enabled', 'args' => [ { 'type' => 'PerlInterpreter *', 1.298 +3 -0 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.297 retrieving revision 1.298 diff -u -u -r1.297 -r1.298 --- Changes 3 Jan 2004 01:17:33 -0000 1.297 +++ Changes 10 Jan 2004 02:52:20 -0000 1.298 @@ -12,6 +12,9 @@ =item 1.99_13-dev +added ($r|$s)->is_perl_option_enabled($option_name), to test for +PerlOptions + tests [Stas] + On Solaris add a workaround for xs/APR/APR/Makefile.PL to build APR.so, correctly linked against apr and apr-util libs, by addding the missing -R paths corresponding to -L flags. EU::MM was adding them via