You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Sebastian Leske <Se...@bigfoot.de> on 2002/03/08 20:43:30 UTC
mod_negotiation/10092: Proposed improvements for documentation on Content Negotiation
>Number: 10092
>Category: mod_negotiation
>Synopsis: Proposed improvements for documentation on Content Negotiation
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: apache
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: doc-bug
>Submitter-Id: apache
>Arrival-Date: Fri Mar 08 11:50:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Sebastian.Leske@bigfoot.de
>Release: 1.3
>Organization:
apache
>Environment:
n/a (documentation improvement)
>Description:
In the page/chapter on "Content Negotiation" in the official Apache
documentation, there are some parts which I feel could be made somewhat
clearer, therefore I'm proposing a few small changes/additions.
******************************************************************
In the section "Apache Negotiation Algorithm", there is currently (last
point):
4. To get here means no variant was selected (because none are
acceptable to the browser). Return a 406 status (meaning "No acceptable
representation") with a response body consisting of an HTML document
listing the available variants. Also set the HTTP Vary header to indicate
the dimensions of variance.
I believe this should be extended a bit, so I propose the following:
4. To get here means no variant was selected (because none are
acceptable to the browser). Return a 406 status (meaning "No acceptable
representation") with a response body consisting of an HTML document
listing the available variants. Also set the HTTP Vary header to indicate
the dimensions of variance.
Remark: You should be aware that the error message returned by Apache is
neccessarily rather terse and might confuse some users (even though it
lists the available alternatives). If you want to avoid users seeing this
error page, you should organize your documents such that a document in a
default language (or with a default encoding etc.) is always returned if a
document is not available in any of the languages, encodings etc. the
browser asked for.
In particular, if you want a document in a default language to be returned
if a document is not available in any of the languages a browser asked
for, you should create a document with no language attribute set. See
"Variants with no Language" below for details.
*******************************************************************
In the section "Variants with no Language" it says:
If some of the variants for a particular resource have a language
attribute, and some do not, those variants with no language are given a
very low language quality factor of 0.001.
The reason for setting this language quality factor for variant with no
language to a very low value is to allow for a default variant which can
be supplied if none of the other variants match the browser's language
preferences. For example, consider the situation with three variants:
* foo.en.html, language en
* foo.fr.html, language en
* foo.html, no language
The meaning of a variant with no language is that it is always acceptable
to the browser. If the request Accept-Language header includes either en
or fr (or both) one of foo.en.html or foo.fr.html will be returned. If the
browser does not list either en or fr as acceptable, foo.html will be
returned instead.
The text does not mention how this scheme must be implemented
when using MultiViews or a type-map file, so it is a bit confusing
(particularly as using e.g. foo.html.en , foo.html.fr and foo.html
will not work when the page is accessed as foo.html).
Proposed new version for the text above:
If some of the variants for a particular resource have a language
attribute, and some do not, those variants with no language are given a
very low language quality factor of 0.001.
The reason for setting this language quality factor for variant with no
language to a very low value is to allow for a default variant which can
be supplied if none of the other variants match the browser's language
preferences. This allows you to avoid users seeing a "406" error page
if their browser is set to only accept languages which you do not offer
for the ressource that was requested.
For example, if you use MultiViews, you can create three files:
foo.en.html
foo.fr.html
foo.html
The meaning of a variant with no language is that it is always acceptable
to the browser. So if a browser requests foo , the following will
happen: If the request's Accept-Language header includes either en
or fr (or both) one of foo.en.html or foo.fr.html will be returned. If the
browser does not list either en or fr in the Accept-Language header
sent, foo.html will be returned instead. Warning: If foo.html is accessed
(and not foo), content negotiation will not take place (as an exact match
takes precedence), instead the contents of foo.html will always be
returned. Therefore, if you use names of the form foot.html.en ,
foo.html.fr etc. and link to those files as foo.html (as is customary on
many sites), then the default file needs to be named foo.html.html .
>How-To-Repeat:
The documentation in question is at
http://httpd.apache.org/docs/content-negotiation.html
>Fix:
See proposed changes in bug report.
>Release-Note:
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or ]
["Re: general/1098:"). If the subject doesn't match this ]
[pattern, your message will be misfiled and ignored. The ]
["apbugs" address is not added to the Cc line of messages from ]
[the database automatically because of the potential for mail ]
[loops. If you do not include this Cc, your reply may be ig- ]
[nored unless you are responding to an explicit request from a ]
[developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]