httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Koen Holtman <Koen.Holt...@cern.ch>
Subject Re: [PATCH] PR#4524 and bare content-types
Date Fri, 04 Jun 1999 07:27:54 GMT


On Thu, 3 Jun 1999, Rodent of Unusual Size wrote:

> PR#4524 points out an interesting fact: mod_autoindex looks for an
> *exact* match on the content-type against "text/html".  This
> doesn't work well when someone has labelled all HTML documents
> with something like
> 
> AddType "text/html;charset=foo" .html
> 
> mod_autoindex is almost certainly not the only offender, either.
> But I'm not going to look for the others right now.
> 
> This patch is a 1.3 workaround; it adds a routine that returns
> the base content-type minus any trailing parameters or whitespace.
> Actually, it works with any HTTP field value that uses a
> production like '*( ";" param)'.
> 
> For 2.0 we might want to consider breaking r->content_type into
> r->content_type and (table *)r->content_params.

I just recalled that, in an number of places, mod_negotiation.c has code
to make some 'magic' content types compare equal to text/html.  For
example:

    var->is_pseudo_html = (!strcmp(var->mime_type, "text/html")
                           || !strcmp(var->mime_type, INCLUDES_MAGIC_TYPE)
                           || !strcmp(var->mime_type, INCLUDES_MAGIC_TYPE3));

from include/httpd.h:
#define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"

Looking at mod_autoindex, it has similar code to compare against
INCLUDES_MAGIC_TYPE, but not INCLUDES_MAGIC_TYPE3.  Probably something is
out of sync.  An API extension to do all magic type comparison in a single
central place for 2.0 seems like a good idea. 

> -- 
> #ken    P-)}

Koen.



Mime
View raw message