perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From go...@apache.org
Subject svn commit: r386774 - in /perl/modperl/trunk: ./ src/modules/perl/ t/response/TestAPI/ t/response/TestCompat/ xs/Apache2/ServerUtil/ xs/maps/
Date Sat, 18 Mar 2006 00:38:52 GMT
Author: gozer
Date: Fri Mar 17 16:38:48 2006
New Revision: 386774

URL: http://svn.apache.org/viewcvs?rev=386774&view=rev
Log:
Fixed problems with add_config() and thread-safety:

 - $s->add_config croaks if called after server startup
 - $r->add_config can only affect configuration for the current
   request, just like .htaccess files do
  

Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/src/modules/perl/modperl_apache_compat.h
    perl/modperl/trunk/src/modules/perl/modperl_config.c
    perl/modperl/trunk/t/response/TestAPI/add_config.pm
    perl/modperl/trunk/t/response/TestCompat/apache.pm
    perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
    perl/modperl/trunk/xs/maps/modperl_functions.map

Modified: perl/modperl/trunk/Changes
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=386774&r1=386773&r2=386774&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Fri Mar 17 16:38:48 2006
@@ -12,6 +12,14 @@
 
 =item 2.0.3-dev
 
+Fixed problems with add_config() and thread-safety: [Gozer]
+- $s->add_config is not allowed anymore after server startup
+- $r->add_config can only affect configuration for the current
+  request, just like .htaccess files do
+
+$s->add_config is not allowed at request time anymore. $r->add_config
+can only affect configuration f
+
 Make sure that LIBS and other MakeMaker command line flags are not
 ignored by the top level Makefile.PL and xs/APR/APR/Makefile.PL [Stas]
 

Modified: perl/modperl/trunk/src/modules/perl/modperl_apache_compat.h
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_apache_compat.h?rev=386774&r1=386773&r2=386774&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_apache_compat.h (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_apache_compat.h Fri Mar 17 16:38:48 2006
@@ -44,6 +44,8 @@
 #define MP_HTTPD_HAS_OVERRIDE_OPTS
 #endif
 
+#define MP_HTTPD_OVERRIDE_HTACCESS (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
+
 #define MP_HTTPD_OVERRIDE_OPTS_UNSET (-1)
 #define MP_HTTPD_OVERRIDE_OPTS_DEFAULT (OPT_UNSET | \
                                         OPT_ALL | \

Modified: perl/modperl/trunk/src/modules/perl/modperl_config.c
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_config.c?rev=386774&r1=386773&r2=386774&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_config.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_config.c Fri Mar 17 16:38:48 2006
@@ -602,10 +602,6 @@
         /* pass a non-NULL path if nothing else given and for compatibility */
         path = "/";
     }
-    else if (!*path) {
-        /* an empty string says a NULL pointer should be used here */
-        path = NULL;
-    }
 
     errmsg = modperl_config_insert(aTHX_
                                    r->server, r->pool, r->pool,

Modified: perl/modperl/trunk/t/response/TestAPI/add_config.pm
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestAPI/add_config.pm?rev=386774&r1=386773&r2=386774&view=diff
==============================================================================
--- perl/modperl/trunk/t/response/TestAPI/add_config.pm (original)
+++ perl/modperl/trunk/t/response/TestAPI/add_config.pm Fri Mar 17 16:38:48 2006
@@ -53,16 +53,6 @@
     };
     $r->pnotes(add_config2 => "$@");
 
-    eval {
-        my $directory = join '/', ('', $r->document_root,
-                                   'TestAPI__add_config');
-        $r->add_config(["<Directory $directory>",
-                      'AllowOverride All Options'.$o,
-                      '</Directory>'
-                      ], -1, '');
-    };
-    $r->pnotes(add_config4 => "$@");
-
     return Apache2::Const::DECLINED;
 }
 
@@ -75,6 +65,11 @@
     };
     $r->pnotes(add_config3 => "$@");
 
+    eval {
+        $r->server->add_config(['ServerAdmin foo@bar.com']);
+    };
+    $r->pnotes(add_config4 => "$@");
+
     return Apache2::Const::DECLINED;
 }
 
@@ -87,7 +82,7 @@
     ok t_cmp $r->pnotes('add_config1'), qr/.+\n/;
     ok t_cmp $r->pnotes('add_config2'), (APACHE22 ? qr/.+\n/ : '');
     ok t_cmp $r->pnotes('add_config3'), '';
