Hi,

I rescently started to use mod_perl. It works fine, but a
strange behavior have found. I have written a patch that collect
the behavior. Please comment this.

I think that per directory PerlSetEnv variable should be
overridden by the value that in the most specific(longest)
<Directory> section.

http://localhost/cgi-bin/subdir/printenv with following config
will generate VAR="/usr/local/apache/cgi-bin/subdir", but
generated result is VAR="/usr/local/apache/cgi-bin".

  <Directory /usr/local/apache/cgi-bin>
    PerlSetEnv VAR /usr/local/apache/cgi-bin
  </Directory>
  
  <Directory /usr/local/apache/cgi-bin/subdir>
    PerlSetEnv VAR /usr/local/apache/cgi-bin/subdir
  </Directory>


Following patch corrects this behavior by modify overriding
logic. It seems work well.


--- mod_perl-1.26/src/modules/perl/perl_config.c.orig   Thu Oct  4 09:31:00 2001
+++ mod_perl-1.26/src/modules/perl/perl_config.c        Thu Oct  4 09:32:04 2001
@@ -183,7 +183,8 @@
        table_entry *elts = (table_entry *)arr->elts;
 
        int i;
-       for (i = 0; i < arr->nelts; ++i) {
+       /* iterate in reverse order to override duplicate key properly */
+       for (i = arr->nelts - 1; 0 <= i; --i) {
            MP_TRACE_d(fprintf(stderr, "mod_perl_dir_env: %s=`%s'",
                             elts[i].key, elts[i].val));
            mp_setenv(elts[i].key, elts[i].val);


I'm not familar with mod_perl internals and community. Please
tell me relative topics, more appropriate place to send patch,
etc.

# Make my English writing correct is also welcome :-)

-------------------------------------
YAMAMOTO Kengo [EMAIL PROTECTED]

Reply via email to