You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@kiwi.ICS.UCI.EDU> on 1997/05/05 22:33:21 UTC

Re: [PATCH] PR#506: no DefaultType means no Content-Type

>The best place might be in http_core, add a type_checker function like
>this:
>
>static int core_type_checker (request_rec *r)
>{
>    if (!r->content_type) {
>	r->content_type = default_type (r);
>    }
>    return OK;
>}

For normal files, I think that is the best way to do it.  However, we
need to be careful not to add a default type to proxy responses.
Likewise, CGI output without a content-type should not be given the
default.  I'm not sure what the above would do for those cases.

The basic rule of thumb is that content-type should only be given if
it is known (by configuration, name, magic typing, etc.).  If it is not
given, a browser will use its own heuristics for determining the type.

....Roy

Re: [PATCH] PR#506: no DefaultType means no Content-Type

Posted by Dean Gaudet <dg...@arctic.org>.
Hmm the code as it stands will DefaultType a CGI's output, but won't
DEFAULT_TYPE (i.e. no DefaultType directive) a CGI's output.  For some
reason I was thinking content-type was a required header, but upon
checking I discover it isn't required.

The current behaviour could be considered inconsistent (it is, the code
uses default_type(r) here and there but not in the final header
generation).  My patch makes it consistent, but doesn't match up with what
you're saying below.

What you say makes sense.  So I'm not sure what to do.

Dean

On Mon, 5 May 1997, Roy T. Fielding wrote:

> >The best place might be in http_core, add a type_checker function like
> >this:
> >
> >static int core_type_checker (request_rec *r)
> >{
> >    if (!r->content_type) {
> >	r->content_type = default_type (r);
> >    }
> >    return OK;
> >}
> 
> For normal files, I think that is the best way to do it.  However, we
> need to be careful not to add a default type to proxy responses.
> Likewise, CGI output without a content-type should not be given the
> default.  I'm not sure what the above would do for those cases.
> 
> The basic rule of thumb is that content-type should only be given if
> it is known (by configuration, name, magic typing, etc.).  If it is not
> given, a browser will use its own heuristics for determining the type.
> 
> ....Roy
>