-    ok t_cmp $r->pnotes('add_config4'), '';
+    ok t_cmp $r->pnotes('add_config4'), qr/after server startup/;
 
     my $default_opts = 0;
     unless (APACHE22) {
@@ -115,6 +110,9 @@
         PerlModule TestAPI::add_config
         AccessFileName htaccess
         SetHandler modperl
+        <Directory @DocumentRoot@>
+            AllowOverride All
+        </Directory>
         PerlResponseHandler TestAPI::add_config
         PerlMapToStorageHandler TestAPI::add_config::map2storage
         PerlFixupHandler TestAPI::add_config::fixup

Modified: perl/modperl/trunk/t/response/TestCompat/apache.pm
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestCompat/apache.pm?rev=386774&r1=386773&r2=386774&view=diff
==============================================================================
--- perl/modperl/trunk/t/response/TestCompat/apache.pm (original)
+++ perl/modperl/trunk/t/response/TestCompat/apache.pm Fri Mar 17 16:38:48 2006
@@ -12,10 +12,16 @@
 
 use ModPerl::Util ();
 use Apache2::compat ();
-use Apache::Constants qw(DIR_MAGIC_TYPE :common :response);
+use Apache::Constants qw(DIR_MAGIC_TYPE OPT_EXECCGI :common :response);
 
 use File::Spec::Functions qw(catfile canonpath);
 
+sub fixup {
+    my $r = shift;
+    Apache->httpd_conf('Options +ExecCGI');
+    OK;
+}
+
 sub handler {
     my $r = shift;
 
@@ -75,11 +81,8 @@
     ok t_cmp(OK, "0",
              'OK');
 
-    my $admin = $r->server->server_admin;
-    Apache->httpd_conf('ServerAdmin foo@bar.com');
-    ok t_cmp($r->server->server_admin, 'foo@bar.com',
-             'Apache->httpd_conf');
-    Apache->httpd_conf("ServerAdmin $admin");
+    my $exec_cgi = $r->allow_options & Apache2::Const::OPT_EXECCGI;
+    ok t_cmp($exec_cgi, Apache2::Const::OPT_EXECCGI, 'Apache->httpd_conf');
 
     # (Apache||$r)->server_root_relative
     {
@@ -124,4 +127,7 @@
 
 __END__
 # so we can test whether send_httpd_header() works fine
-PerlOptions +ParseHeaders
+PerlOptions +ParseHeaders +GlobalRequest
+AllowOverride Options
+PerlModule TestCompat::apache
+PerlFixupHandler TestCompat::apache::fixup

Modified: perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h?rev=386774&r1=386773&r2=386774&view=diff
==============================================================================
--- perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h (original)
+++ perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h Fri Mar 17 16:38:48 2006
@@ -174,7 +174,11 @@
 static MP_INLINE
 void mpxs_Apache2__ServerRec_add_config(pTHX_ server_rec *s, SV *lines)
 {
-    const char *errmsg = modperl_config_insert_server(aTHX_ s, lines);
+    const char *errmsg;
+
+    MP_CROAK_IF_POST_POST_CONFIG_PHASE("$s->add_config");
+
+    errmsg = modperl_config_insert_server(aTHX_ s, lines);
     if (errmsg) {
         Perl_croak(aTHX_ "$s->add_config() has failed: %s", errmsg);
     }

Modified: perl/modperl/trunk/xs/maps/modperl_functions.map
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/maps/modperl_functions.map?rev=386774&r1=386773&r2=386774&view=diff
==============================================================================
--- perl/modperl/trunk/xs/maps/modperl_functions.map (original)
+++ perl/modperl/trunk/xs/maps/modperl_functions.map Fri Mar 17 16:38:48 2006
@@ -30,7 +30,7 @@
  mpxs_Apache2__RequestRec_location
  mpxs_Apache2__RequestRec_as_string
  mpxs_Apache2__RequestRec_pnotes | | r, key=Nullsv, val=Nullsv
- mpxs_Apache2__RequestRec_add_config | | r, lines, override=OR_AUTHCFG, path=NULL, override_options=MP_HTTPD_OVERRIDE_OPTS_UNSET
+ mpxs_Apache2__RequestRec_add_config | | r, lines, override=MP_HTTPD_OVERRIDE_HTACCESS, path=NULL,
override_options=MP_HTTPD_OVERRIDE_OPTS_UNSET
  mpxs_Apache2__RequestRec_document_root | | r, new_root=Nullsv
  mpxs_Apache2__RequestRec_child_terminate
 



Mime
View raw message