httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Sutton <p...@ukweb.com>
Subject Re: Order of negotiation (was: Re: Docs problems?)
Date Fri, 08 Aug 1997 19:49:50 GMT
On Thu, 7 Aug 1997, Dean Gaudet wrote:
> It's not a handwave, go look at mod_negotiation ... there isn't a simple
> summarization of what it does :)
>
> > >On Thu, 7 Aug 1997, Rodent of Unusual Size wrote:
> > >>     I've idly wondered for a long time how to specify a preference order
> > >>     for multiviews, but never looked into it.  For instance, just what
> > >>     *does* it look for if enabled and you have a "DirectoryIndex foo"?

Read the most excellent mod_negotiation explaination doc...

   http://www.apache.org/docs/content-negotiation.html

Its got the complete algorythm exposed for your gratification. It
basically goes

 media type
 language
 text/html level (old)
 encoding
 charset
 size (prefer smallest)

First all unacceptable variants are eliminated (e.g. if your
Accept-Language says you don't accept French, you'll never get a French
language resource). Then it goes down the list above, and if there is a
winner at any stage uses it.

Other algorythms are possible, and it would be nice to make it
configurable. When I added HTTP/1.1 to it I restructured some of the
functions to make this easier in the future - see for example a basic
implementation of the remote variant selection algorythm. This algorythm
multiplies all the resultant quality values together, effectively giving
all the dimensions (media type, charset, etc) equal weighting - unlike the
current Apache algorythm. I am not sure which is best.

What really is missing from mod_negotiation, in my opinion, is a way to
set quality values on a directory or server-wide way. For example:

  SetQuality text/plain 0.9

to make negotiation prefer text/html types first. But this was veteod by
the group a long time ago in preference to building .var files containing
all the variants.

Oh back to the subject. You asked about .cgi. That is the dirty secret of
mod_negotiation - it doesn't know what the output of the cgi is going to
be, and certainly can't run every cgi to pick up its mime type and other
headers, so it has to guess (unless a .var is present of course). It
guesses by much prefering CGIs iff the request is a POST or looks like a
CGI request (e.g. GET with a query string). Otherwise it much dis-prefers
the CGI. So for example

  DirectoryIndex index

should pick the index.html (or other static type) on the initial GET, but
if that document contains a relative link to itself with QS arguments, the
CGI would be prefered. Useful in some cases. 

//pcs



Mime
View raw message