httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@dsndata.com>
Subject Re: slight API change
Date Mon, 04 Mar 1996 16:35:50 GMT
> A thought...

Funny that the only comment seems to be related to CVS.... *sigh*

This is a great idea and one I was just mulling over a few minutes
ago. I would like to be able to refer certain include directives
to another handler.

ie <!--#module action_module="sometask"-->

This talk of API change also seems to relate to recent discussion of
being able to determine what modules are compiled in which would
somehow require each module to "register" itself with the parent.

My change above requires a slight change to mod_include.c and would
take advantage of your cange to the request_rec structure you propose.

On this same note, I would like to introduce a friend and partner
Chris Radek to the list. He will likely be submitting the patches to
do the above. Chris raised this question to me this past weekend on
how to communicate with other modules in the server. This ought to
cover it.


-Randy



> 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.
> 
> But since this is actually a change to the API, I thought I'd pass it by 
> the list first, see what people thought. I might have missed something, 
> maybe it will mess things up, maybe it's just a bad idea, etc... so, 
> before I commit it to CVS, maybe people could just take a look. Thanks. 
> The patch is:
> 
> *** http_config.c	1996/03/01 02:46:43	1.4
> --- http_config.c	1996/03/02 05:36:35
> ***************
> *** 275,280 ****
> --- 275,281 ----
>      module *modp;
>      handler_rec *handp;
>      char *content_type = r->content_type ? r->content_type : default_type (r);
> +    char *handler = r->handler ? r->handler : r->content_type;
>     
>      /* Pass one --- direct matches */
>      
> ***************
> *** 283,289 ****
>          if (!modp->handlers) continue;
>          
>          for (handp = modp->handlers; handp->content_type; ++handp) {
> ! 	   if (!strcasecmp (content_type, handp->content_type)) {
>   	       int result = (*handp->handler)(r);
>   
>   	       if (result != DECLINED) return result;
> --- 284,290 ----
>          if (!modp->handlers) continue;
>          
>          for (handp = modp->handlers; handp->content_type; ++handp) {
> ! 	   if (!strcasecmp (handler, handp->content_type)) {
>   	       int result = (*handp->handler)(r);
>   
>   	       if (result != DECLINED) return result;
> ***************
> *** 305,311 ****
>   
>   	   len = starp - handp->content_type;
>   	   
> ! 	   if (!len || !strncasecmp (content_type, handp->content_type, len))
>   	   {
>   	       int result = (*handp->handler)(r);
>   
> --- 306,312 ----
>   
>   	   len = starp - handp->content_type;
>   	   
> ! 	   if (!len || !strncasecmp (handler, handp->content_type, len))
>   	   {
>   	       int result = (*handp->handler)(r);
>   
> *** httpd.h	1996/03/01 02:46:45	1.6
> --- httpd.h	1996/03/02 05:36:38
> ***************
> *** 347,352 ****
> --- 347,354 ----
>     table *notes;
>   
>     char *content_type;		/* Break these out --- we dispatch on 'em */
> +   char *handler;		/* We *really* dispach on these, actually */
> + 
>     char *content_encoding;
>     char *content_language;    
> 
> 
> --// Alexei Kosut // <akosut@nueva.pvt.k12.ca.us> // Lefler on IRC --//
> -----------------// <http://www.nueva.pvt.k12.ca.us/~akosut> -------// 
> "To get the full effect of Pat Buchanan's speeches, they should be
> read in the original German." //--------------------------------------
> 
> 




Mime
View raw message