httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <>
Subject Re: slight API change
Date Mon, 11 Mar 1996 06:06:20 GMT
On Sun, 10 Mar 1996, David Robinson wrote:

> >So I've made, in a patch which I include below (since it's rather short),
> >a slight change that should make this easier in the future: I've added a
> >new member to request_rec, char *handler. This can be set, at any point
> >during the request, to a string which Apache will key off of instead of
> >content_type when it invokes a handler. If r->handler is empty, it will
> >still use content_type, so this shouldn't affect anything currently in
> >practice, but it does eliminate the need for type_checker hacks and
> >"magic" MIME types for some things. The proxy module, for example, could 
> >just say r->handler = "http-proxy";, and set up a handler for "http-proxy". 
> >(ideally, these non-content-type handlers would have no slashes, so as 
> >not to conflict with MIME types).
> Shouldn't 'handler' be set by default from the filename, thus
> bypassing the whole magic mime-type stuff?

No. Because there is no "default". And in most cases, you still want to 
handle by mime-type. What it eliminates is the "magic" mime-type. 
Non-magic types still exist.

> Or to put it another way, how does your patch address the suggestion I
> made in December?

Thing is, your AddHandler is just another word for AddType. They're the
same thing. And whether you call it a magic mime-type, or just some other
name, they're also the same thing. What the patch does let you do is make
a module that would do: 

AddHandler cgi /cgi-bin/

And have mod_cgi handle a handler named 'cgi'. This would function like
ScriptAlias. It also allows commands like ScriptAlias to handle this
internally, instead of using the forced_type hack mod_alias uses now - the
uri-to-filename conversion stage can set a handler directly. 

Maybe it's not perfect. Nothing is. But it's useful. I can think of at
least two places in Apache where right now, it'd make the server run more
cleanly: ScriptAlias and mod_proxy. And that's worth something.

What it's designed to allow are things that act like directories instead 
of like files, a la ScriptAlias. For example, a statistics module might 
be activated with

Statistics /stats

And then it has a uri-to-filename translator that takes anything starting 
with "/stats" and sets r->handler to "statistics". It then has a handler 
called "statistics", which handles all the stats requests. Without this 
patch, this cannot be done in Apache currently, without resorting to a 
mime type hack.

--// Alexei Kosut // <> // Lefler on IRC --//
-----------------// <> -------// 
"To get the full effect of Pat Buchanan's speeches, they should be
read in the original German." //--------------------------------------

View raw message