Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 21963 invoked by uid 6000); 19 Mar 1999 09:02:50 -0000 Received: (qmail 21949 invoked from network); 19 Mar 1999 09:02:45 -0000 Received: from dxmint.cern.ch (137.138.26.76) by taz.hyperreal.org with SMTP; 19 Mar 1999 09:02:45 -0000 Received: from cmsmail.cern.ch (cmsmail.cern.ch [137.138.81.187]) by dxmint.cern.ch (8.9.3/8.9.3) with ESMTP id KAA07883; Fri, 19 Mar 1999 10:02:12 +0100 (MET) Received: from suncms33.cern.ch by cmsmail.cern.ch (8.8.8+Sun/SMI-SVR4) id KAA23434; Fri, 19 Mar 1999 10:02:10 +0100 (MET) Received: from localhost (kholtman@localhost) by suncms33.cern.ch (8.9.1/8.9.1) with SMTP id KAA14567; Fri, 19 Mar 1999 10:02:10 +0100 (MET) X-Authentication-Warning: suncms33.cern.ch: kholtman owned process doing -bs Date: Fri, 19 Mar 1999 10:02:09 +0100 (MET) From: Koen Holtman X-Sender: kholtman@suncms33.cern.ch To: new-httpd@apache.org cc: Koen Holtman Subject: [PATCH] content negotiation docs update Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org This patch updates htdocs/manual/content-negotiation.html to document the transparent content negotiation features (including the RVSA/1.0) in mod_negotiation. Also, the discussion of the Apache negotiation algorithm has been updated to more accurately reflect the code. This patch also removes two comments about missing documentation from src/modules/standard/mod_negotiation.c . In case the patch file is broken I have also put my new content-negotiation.html at http://home.cern.ch/~kholtman/apache/content-negotiation.html . Koen. --- htdocs/manual.org/content-negotiation.html Thu Mar 18 20:31:25 1999 +++ htdocs/manual/content-negotiation.html Thu Mar 18 23:36:07 1999 @@ -68,6 +68,10 @@ Apache 1.2 supports 'server driven' content negotiation, as defined in the HTTP/1.1 specification. It fully supports the Accept, Accept-Language, Accept-Charset and Accept-Encoding request headers. +Apache 1.3.4 also supports 'transparent' content negotiation, which is +an experimental negotiation protocol defined in RFC 2295 and RFC 2296. +It does not offer support for 'feature negotiation' as defined in +these RFCs.

A resource is a conceptual entity identified by a URI @@ -196,6 +200,11 @@ type only if the variant isn't too big; specifying a content length in the map allows the server to compare against these thresholds without checking the actual file. +

Description: +
A human-readable textual description of the variant. If Apache cannot + find any appropriate variant to return, it will return an error + response which lists all available variants instead. Such a variant + list will include the human-readable variant descriptions.

Multiviews

@@ -242,20 +251,36 @@ quality rating, which generally causes one of the other views (if any) to be retrieved. -

The Negotiation Algorithm

+

The Negotiation Methods

After Apache has obtained a list of the variants for a given resource, either from a type-map file or from the filenames in the directory, it -applies an algorithm to decide on the 'best' variant to return, if -any. To do this it calculates a quality value for each variant in each -of the dimensions of variance. It is not necessary to know any of the -details of how negotiation actually takes place in order to use Apache's -content negotiation features. However the rest of this document -explains in detail the algorithm used for those interested.

- -In some circumstances, Apache can 'fiddle' the quality factor of a -particular dimension to achieve a better result. The ways Apache can -fiddle quality factors is explained in more detail below. +invokes one of two methods to decide on the 'best' variant to +return, if any. It is not necessary to know any of the details of how +negotiation actually takes place in order to use Apache's content +negotiation features. However the rest of this document explains the +methods used for those interested. +

