David Wheeler wrote:
> On May 11, 2004, at 3:24 PM, Geoffrey Young wrote:
> 
>> ClearModuleList/AddModule are not DSO specific - they just shuffle around
>> the order of the internal module list, which is what apache dispatches
>> against at request time.  note that both of these are provide by core,
>> while
>> LoadModule is provided by mod_so.
>>
>>> Does that apply to Apache 1.3 as well as 2.0?
>>
>>
>> unfortunately not.  I'm working on the ability to shuffle module
>> around like
>> that, but I can't get it to work on win32.
> 
> 
> Ah, okay, so just to be clear, with Apache 2, I can do this:
> 
>   ClearModuleList
>   AddModule mod_dir
>   AddModule mod_perl
> 
> And mod_dir will do its thing before things get passed on to any
> mod_perl handlers. Is that right?

well, not really :)

that's the way it would work with apache 1.3, except that ClearModuleList
unloads everything, so you now need an AddModule for every module, including
mod_cgi, mod_rewrite, mod_auth, etc.

outside of that, mod_dir needs to go last, which would give it a higher
priority.  it's the same as when you do httpd -l to list static modules -
modules at the bottom of the list get first dibs at the request.  you'll see
mod_perl at the bottom, which is generally what we want but what is causing
you grief at the moment.

but outside of those caveats, yes.  giving mod_dir a higher priority will
mean that apache calls it first for every phase that mod_dir enters.  for
the content generation phase, mod_dir will run and return OK and apache will
move to the logging phase, leaving mod_perl behind.

in apache 2.0 it's a bit different.  when a module registers a hook with
apache - say mod_rewrite's hook into translation - the module itself tells
apache the order.  a module can choose to run first, last, or a few other
things.  this is good for developers but kinda hard on administrators
because there is absoltely no ability to do the kind of thing in 2.0.  I was
trying to give mod_perl the ability to dynamically alter its own order and
it worked for linux but not win32.  one of several threads is here if you're
interested:

  http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=107723862520564&w=2

> 
>> but directories are really something different.  in mp2 it looks like
>> we'll
>> need to take the approach that mod_dir does in 2.0 - if you want your
>> PerlResponseHandler to be triggered for directories you'll
>> specifically need
>> to set $r->handler('perl-script') in a fixup handler.
> 
> 
> Really?! How come?

ok, the way the content generation phase is dispatched is completely
different in apache 2.0.  in 1.3 apache only dispatched to registered
handlers - if r->handler was perl-script then apache called mod_perl, for
instance.  in 2.0 apache calls _every_ handler, and every hander has the
responsibility to check r->handler itself.

so, in 1.3 mod_perl registered itself for perl-script and DIR_MAGIC_TYPE,
but in 2.0 there is no registration process.  currently mod_perl only checks
r->handler for 'perl-script' or 'modperl' and dispatches accordingly.  I
suppose it could check for DIR_MAGIC_TYPE as well, but then to which handler
to do dispatch to, perl-script or modperl?  the way mod_dir handles this is
it runs a fixup handler that sets DIR_MAGIC_TYPE if a) it's a directory, and
b) r->handler wasn't already set.

really, the number of people that actually want to handle directories
themselves is few (if any), so setting $r->handler('perl-script') from a
fixup handler isn't that big of a deal.


>> yeah, you can probably just check for DIR_MAGIC_TYPE here.
> 
> 
> Cool, saves the expense of the stat!

well, you could have used $r->finfo to save the stat as well, but yes
DIR_MAGIC_TYPE is probably cleaner :)


> Going back to your last message...
> 
>>   - use a fixup handler to override mod_perl settings.  for example:
>>
>>      use Apache::Constants qw(DECLINED DIR_MAGIC_TYPE):
>>      $r->set_handlers(PerlHandler => sub { return DECLINED })
>>        if $r->content_type = DIR_MAGIC_TYPE;
> 
> 
> This assumes that I want to decline a request for a directory every
> time. But I don't; only if there is no "/" at the end. And that's
> effectively what I'm doing with my Apache::Dir module, no?

well, I didn't look at your code, so I was just guessing.  and it was
untested :)  but yes, you're right, mod_dir only engages when it's a dir
with no trailing / (plus a bunch of other subrequest foo I don't really
understand)

> 
> It looks like I could recommend that it be used as PerlFixupHandler,
> though, instead of a PerlHandler (in 1.3).

yeah, I didn't realize you were using 2.0.  the approaches definitely need
to be different between the two versions, but hopefully everything is a bit
clearer now.  let me know if you still have questions.

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to