[mod_python] setting content_type intelligently

Daniel J. Popowich dpopowich at mtrsd.k12.ma.us
Thu Feb 5 13:58:13 EST 2004


Michael C. Neel writes:
> Well, imho when things get painful it's usally time to consider
> something's not right =).

Agreed!  :-)

> As a hail mary play, I believe there is a phase of the request where
> apache goes searching the disk for the file, separate from the content
> handling phase.  This is where DocumentRoot, Alias, ScriptAlias, etc are
> all handled.  You could handle this yourself, and when you image request
> comes in, set the required pieces of the request data to state the
> location of the image on disk.  The your content handler would return
> apache.DECLINED, and then apache mime magic would take over.

Let me see if I got this right...your theory is that, after
determining I really want apache to handle the request, I should be
able to tweak the req such that returning apache.DECLINED will work
even in a <Location ...>.

Sounds like a great theory to me.  Does anyone know how to do this?

> FYI apache's mime handling is just extension based...

First pass, yes, but there's another module, mod_mime_magic, that can
determine what files are by looking at their first few bytes, like the
unix file(1) command.  This module is used if mod_mime fails.

Daniel




More information about the Mod_python mailing list