You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Torsten Foertsch <to...@gmx.net> on 2006/02/02 18:40:19 UTC

httpd 2.2 vs. add_config

Hi,

mod_perl provides the Apache2::RequestUtil::add_config function that accepts 
$override as the 2nd parameter. For apache 2.0 it is possible to set Options 
by

  $r->add_config(['Options Indexes ExecCGI'], Apache2::Const::OR_OPTIONS). 

This does not work with 2.2. The reason is the more detailed AllowOverride 
statement. It introduces a new field in cmd_parms (override_opts) that holds 
the detailed setting.

struct cmd_parms_struct {
    /** Argument to command from cmd_table */
    void *info;
    /** Which allow-override bits are set */
    int override;
[...]
    /** Which allow-override-opts bits are set */
    int override_opts;
};

The current implementation of modperl_config_insert() creates a cmd_parms 
struct where override_opts is always zero. Hence the add_config statement 
above will always fail.

I suggest the patch below to solve the problem.

Torsten

Re: httpd 2.2 vs. add_config

Posted by Torsten Foertsch <to...@gmx.net>.
On Thursday 02 February 2006 23:14, Philippe M. Chiasson wrote:
> > I suggest the patch below to solve the problem.
>
> Should be OPT_ALL instead of (~0), but it's a sane patch IMO.

I almost agree, but it should read

  OPT_ALL|OPT_INCNOEXEC|OPT_SYM_OWNER|OPT_MULTI

> Really, what's needed is something to expose these new override options to
> mod_perl and allow them too as arguments to add_config().

Well, I thought about that. For compatibility with 2.0 I think the best is to 
use just the patch. But generally I would rather like something like this:

  my $parms=Apache2::CmdParms->new;
  $parms->path('/some/path');
  $parms->override(OR_ALL);
  if( $parms->can('override_opts') ) {
    $parms->override_opts(OPT_ALL);
  }
  $r->add_config( \@lines, $parms );

add_config can check whether $_[1]->isa('Apache2::CmdParms') and do the right 
thing.

How about that?

Torsten

Re: httpd 2.2 vs. add_config

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Torsten Foertsch wrote:
> Hi,
> 
> mod_perl provides the Apache2::RequestUtil::add_config function that accepts 
> $override as the 2nd parameter. For apache 2.0 it is possible to set Options 
> by
> 
>   $r->add_config(['Options Indexes ExecCGI'], Apache2::Const::OR_OPTIONS). 
> 
> This does not work with 2.2. The reason is the more detailed AllowOverride 
> statement. It introduces a new field in cmd_parms (override_opts) that holds 
> the detailed setting.
> 
> struct cmd_parms_struct {
>     /** Argument to command from cmd_table */
>     void *info;
>     /** Which allow-override bits are set */
>     int override;
> [...]
>     /** Which allow-override-opts bits are set */
>     int override_opts;
> };
> 
> The current implementation of modperl_config_insert() creates a cmd_parms 
> struct where override_opts is always zero. Hence the add_config statement 
> above will always fail.
> 
> I suggest the patch below to solve the problem.

Should be OPT_ALL instead of (~0), but it's a sane patch IMO.

Really, what's needed is something to expose these new override options to
mod_perl and allow them too as arguments to add_config().

> ------------------------------------------------------------------------
> 
> --- src/modules/perl/modperl_config.c~	2005-10-21 02:04:26.000000000 +0200
> +++ src/modules/perl/modperl_config.c	2006-02-02 18:33:22.468616732 +0100
> @@ -515,6 +515,9 @@
>      parms.override = override;
>      parms.path = path;
>      parms.pool = p;
> +#if AP_SERVER_MAJORVERSION_NUMBER>2 || AP_SERVER_MINORVERSION_NUMBER>=2
> +    parms.override_opts = ~0;
> +#endif
>  
>      if (ptmp) {
>          parms.temp_pool = ptmp;

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5