You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by YAMAMOTO Kengo <y-...@hh.iij4u.or.jp> on 2001/10/05 22:40:29 UTC

Re: [patch] overriding per directory PerlSetEnv (including bug report)

Thank you responding.

On Thu, 4 Oct 2001 13:48:19 -0400,
Robert Landrum <rl...@capitoladvantage.com> wrote:
> Couldn't you do the same thing by reversing the ordering of your 
> Directory entries...

On Thu, 04 Oct 2001 10:43:31 -0700,
___cliff rayman___ <cl...@genwax.com> wrote:
> i don't think it is supposed to work this way according to the
> apache documentation.  if you want the most specific (longest) one
> to take precedence, put it before the shorter one in the config file.

Rewriting config file so takes no effect (had tested) because
Apache reorders <Directory> section config with most specific to
least specific order (by ap_core_reorder_directories()) precede
merging these configs by directory_walk().

It seems that I had explained my intention not enough in last
mail. I had written the patch to solve following problem.

(1) Since perl_merge_dir_config() uses ap_overlay_tables() to
    merge PerlSetEnv variables, overridden variables remains in
    the table as association list elements (internal
    representation of Apache's table).

(2) The table remains precedences and consistency kept while
    manipulated by Apache's standard table APIs
    (e.g. ap_table_get()).

(3) Although (2), mod_perl scans through internal structure of
    the table directly as association list to dumps variables
    into %ENV by mod_perl_dir_env(). This causes precedence
    reversed on dumped %ENV variables because the list elements
    is ordered by descending precedence.

Above process results that PerlSetEnv always activates least
specific <Directory> section value. It's a real bug.

My patch modifies (3) by reverses iterating direction on dump.
I would like the patch to be tested by someone else and included
in the mod_perl distribution. Please help!


> YAMAMOTO Kengo wrote:
> 
> > 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>

-------------------------------------
YAMAMOTO Kengo y-kengo@hh.iij4u.or.jp

Re: [patch] overriding per directory PerlSetEnv (including bugreport)

Posted by ___cliff rayman___ <cl...@genwax.com>.
much more well understood this time.  thank you.

the developers monitor this list - so if your patch has merit,
i'm sure they will either commit it or something similar.

YAMAMOTO Kengo wrote:

> Thank you responding.
>
> On Thu, 4 Oct 2001 13:48:19 -0400,
> Robert Landrum <rl...@capitoladvantage.com> wrote:
> > Couldn't you do the same thing by reversing the ordering of your
> > Directory entries...
>
> On Thu, 04 Oct 2001 10:43:31 -0700,
> ___cliff rayman___ <cl...@genwax.com> wrote:
> > i don't think it is supposed to work this way according to the
> > apache documentation.  if you want the most specific (longest) one
> > to take precedence, put it before the shorter one in the config file.
>
> Rewriting config file so takes no effect (had tested) because
> Apache reorders <Directory> section config with most specific to
> least specific order (by ap_core_reorder_directories()) precede
> merging these configs by directory_walk().
>
> It seems that I had explained my intention not enough in last
> mail. I had written the patch to solve following problem.
>
> (1) Since perl_merge_dir_config() uses ap_overlay_tables() to
>     merge PerlSetEnv variables, overridden variables remains in
>     the table as association list elements (internal
>     representation of Apache's table).
>
> (2) The table remains precedences and consistency kept while
>     manipulated by Apache's standard table APIs
>     (e.g. ap_table_get()).
>
> (3) Although (2), mod_perl scans through internal structure of
>     the table directly as association list to dumps variables
>     into %ENV by mod_perl_dir_env(). This causes precedence
>     reversed on dumped %ENV variables because the list elements
>     is ordered by descending precedence.
>
> Above process results that PerlSetEnv always activates least
> specific <Directory> section value. It's a real bug.
>
> My patch modifies (3) by reverses iterating direction on dump.
> I would like the patch to be tested by someone else and included
> in the mod_perl distribution. Please help!
>
> > YAMAMOTO Kengo wrote:
> >
> > > 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>
>
> -------------------------------------
> YAMAMOTO Kengo y-kengo@hh.iij4u.or.jp

--
___cliff rayman___cliff@genwax.com___http://www.genwax.com/