content-negotiation.xml revision 7a98571671f92e53441bf24a0222768072172f90
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen<!DOCTYPE manualpage SYSTEM "/style/manualpage.dtd">
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen<!-- $LastChangedRevision$ -->
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen Licensed to the Apache Software Foundation (ASF) under one or more
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen contributor license agreements. See the NOTICE file distributed with
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen this work for additional information regarding copyright ownership.
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen The ASF licenses this file to You under the Apache License, Version 2.0
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen (the "License"); you may not use this file except in compliance with
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen the License. You may obtain a copy of the License at
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen Unless required by applicable law or agreed to in writing, software
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen distributed under the License is distributed on an "AS IS" BASIS,
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen See the License for the specific language governing permissions and
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen limitations under the License.
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen<manualpage metafile="content-negotiation.xml.meta">
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>Apache HTTPD supports content negotiation as described in
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen the HTTP/1.1 specification. It can choose the best
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen representation of a resource based on the browser-supplied
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen preferences for media type, languages, character set and
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen encoding. It also implements a couple of features to give
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen more intelligent handling of requests from browsers that send
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen incomplete negotiation information.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>Content negotiation is provided by the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <module>mod_negotiation</module> module, which is compiled in
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen by default.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen<section id="about"><title>About Content Negotiation</title>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>A resource may be available in several different
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen representations. For example, it might be available in
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen different languages or different media types, or a combination.
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen One way of selecting the most appropriate choice is to give the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen user an index page, and let them select. However it is often
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen possible for the server to choose automatically. This works
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen because browsers can send, as part of each request, information
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen about what representations they prefer. For example, a browser
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen could indicate that it would like to see information in French,
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen if possible, else English will do. Browsers indicate their
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen preferences by headers in the request. To request only French
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen representations, the browser would send</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>Note that this preference will only be applied when there is
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen a choice of representations and they vary by language.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>As an example of a more complex request, this browser has
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen been configured to accept French and English, but prefer
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen French, and to accept various media types, preferring HTML over
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen plain text or other text types, and preferring GIF or JPEG over
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen other media types, but also allowing any other media type as a
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen last resort:</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen Accept-Language: fr; q=1.0, en; q=0.5<br />
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen Accept: text/html; q=1.0, text/*; q=0.8, image/gif; q=0.6, image/jpeg; q=0.6, image/*; q=0.5, */*; q=0.1
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>httpd supports 'server driven' content negotiation, as
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen defined in the HTTP/1.1 specification. It fully supports the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <code>Accept</code>, <code>Accept-Language</code>,
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <code>Accept-Charset</code> and <code>Accept-Encoding</code>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen request headers. httpd also supports 'transparent'
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen content negotiation, which is an experimental negotiation
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen protocol defined in RFC 2295 and RFC 2296. It does not offer
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen support for 'feature negotiation' as defined in these RFCs.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>A <strong>resource</strong> is a conceptual entity
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen identified by a URI (RFC 2396). An HTTP server like Apache HTTP Server
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen provides access to <strong>representations</strong> of the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen resource(s) within its namespace, with each representation in
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen the form of a sequence of bytes with a defined media type,
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen character set, encoding, etc. Each resource may be associated
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen with zero, one, or more than one representation at any given
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen time. If multiple representations are available, the resource
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen is referred to as <strong>negotiable</strong> and each of its
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen representations is termed a <strong>variant</strong>. The ways
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen in which the variants for a negotiable resource vary are called
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen the <strong>dimensions</strong> of negotiation.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen<section id="negotiation"><title>Negotiation in httpd</title>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>In order to negotiate a resource, the server needs to be
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen given information about each of the variants. This is done in
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen one of two ways:</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <li>Using a type map (<em>i.e.</em>, a <code>*.var</code>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen file) which names the files containing the variants
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen explicitly, or</li>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <li>Using a 'MultiViews' search, where the server does an
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen implicit filename pattern match and chooses from among the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen results.</li>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <section id="type-map"><title>Using a type-map file</title>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>A type map is a document which is associated with the handler
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen named <code>type-map</code> (or, for backwards-compatibility with
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen older httpd configurations, the <glossary>MIME-type</glossary>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <code>application/x-type-map</code>). Note that to use this
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen feature, you must have a handler set in the configuration that
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen defines a file suffix as <code>type-map</code>; this is best done
eac684ef1c29684b1bcd27a89c38c202e568e469Tom GundersenAddHandler type-map .var
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>Type map files should have the same name as the resource
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen which they are describing, followed by the extension
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <code>.var</code>. In the examples shown below, the resource is
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen named <code>foo</code>, so the type map file is named
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>This file should have an entry for each available
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen variant; these entries consist of contiguous HTTP-format header
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen lines. Entries for different variants are separated by blank
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen lines. Blank lines are illegal within an entry. It is
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen conventional to begin a map file with an entry for the combined
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen entity as a whole (although this is not required, and if
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen present will be ignored). An example map file is shown below.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>URIs in this file are relative to the location of the type map
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen file. Usually, these files will be located in the same directory as
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen the type map file, but this is not required. You may provide
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen absolute or relative URIs for any file located on the same server as
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen the map file.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen URI: foo<br />
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen Content-language: en<br />
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen Content-type: text/html;charset=iso-8859-2<br />
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen Content-language: fr, de<br />
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>Note also that a typemap file will take precedence over the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen filename's extension, even when Multiviews is on. If the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen variants have different source qualities, that may be indicated
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen by the "qs" parameter to the media type, as in this picture
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen (available as JPEG, GIF, or ASCII-art): </p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen URI: foo<br />
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>qs values can vary in the range 0.000 to 1.000. Note that
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen any variant with a qs value of 0.000 will never be chosen.
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen Variants with no 'qs' parameter value are given a qs factor of
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen 1.0. The qs parameter indicates the relative 'quality' of this
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen variant compared to the other available variants, independent
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen of the client's capabilities. For example, a JPEG file is
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen usually of higher source quality than an ASCII file if it is
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen attempting to represent a photograph. However, if the resource
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen being represented is an original ASCII art, then an ASCII
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen representation would have a higher source quality than a JPEG
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen representation. A qs value is therefore specific to a given
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen variant depending on the nature of the resource it
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen represents.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>The full list of headers recognized is available in the <a
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen href="mod/mod_negotiation.html#typemaps">mod_negotiation
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen<section id="multiviews"><title>Multiviews</title>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p><code>MultiViews</code> is a per-directory option, meaning it
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen can be set with an <directive module="core">Options</directive>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen type="section">Directory</directive>, <directive module="core"
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen type="section">Location</directive> or <directive module="core"
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen module="core">AllowOverride</directive> is properly set) in
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <code>.htaccess</code> files. Note that <code>Options All</code>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen does not set <code>MultiViews</code>; you have to ask for it by
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>The effect of <code>MultiViews</code> is as follows: if the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen server receives a request for <code>/some/dir/foo</code>, if
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <code>/some/dir</code> has <code>MultiViews</code> enabled, and
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <code>/some/dir/foo</code> does <em>not</em> exist, then the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen server reads the directory looking for files named foo.*, and
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen effectively fakes up a type map which names all those files,
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen assigning them the same media types and content-encodings it
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen would have if the client had asked for one of them by name. It
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen then chooses the best match to the client's requirements.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p><code>MultiViews</code> may also apply to searches for the file
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen named by the <directive
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen module="mod_dir">DirectoryIndex</directive> directive, if the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen server is trying to index a directory. If the configuration files
eac684ef1c29684b1bcd27a89c38c202e568e469Tom GundersenDirectoryIndex index
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>then the server will arbitrate between <code>index.html</code>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen and <code>index.html3</code> if both are present. If neither
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen are present, and <code>index.cgi</code> is there, the server
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen will run it.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>If one of the files found when reading the directory does not
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen have an extension recognized by <code>mod_mime</code> to designate
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen its Charset, Content-Type, Language, or Encoding, then the result
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen depends on the setting of the <directive
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen module="mod_mime">MultiViewsMatch</directive> directive. This
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen directive determines whether handlers, filters, and other
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen extension types can participate in MultiViews negotiation.</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen<section id="methods"><title>The Negotiation Methods</title>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>After httpd has obtained a list of the variants for a given
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen resource, either from a type-map file or from the filenames in
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen the directory, it invokes one of two methods to decide on the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen 'best' variant to return, if any. It is not necessary to know
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen any of the details of how negotiation actually takes place in
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen order to use httpd's content negotiation features. However the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen rest of this document explains the methods used for those
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen interested. </p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <li><strong>Server driven negotiation with the httpd
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen algorithm</strong> is used in the normal case. The httpd
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen algorithm is explained in more detail below. When this
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen algorithm is used, httpd can sometimes 'fiddle' the quality
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen factor of a particular dimension to achieve a better result.
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen The ways httpd can fiddle quality factors is explained in
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen more detail below.</li>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <li><strong>Transparent content negotiation</strong> is used
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen when the browser specifically requests this through the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen mechanism defined in RFC 2295. This negotiation method gives
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen the browser full control over deciding on the 'best' variant,
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen the result is therefore dependent on the specific algorithms
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen used by the browser. As part of the transparent negotiation
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen process, the browser can ask httpd to run the 'remote
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen variant selection algorithm' defined in RFC 2296.</li>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen<section id="dimensions"><title>Dimensions of Negotiation</title>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <columnspec><column width=".15"/><column width=".85"/></columnspec>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <td>Browser indicates preferences with the <code>Accept</code>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen header field. Each item can have an associated quality factor.
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen Variant description can also have a quality factor (the "qs"
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen parameter).</td>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <td>Browser indicates preferences with the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <code>Accept-Language</code> header field. Each item can have
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen a quality factor. Variants can be associated with none, one or
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen more than one language.</td>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <td>Browser indicates preference with the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <code>Accept-Encoding</code> header field. Each item can have
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen a quality factor.</td>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <td>Browser indicates preference with the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <code>Accept-Charset</code> header field. Each item can have a
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen quality factor. Variants can indicate a charset as a parameter
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen of the media type.</td>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen<section id="algorithm"><title>httpd Negotiation Algorithm</title>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <p>httpd can use the following algorithm to select the 'best'
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen variant (if any) to return to the browser. This algorithm is
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen not further configurable. It operates as follows:</p>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <li>First, for each dimension of the negotiation, check the
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen appropriate <em>Accept*</em> header field and assign a
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen quality to each variant. If the <em>Accept*</em> header for
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen any dimension implies that this variant is not acceptable,
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen eliminate it. If no variants remain, go to step 4.</li>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen Select the 'best' variant by a process of elimination. Each
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen of the following tests is applied in order. Any variants
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen not selected at each test are eliminated. After each test,
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen if only one variant remains, select it as the best match
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen and proceed to step 3. If more than one variant remains,
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen move on to the next test.
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <li>Multiply the quality factor from the <code>Accept</code>
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen header with the quality-of-source factor for this variants
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen media type, and select the variants with the highest
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <li>Select the variants with the highest language quality
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen <li>Select the variants with the best language match,
eac684ef1c29684b1bcd27a89c38c202e568e469Tom Gundersen using either the order of languages in the