On Tue, 25 Apr 2000, Doug MacEachern wrote:

> On Sat, 22 Apr 2000, Matt Sergeant wrote:
> 
> > On Sat, 22 Apr 2000, Matt Sergeant wrote:
> > 
> > > The only thing I can think of, is that Apache::MimeXML is somehow stopping
> > > the PerlHandler phase from being executed. Can it do that (but still allow
> > > the PerlFixupHandler phase to execute)???
> > 
> > OK, it was Apache::MimeXML... Which is very odd indeed. A bug in mod_perl
> > by the looks of things. All I'm returning from Apache::MimeXML, btw, is
> > OK or DECLINED. It was returning OK when PerlHandler stopped working. For
> > now I'll disable it, and set Mime types manually for .xml files - but
> > something is seriously not right there.
> 
> as i already explained to matt in another email, if a TypeHandler returns
> OK, then mod_mime's type handler is not called.  which means that
> SetHandler, AddType, etc., for that require will be ignored, unless you
> return DECLINED or implement them yourself (see Apache::MIME in ch8 of
> the eagle book)

OK, I'm looking at that now, and I realise you're just passing it straight
through to apache to do the right thing, but I think it's the wrong
thing... Hear me out.

Apache::MimeXML, like most non-PerlHandler handlers, is not designed as a
replacement for mod_mime, but to build on it. If I detect something as
XML, I'd like to say "OK, I'm done with this phase, let the next
continue". Likewise if I don't want to handle this phase (i.e. I want
mod_mime to do its thang) I return DECLINED. I don't want a MIME handler
that's supposed to add to mod_mime to change the fact that I have a
PerlHandler setup. In order to build Apache::MimeXML properly, I'd have to
build an entire replacement for mod_mime, in XS, parsing the configuration
for SetHandler, and I don't want to do that.

I guess the problem is that mod_mime implements SetHandler - and I'm not
convinced it should. If you were given the opportunity to do it all again
I'd suggest it be done as follows:

If a PerlTypeHandler returns OK,  check if
@{$r->get_handlers('PerlHandler')} is true (i.e. there's a PerlHandler
waiting in the wings). If so, call $r->handler('perl-script').

If a PerlTypeHandler returns DECLINED, do it as you do now.

That should be backwards compatible with most code, I think. And not
interfere with things already setup in peoples httpd.conf/htaccess
files. Alternatively have the OK case remain the same, and have a new
return value (DONE?) that signfies to do the SetHandler part of mod_mime.

Convince me I'm thinking wrong, then I can get back to some real work ;-)

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org

Reply via email to