httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (David Robinson)
Subject Re: slight API change
Date Sun, 10 Mar 1996 15:03:00 GMT
Alexei wrote:
>If you've taken a look at how the proxy module in Apache 1.1 works, or at
>the ScriptAlias code in mod_alias.c/mod_cgi.c, you'll notice something
>about the way Apache handles requests - by content type. While this works
>fine for documents with content types, it doesn't work so well with
>documents that have to be served based on their URL, or filename, or
>whatever else.
>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).
>Another advantage is that since it doesn't override content_type, and 
>lets the type_checker routines run their usual course, you still get a 
>content type. An FTP proxy, for example, could pull the content type 
>right out of r->content_type, since mod_mime would have found the right 
>type all by itself, but still handle the request with its own handler, no 
>strings attached.

Shouldn't 'handler' be set by default from the filename, thus
bypassing the whole magic mime-type stuff?

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

>Date: Fri, 22 Dec 95 12:46 GMT
>From: (David Robinson)
>Subject: Re: CVS and generalising connections

>My other complaint is the overloaded use of the mime-type of the file.
>Apache uses this to
>1. Determine which handler to invoke.
>2. What mime type to return for the data object.
>These should really be separated; this would avoid the
>text/x-server-parsed-html3 hack. It would also enable content-negotation
>on CGI scripts, directories, etc; for example,
>would be known to return text/html;
>would be known to contain English documents.
>Other examples
>AddHandler cgi cgi
>foobar.html.cgi  is a script that returns HTML. 
>Or, in a .htaccess file
>#parse all .html files
>AddHandler include html
>And if handlers are 'functions' that take parameters, then we could have
>#automatically convert .ms to html
>AddType text/html ms
>AddHandler cgi("/cgi-bin/ms2html") ms
>#only parse if executable
>AddHAndler include(xbithack) html
>Clearly, for compatibility we would have
>AddType text/x-server-parsed-html yyy
>equivalent to 
>AddType text/html yyy
>AddHandler include yyy
> David.

View raw message