Re: DirectoryIndex ignored when using perl-handler

[prev] [thread] [next] [Date index for 2005/04/25]

From: Geoffrey Young
Subject: Re: DirectoryIndex ignored when using perl-handler
Date: 17:51 on 25 Apr 2005

>>SetHandler is forcing the handler to be mod_perl, but really mod_dir needs
>>to step in and handle the / -> DirectoryIndex conversion. so... what I would
>>do is alter that fixup handler to do something like this
>>
>>  if ($r->handler('perl-script') && -d $r->filename && $r->is_initial_req) {
>>    $r->hander(Apache2::Const::DIR_MAGIC_TYPE);
>>  }
>>
>>or somesuch.  basically, what you want to happen is for mod_dir to apply the
>>directory index and issue it's normal internal_direct to mod_perl.  un-doing
>>mod_mime's SetHandler for just the main request ought to do that.

that code is essentially right.  well, except that the above example sets
$r->handler instead of comparing it.  adding the code at the bottom of this
mail essentially makes your tests pass, except that I think your last test
is wrong - your DirectoryIndex puts the index script ahead of everything
else, so the results should match "Hello" and not "welcome".


> I tried adding the above code to Apache::Dir 

Apache::Dir was just an example.  the below code used as the only fixup
handler should do the trick.

HTH

--Geoff

package My::Fixup;

use strict;
use warnings FATAL => qw(all);

use Apache2::Const -compile => qw(DIR_MAGIC_TYPE OK DECLINED);
use Apache2::RequestRec;

sub handler {

  my $r = shift;

  if ($r->handler eq 'perl-script' &&
      -d $r->filename              &&
      $r->is_initial_req)
  {
    $r->handler(Apache2::Const::DIR_MAGIC_TYPE);

    return Apache2::Const::OK;
  }

  return Apache2::Const::DECLINED;
}

1;

(message missing)

DirectoryIndex ignored when using perl-handler
William McKee 00:06 on 13 Apr 2005

Re: DirectoryIndex ignored when using perl-handler
Geoffrey Young 00:33 on 13 Apr 2005

Re: DirectoryIndex ignored when using perl-handler
William McKee 13:54 on 13 Apr 2005

Re: DirectoryIndex ignored when using perl-handler
William McKee 19:14 on 13 Apr 2005

Re: DirectoryIndex ignored when using perl-handler
Geoffrey Young 00:21 on 14 Apr 2005

Re: DirectoryIndex ignored when using perl-handler
William McKee 14:08 on 25 Apr 2005

Re: DirectoryIndex ignored when using perl-handler
Geoffrey Young 17:51 on 25 Apr 2005

Re: DirectoryIndex ignored when using perl-handler
Geoffrey Young 15:39 on 27 Apr 2005

Re: DirectoryIndex ignored when using perl-handler
William McKee 20:35 on 25 Apr 2005

Re: DirectoryIndex ignored when using perl-handler
Thomas Hilbig 04:39 on 21 May 2005

Re: DirectoryIndex ignored when using perl-handler
Geoffrey Young 05:39 on 21 May 2005

Re: DirectoryIndex ignored when using perl-handler
Thomas Hilbig 16:07 on 22 May 2005

Re: DirectoryIndex ignored when using perl-handler
Geoffrey Young 14:43 on 23 May 2005

Re: DirectoryIndex ignored when using perl-handler
Thomas Hilbig 15:56 on 24 May 2005

Generated at 15:53 on 25 May 2005 by mariachi v0.52