+ +There are two negotiation methods: + +

    + +
  1. Server driven negotiation with the Apache +algorithm is used in the normal case. The Apache algorithm is +explained in more detail below. When this algorithm is used, Apache +can sometimes 'fiddle' the quality factor of a particular dimension to +achieve a better result. The ways Apache can fiddle quality factors is +explained in more detail below. + +
  2. Transparent content negotiation is used when the +browser specifically requests this through the mechanism defined in RFC +2295. This negotiation method gives the browser full control over +deciding on the 'best' variant, the result is therefore dependent on +the specific algorithms used by the browser. As part of the +transparent negotiation process, the browser can ask Apache to run the +'remote variant selection algorithm' defined in RFC 2296. +

    Dimensions of Negotiation

    @@ -287,44 +312,48 @@

    Apache Negotiation Algorithm

    -Apache uses an algorithm to select the 'best' variant (if any) to -return to the browser. This algorithm is not configurable. It operates -as follows: +Apache can use the following algorithm to select the 'best' variant +(if any) to return to the browser. This algorithm is not +further configurable. It operates as follows:

      -
    1. -First, for each dimension of the negotiation, the appropriate -Accept* header field is checked and a quality assigned to each -variant. If the Accept* header for any dimension means that this +
    2. First, for each dimension of the negotiation, check the appropriate +Accept* header field and assign a quality to each +variant. If the Accept* header for any dimension implies that this variant is not acceptable, eliminate it. If no variants remain, go to step 4. -
    3. Select the 'best' variant by a process of elimination. Each of -the following tests is applied in order. Any variants not selected at -each stage are eliminated. After each test, if only one variant -remains, it is selected as the best match. If more than one variant -remains, move on to the next test. +
    4. Select the 'best' variant by a process of elimination. Each of the +following tests is applied in order. Any variants not selected at each +test are eliminated. After each test, if only one variant remains, +select it as the best match and proceed to step 3. If more than one +variant remains, move on to the next test.
      1. Multiply the quality factor from the Accept header with the quality-of-source factor for this variant's media type, and select - the variants with the highest value + the variants with the highest value. -
      2. Select the variants with the highest language quality factor +
      3. Select the variants with the highest language quality factor.
      4. Select the variants with the best language match, using either the - order of languages on the LanguagePriority directive (if - present), - else the order of languages on the Accept-Language header. + order of languages in the Accept-Language header (if present), or else + else the order of languages in the LanguagePriority + directive (if present).
      5. Select the variants with the highest 'level' media parameter (used to give the version of text/html media types). -
      6. Select only variants with acceptable charset media parameters, +
      7. Select variants with the best charset media parameters, as given on the Accept-Charset header line. Charset ISO-8859-1 - is acceptable unless explicitly excluded. Variants not associated + is acceptable unless explicitly excluded. Variants with a + text/* media type but not explicitly associated with a particular charset are assumed to be in ISO-8859-1. +
      8. Select those variants which have associated + charset media parameters that are not ISO-8859-1. + If there are no such variants, select all variants instead. +
      9. Select the variants with the best encoding. If there are variants with an encoding that is acceptable to the user-agent, select only these variants. Otherwise if there is a mix of encoded @@ -332,11 +361,12 @@ If either all variants are encoded or all variants are not encoded, select all variants. -
      10. Select the variants with the smallest content length +
      11. Select the variants with the smallest content length. -
      12. Select the first variant of those remaining (this will be either the - first listed in the type-map file, or the first read from the directory) - and go to stage 3. +
      13. Select the first variant of those remaining. This will be either the + first listed in the type-map file, or when variants are read from + the directory, the one whose file name comes first when sorted using + ASCII code order.
      @@ -355,15 +385,15 @@

      Fiddling with Quality Values

      -

      +

      Apache sometimes changes the quality values from what would be -expected by a strict interpretation of the algorithm above. This is to -get a better result from the algorithm for browsers which do not send -full or accurate information. Some of the most popular browsers send -Accept header information which would otherwise result in the -selection of the wrong variant in many cases. If a browser -sends full and correct information these fiddles will not -be applied. +expected by a strict interpretation of the Apache negotiation +algorithm above. This is to get a better result from the algorithm for +browsers which do not send full or accurate information. Some of the +most popular browsers send Accept header information which would +otherwise result in the selection of the wrong variant in many +cases. If a browser sends full and correct information these fiddles +will not be applied.

      Media Types and Wildcards

      @@ -435,6 +465,18 @@ 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. + +

      Extensions to Transparent Content Negotiation

      + +Apache extends the transparent content negotiation protocol (RFC 2295) +as follows. A new {encoding ..} element is used in +variant lists to label variants which are available with a specific +content-encoding only. The implementation of the +RVSA/1.0 algorithm (RFC 2296) is extended to recognize encoded +variants in the list, and to use them as candidate variants whenever +their encodings are acceptable according to the Accept-Encoding +request header. The RVSA/1.0 implementation does not round computed +quality factors to 5 decimal places before choosing the best variant.

      Note on hyperlinks and naming conventions

      --- neg.c.orig Fri Mar 19 09:51:56 1999 +++ src/modules/standard/mod_negotiation.c Thu Mar 18 23:37:03 1999 @@ -837,9 +837,6 @@ has_content = 1; } else if (!strncmp(buffer, "description:", 12)) { - /* XXX: The possibility to set a description is - * currently not documented. - */ char *desc = ap_pstrdup(neg->pool, body); char *cp; @@ -1913,9 +1910,6 @@ } /* If the best variant's charset is ISO-8859-1 and this variant has * the same charset quality, then we prefer this variant - */ - /* XXX: TODO: this specific tie-breaker is not described in the - * documentation */ if (variant->charset_quality > best->charset_quality ||