mod_negotiation.html revision 3d76f0e292da6a107829fbe83f98b8c0985c6ddb
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<!--%hypertext -->
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<HTML>
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<HEAD>
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<TITLE>Apache module mod_negotiation</TITLE>
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync</HEAD>
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<BODY>
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<IMG SRC="/images/apache_sub.gif" ALT="">
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<!--/%hypertext -->
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<H1>Module mod_negotiation</h1>
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsyncThis module is contained in the <code>mod_negotiation.c</code> file, and
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsyncis compiled in by default. It provides for
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync<A HREF="content-negotiation.html">content negotiation</A>. Any document with
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncmime type <code>application/x-type-map</code> will be processed by this module.
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<!--%plaintext &lt;?INDEX {\tt application/x-type-map} mime type&gt; -->
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<h2>Summary</h2>
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncContent negotiation, or more accurately content selection, is the
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncselection of the document that best matches the clients
d14b45df33b70c47b6eab2507de958c04711f38cvboxsynccapabilities, from one of several available documents.
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsyncThere are two implementations of this.
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsync<ul>
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsync<li> A type map (a file with the mime type <code>application/x-type-map</code>)
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsyncwhich explicitly lists the files containing the variants.
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsync<li> A MultiViews search (enabled by the MultiViews
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsync<A HREF="core.html#options">Option</A>, where the server does an implicit
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsyncfilename pattern match, and choose from amongst the results.
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsync</ul>
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsync
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsync<h3>Type maps</h3>
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsyncA type map has the same format as RFC822 mail headers. It contains document
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsyncdescriptions separated by blank lines, with lines beginning with a hash
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsynccharacter ('#') treated as comments. A document description consists of
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsyncseveral header records; records may be continued on multiple lines if the
38008ff8bc90d3bb27eb0ad412de498be8563439vboxsynccontinuation lines start with spaces. The leading space will be deleted
058111e7e5eb77a9cfa404836d685f4eec4eeef3vboxsyncand the lines concatenated. A header record consists of a keyword
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncname, which always ends in a colon, followed by a value. Whitespace is allowed
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncbetween the header name and value, and between the tokens of value.
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncThe headers
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncallowed are:
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<dl>
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<dt>Content-Encoding:
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<dd>The encoding of the file. Currently only two encodings are recognised
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncby http; <code>x-compress</code> for compressed files, and <code>x-gzip</code>
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncfor gzipped files.
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<dt>Content-Language:
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<dd>The language of the variant, as an Internet standard language code, such
3ee05df7c67eccd6d1ecff48edb69e0afd75bb25vboxsyncas <code>en</code>.
d292438512fae43184049e5354a9d74788a135edvboxsync<dt>Content-Length:
d292438512fae43184049e5354a9d74788a135edvboxsync<dd>The length of the file, in bytes. If this header is not present, then
058111e7e5eb77a9cfa404836d685f4eec4eeef3vboxsyncthe actual length of the file is used.
058111e7e5eb77a9cfa404836d685f4eec4eeef3vboxsync<dt>Content-Type:
058111e7e5eb77a9cfa404836d685f4eec4eeef3vboxsync<dd>The MIME media type of the document, with optional parameters.
058111e7e5eb77a9cfa404836d685f4eec4eeef3vboxsyncparameters are separated from the media type and from one another by
058111e7e5eb77a9cfa404836d685f4eec4eeef3vboxsyncsemi-colons. Parameter syntax is name=value; allowed parameters are:
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<dl>
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<dt>level
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<dd>the value is an integer, which specifies the version of the media type.
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncFor <code>text/html</code> this defaults to 2, otherwise 0.
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<dt>qs
d14b45df33b70c47b6eab2507de958c04711f38cvboxsync<dd>the value is a floating-point number with value between 0. and 1.
d14b45df33b70c47b6eab2507de958c04711f38cvboxsyncIt indications the 'quality' of this variant.
</dl>
Example:
<blockquote><code>Content-Type: image/jpeg; qs=0.8</code></blockquote>
<dt>URI:
<dd>The path to the file containing this variant, relative to the map file.
</dl>
<h3>MultiViews</h3>
A MultiViews search is enabled by the MultiViews
<A HREF="core.html#options">Option</A>.
If the server receives a request for <code>/some/dir/foo</code> and
<code>/some/dir/foo</code> does <em>not</em> exist, then the server reads the
directory looking for all files named <code>foo.*</code>, and effectively
fakes up a type map which names all those files, assigning them the same media
types and content-encodings it would have if the client had asked for
one of them by name. It then chooses the best match to the client's
requirements, and returns that document.<p>
<!--%hypertext -->
<h2>Directives</h2>
<ul>
<li><A href="#cachenegotiateddocs">CacheNegotiatedDocs</a>
<li><A HREF="#languagepriority">LanguagePriority</A>
</ul>
<hr>
<!--/%hypertext -->
<A name="cachenegotiateddocs"><h2>CacheNegotiatedDocs</h2></A>
<strong>Syntax:</strong> CacheNegotiatedDocs<br>
<Strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_negotiation<br>
<strong>Compatibility:</strong> CacheNegotiatedDocs is only available
in Apache 1.1 and later.<p>
<p>If set, this directive allows content-negotiated documents to be cached
by
proxy servers. This could mean that clients behind those proxys could
retrieve versions of the documents that are not the best match for
their abilities, but it will make caching more efficient.</p>
<!--%hypertext -->
<A name="languagepriority"><h2>LanguagePriority</h2></A>
<!--%plaintext &lt;?INDEX {\tt LanguagePriority} directive&gt; -->
<strong>Syntax:</strong> LanguagePriority <em>mime-lang mime-lang...</em><br>
<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
<Strong>Override:</strong> FileInfo<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_negotiation<p>
The LanguagePriority sets the precedence of language variants for the case
where the client does not express a preference, when handling a
MultiViews request. The list of <em>mime-lang</em> are in order of decreasing
preference. Example:
<blockquote><code>LanguagePriority en fr de</code></blockquote>
For a request for <code>foo.html</code>, where <code>foo.html.fr</code>
and <code>foo.html.de</code> both existed, but the browser did not express
a language preference, then <code>foo.html.fr</code> would be returned.<p>
<!--%hypertext -->
<hr>
<A HREF="../"><IMG SRC="/images/apache_home.gif" ALT="Home"></A>
<A HREF="./"><IMG SRC="/images/apache_index.gif" ALT="Index"></A>
</BODY>
</HTML>
<!--/%hypertext -->