httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@leland.Stanford.EDU>
Subject Re: [PATCH] whine if handler not found
Date Mon, 16 Mar 1998 05:52:19 GMT
On Sun, 15 Mar 1998, Marc Slemko wrote:

> This patch adds a whine to default_handler so that if a specific handler
> is set for a file, but it ends up in default_handler anyway because
> nothing else is found, it whines.
> 
> The idea is that right now "AddHandler heymoron .moron" will just end up
> serving the files as normal and can confuse people a lot if they think
> they have mod_moron compiled in but they don't.
> 
> I am posting this because I am leery of some of the things that some
> modules may do with this so-called API of ours, so if anyone can think of
> any cases where this will warn when it shouldn't...

Here's one thing I can think of: Although it's not really correct (i.e.,
not what handlers are intended for), a module might use a handler as a cue
to do something, and then return DECLINED and let the core (or other)
module actually server the request.

For example, one might imagine a module that serves the purpose of adding
some HTTP header to a file with a given extension. The patch given would
whine, when the behavior is intended.

On the other hand, using a handler that way is IMHO wrong, and I can't
think of any modules offhand that do it, so +1 on the patch.

> Index: http_core.c
> ===================================================================
> RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
> retrieving revision 1.171
> diff -u -r1.171 http_core.c
> --- http_core.c	1998/03/15 04:39:12	1.171
> +++ http_core.c	1998/03/16 05:12:32
> @@ -2046,6 +2046,12 @@
>      caddr_t mm;
>  #endif
>  
> +    if (r->handler) {
> +	aplog_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
> +	    r->server, "handler \"%s\" not found, using default "
> +	    "handler for: %s", r->handler, r->filename);
> +    }
> +
>      /* This handler has no use for a request body (yet), but we still
>       * need to read and discard it if the client sent one.
>       */
> 
> 

-- Alexei Kosut <akosut@stanford.edu> <http://www.stanford.edu/~akosut/>
   Stanford University, Class of 2001 * Apache <http://www.apache.org> *



Mime
View raw message