home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / rfc / 3 / rfc2295.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  122.2 KB  |  3,252 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                         K. Holtman
  8. Request for Comments: 2295                                           TUE
  9. Category: Experimental                                           A. Mutz
  10.                                                          Hewlett-Packard
  11.                                                               March 1998
  12.  
  13.  
  14.                 Transparent Content Negotiation in HTTP
  15.  
  16. Status of this Memo
  17.  
  18.    This memo defines an Experimental Protocol for the Internet
  19.    community.  It does not specify an Internet standard of any kind.
  20.    Discussion and suggestions for improvement are requested.
  21.    Distribution of this memo is unlimited.
  22.  
  23. Copyright Notice
  24.  
  25.    Copyright (C) The Internet Society (1998).  All Rights Reserved.
  26.  
  27. ABSTRACT
  28.  
  29.    HTTP allows web site authors to put multiple versions of the same
  30.    information under a single URL.  Transparent content negotiation is
  31.    an extensible negotiation mechanism, layered on top of HTTP, for
  32.    automatically selecting the best version when the URL is accessed.
  33.    This enables the smooth deployment of new web data formats and markup
  34.    tags.
  35.  
  36. TABLE OF CONTENTS
  37.  
  38.    1  Introduction................................................4
  39.     1.1 Background................................................4
  40.  
  41.    2  Terminology.................................................5
  42.     2.1 Terms from HTTP/1.1.......................................5
  43.     2.2 New terms.................................................6
  44.  
  45.    3  Notation....................................................8
  46.  
  47.    4  Overview....................................................9
  48.     4.1 Content negotiation.......................................9
  49.     4.2 HTTP/1.0 style negotiation scheme.........................9
  50.     4.3 Transparent content negotiation scheme...................10
  51.     4.4 Optimizing the negotiation process.......................12
  52.     4.5 Downwards compatibility with non-negotiating user agents.14
  53.     4.6 Retrieving a variant by hand.............................15
  54.     4.7 Dimensions of negotiation................................15
  55.  
  56.  
  57.  
  58. Holtman & Mutz                Experimental                      [Page 1]
  59.  
  60. RFC 2295            Transparent Content Negotiation           March 1998
  61.  
  62.  
  63.     4.8 Feature negotiation......................................15
  64.     4.9 Length of variant lists..................................16
  65.     4.10 Relation with other negotiation schemes.................16
  66.  
  67.    5  Variant descriptions.......................................17
  68.     5.1 Syntax...................................................17
  69.     5.2 URI......................................................17
  70.     5.3 Source-quality...........................................18
  71.     5.4 Type, charset, language, and length......................19
  72.     5.5 Features.................................................19
  73.     5.6 Description..............................................19
  74.     5.7 Extension-attribute......................................20
  75.  
  76.    6  Feature negotiation........................................20
  77.     6.1 Feature tags.............................................20
  78.     6.1.1 Feature tag values.....................................21
  79.     6.2 Feature sets.............................................21
  80.     6.3 Feature predicates.......................................22
  81.     6.4 Features attribute.......................................24
  82.  
  83.    7  Remote variant selection algorithms........................25
  84.     7.1 Version numbers..........................................25
  85.  
  86.    8  Content negotiation status codes and headers...............25
  87.     8.1 506 Variant Also Negotiates..............................25
  88.     8.2 Accept-Features..........................................26
  89.     8.3 Alternates...............................................27
  90.     8.4 Negotiate................................................28
  91.     8.5 TCN......................................................30
  92.     8.6 Variant-Vary.............................................30
  93.  
  94.    9  Cache validators...........................................31
  95.     9.1 Variant list validators..................................31
  96.     9.2 Structured entity tags...................................31
  97.     9.3 Assigning entity tags to variants........................32
  98.  
  99.    10 Content negotiation responses..............................32
  100.     10.1 List response...........................................33
  101.     10.2 Choice response.........................................34
  102.     10.3 Adhoc response..........................................37
  103.     10.4 Reusing the Alternates header...........................38
  104.     10.5 Extracting a normal response from a choice response.....39
  105.     10.6 Elaborate Vary headers..................................39
  106.     10.6.1 Construction of an elaborate Vary header..............40
  107.     10.6.2 Caching of an elaborate Vary header...................41
  108.     10.7 Adding an Expires header for HTTP/1.0 compatibility.....41
  109.     10.8 Negotiation on content encoding.........................41
  110.  
  111.  
  112.  
  113.  
  114. Holtman & Mutz                Experimental                      [Page 2]
  115.  
  116. RFC 2295            Transparent Content Negotiation           March 1998
  117.  
  118.  
  119.    11 User agent support for transparent negotiation.............42
  120.     11.1 Handling of responses...................................42
  121.     11.2 Presentation of a transparently negotiated resource.....42
  122.  
  123.    12 Origin server support for transparent negotiation..........43
  124.     12.1 Requirements............................................43
  125.     12.2 Negotiation on transactions other than GET and HEAD.....45
  126.  
  127.    13 Proxy support for transparent negotiation..................45
  128.  
  129.    14 Security and privacy considerations........................46
  130.     14.1 Accept- headers revealing personal information..........46
  131.     14.2 Spoofing of responses from variant resources............47
  132.     14.3 Security holes revealed by negotiation..................47
  133.  
  134.    15 Internationalization considerations........................47
  135.  
  136.    16 Acknowledgments............................................47
  137.  
  138.    17 References.................................................48
  139.  
  140.    18 Authors' Addresses.........................................48
  141.  
  142.    19 Appendix: Example of a local variant selection algorithm...49
  143.     19.1 Computing overall quality values........................49
  144.     19.2 Determining the result..................................51
  145.     19.3 Ranking dimensions......................................51
  146.  
  147.    20 Appendix: feature negotiation examples.....................52
  148.     20.1 Use of feature tags.....................................52
  149.     20.2 Use of numeric feature tags.............................53
  150.     20.3 Feature tag design......................................53
  151.  
  152.    21 Appendix: origin server implementation considerations......54
  153.     21.1 Implementation with a CGI script........................54
  154.     21.2 Direct support by HTTP servers..........................55
  155.     21.3 Web publishing tools....................................55
  156.  
  157.    22 Appendix: Example of choice response construction..........55
  158.  
  159.    23 Full Copyright Statement...................................58
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170. Holtman & Mutz                Experimental                      [Page 3]
  171.  
  172. RFC 2295            Transparent Content Negotiation           March 1998
  173.  
  174.  
  175. 1  Introduction
  176.  
  177.    HTTP allows web site authors to put multiple versions of the same
  178.    information under a single URI.  Each of these versions is called a
  179.    `variant'.  Transparent content negotiation is an extensible
  180.    negotiation mechanism for automatically and efficiently retrieving
  181.    the best variant when a GET or HEAD request is made.  This enables
  182.    the smooth deployment of new web data formats and markup tags.
  183.  
  184.    This specification defines transparent content negotiation as an
  185.    extension on top of the HTTP/1.1 protocol [1].  However, use of this
  186.    extension does not require use of HTTP/1.1: transparent content
  187.    negotiation can also be done if some or all of the parties are
  188.    HTTP/1.0 [2] systems.
  189.  
  190.    Transparent content negotiation is called `transparent' because it
  191.    makes all variants which exist inside the origin server visible to
  192.    outside parties.
  193.  
  194.      Note: Some members of the IETF are currently undertaking a number
  195.      of activities which are loosely related to this experimental
  196.      protocol.  First, there is an effort to define a protocol-
  197.      independent registry for feature tags.  The intention is that this
  198.      experimental protocol will be one of the clients of the registry.
  199.      Second, some research is being done on content negotiation systems
  200.      for other transport protocols (like internet mail and internet fax)
  201.      and on generalized negotiation systems for multiple transport
  202.      protocols.  At the time of writing, it is unclear if or when this
  203.      research will lead to results in the form of complete negotiation
  204.      system specifications.  It is also unclear to which extent possible
  205.      future specifications can or will re-use elements of this
  206.      experimental protocol.
  207.  
  208. 1.1 Background
  209.  
  210.    The addition of content negotiation to the web infrastructure has
  211.    been considered important since the early days of the web.  Among the
  212.    expected benefits of a sufficiently powerful system for content
  213.    negotiation are
  214.  
  215.      * smooth deployment of new data formats and markup tags will
  216.        allow graceful evolution of the web
  217.  
  218.      * eliminating the need to choose between a `state of the art
  219.        multimedia homepage' and one which can be viewed by all web users
  220.  
  221.      * enabling good service to a wider range of browsing
  222.        platforms (from low-end PDA's to high-end VR setups)
  223.  
  224.  
  225.  
  226. Holtman & Mutz                Experimental                      [Page 4]
  227.  
  228. RFC 2295            Transparent Content Negotiation           March 1998
  229.  
  230.  
  231.      * eliminating error-prone and cache-unfriendly
  232.        User-Agent based negotiation
  233.  
  234.      * enabling construction of sites without `click here for the X
  235.        version' links
  236.  
  237.      * internationalization, and the ability to offer multi-lingual
  238.        content without a bias towards one language.
  239.  
  240. 2  Terminology
  241.  
  242.    The words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY" in
  243.    this document are to be interpreted as described in RFC 2119 [4].
  244.  
  245.    This specification uses the term `header' as an abbreviation for for
  246.    `header field in a request or response message'.
  247.  
  248. 2.1 Terms from HTTP/1.1
  249.  
  250.    This specification mostly uses the terminology of the HTTP/1.1
  251.    specification [1].  For the convenience of the reader, this section
  252.    reproduces some key terminology definition from [1].
  253.  
  254.    request
  255.      An HTTP request message.
  256.  
  257.    response
  258.      An HTTP response message.
  259.  
  260.    resource
  261.      A network data object or service that can be identified by a URI.
  262.      Resources may be available in multiple representations (e.g.
  263.      multiple languages, data formats, size, resolutions) or vary in
  264.      other ways.
  265.  
  266.    content negotiation
  267.      The mechanism for selecting the appropriate representation when
  268.      servicing a request.
  269.  
  270.    client
  271.      A program that establishes connections for the purpose of sending
  272.      requests.
  273.  
  274.    user agent
  275.      The client which initiates a request.  These are often browsers,
  276.      editors, spiders (web-traversing robots), or other end user tools.
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Holtman & Mutz                Experimental                      [Page 5]
  283.  
  284. RFC 2295            Transparent Content Negotiation           March 1998
  285.  
  286.  
  287.    server
  288.      An application program that accepts connections in order to service
  289.      requests by sending back responses.  Any given program may be
  290.      capable of being both a client and a server; our use of these terms
  291.      refers only to the role being performed by the program for a
  292.      particular connection, rather than to the program's capabilities in
  293.      general.  Likewise, any server may act as an origin server, proxy,
  294.      gateway, or tunnel, switching behavior based on the nature of each
  295.      request.
  296.  
  297.    origin server
  298.      The server on which a given resource resides or is to be created.
  299.  
  300.    proxy
  301.      An intermediary program which acts as both a server and a client
  302.      for the purpose of making requests on behalf of other clients.
  303.      Requests are serviced internally or by passing them on, with
  304.      possible translation, to other servers.  A proxy must implement
  305.      both the client and server requirements of this specification.
  306.  
  307.    age
  308.      The age of a response is the time since it was sent by, or
  309.      successfully validated with, the origin server.
  310.  
  311.    fresh
  312.      A response is fresh if its age has not yet exceeded its freshness
  313.      lifetime.
  314.  
  315. 2.2 New terms
  316.  
  317.    transparently negotiable resource
  318.      A resource, identified by a single URI, which has multiple
  319.      representations (variants) associated with it.  When servicing a
  320.      request on its URI, it allows selection of the best representation
  321.      using the transparent content negotiation mechanism.  A
  322.      transparently negotiable resource always has a variant list bound
  323.      to it, which can be represented as an Alternates header (defined in
  324.      section 8.3).
  325.  
  326.    variant list
  327.      A list containing variant descriptions, which can be bound to a
  328.      transparently negotiable resource.
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Holtman & Mutz                Experimental                      [Page 6]
  339.  
  340. RFC 2295            Transparent Content Negotiation           March 1998
  341.  
  342.  
  343.    variant description
  344.      A machine-readable description of a variant resource, usually found
  345.      in a variant list.  A variant description contains the variant
  346.      resource URI and various attributes which describe properties of
  347.      the variant.  Variant descriptions are defined in section 5.
  348.  
  349.    variant resource
  350.      A resource from which a variant of a negotiable resource can be
  351.      retrieved with a normal HTTP/1.x GET request, i.e. a GET request
  352.      which does not use transparent content negotiation.
  353.  
  354.    neighboring variant
  355.      A variant resource is called a neighboring variant resource of some
  356.      transparently negotiable HTTP resource if the variant resource has
  357.      a HTTP URL, and if the absolute URL of the variant resource up to
  358.      its last slash equals the absolute URL of the negotiable resource
  359.      up to its last slash, where equality is determined with the URI
  360.      comparison rules in section 3.2.3 of [1].  The property of being a
  361.      neighboring variant is important because of security considerations
  362.      (section 14.2).  Not all variants of a negotiable resource need to
  363.      be neighboring variants.  However, access to neighboring variants
  364.      can be more highly optimized by the use of remote variant selection
  365.      algorithms (section 7) and choice responses (section 10.2).
  366.  
  367.    remote variant selection algorithm
  368.      A standardized algorithm by which a server can sometimes choose a
  369.      best variant on behalf of a negotiating user agent.  The algorithm
  370.      typically computes whether the Accept- headers in the request
  371.      contain sufficient information to allow a choice, and if so, which
  372.      variant is the best variant.  The use of a remote algorithm can
  373.      speed up the negotiation process.
  374.  
  375.    list response
  376.      A list response returns the variant list of the negotiable
  377.      resource, but no variant data.  It can be generated when the server
  378.      does not want to, or is not allowed to, return a particular best
  379.      variant for the request.  List responses are defined in section
  380.      10.1.
  381.  
  382.    choice response
  383.      A choice response returns a representation of the best variant for
  384.      the request, and may also return the variant list of the negotiable
  385.      resource.  It can be generated when the server has sufficient
  386.      information to be able to choose the best variant on behalf the
  387.      user agent, but may only be generated if this best variant is a
  388.      neighboring variant.  Choice responses are defined in section 10.2.
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Holtman & Mutz                Experimental                      [Page 7]
  395.  
  396. RFC 2295            Transparent Content Negotiation           March 1998
  397.  
  398.  
  399.    adhoc response
  400.      An adhoc response can be sent by an origin server as an extreme
  401.      measure, to achieve compatibility with a non-negotiating or buggy
  402.      client if this compatibility cannot be achieved by sending a list
  403.      or choice response.  There are very little requirements on the
  404.      contents of an adhoc response.  Adhoc responses are defined in
  405.      section 10.3.
  406.  
  407.    Accept- headers
  408.      The request headers: Accept, Accept-Charset, Accept-Language, and
  409.      Accept-Features.
  410.  
  411.    supports transparent content negotiation
  412.      From the viewpoint of an origin server or proxy, a user agent
  413.      supports transparent content negotiation if and only if it sends a
  414.      Negotiate header (section 8.4) which indicates such support.
  415.  
  416.    server-side override
  417.      If a request on a transparently negotiated resource is made by a
  418.      client which supports transparent content negotiation, an origin
  419.      server is said to perform a server-side override if the server
  420.      ignores the directives in the Negotiate request header, and instead
  421.      uses a custom algorithm to choose an appropriate response.  A
  422.      server-side override can sometimes be used to work around known
  423.      client bugs.  It could also be used by protocol extensions on top
  424.      of transparent content negotiation.
  425.  
  426. 3  Notation
  427.  
  428.    The version of BNF used in this document is taken from [1], and many
  429.    of the nonterminals used are defined in [1].  Note that the
  430.    underlying charset is US-ASCII.
  431.  
  432.    One new BNF construct is added:
  433.  
  434.       1%rule
  435.  
  436.    stands for one or more instances of "rule", separated by whitespace:
  437.  
  438.       1%rule =  rule *( 1*LWS rule )
  439.  
  440.    This specification also introduces
  441.  
  442.       number = 1*DIGIT
  443.  
  444.       short-float = 1*3DIGIT [ "." 0*3DIGIT ]
  445.  
  446.  
  447.  
  448.  
  449.  
  450. Holtman & Mutz                Experimental                      [Page 8]
  451.  
  452. RFC 2295            Transparent Content Negotiation           March 1998
  453.  
  454.  
  455.    This specification uses the same conventions as in [1] (see section
  456.    1.2 of [1]) for defining the significance of each particular
  457.    requirement.
  458.  
  459. 4  Overview
  460.  
  461.    This section gives an overview of transparent content negotiation.
  462.    It starts with a more general discussion of negotiation as provided
  463.    by HTTP.
  464.  
  465. 4.1 Content negotiation
  466.  
  467.    HTTP/1.1 allows web site authors to put multiple versions of the same
  468.    information under a single resource URI.  Each of these versions is
  469.    called a `variant'. For example, a resource http://x.org/paper could
  470.    bind to three different variants of a paper:
  471.  
  472.          1. HTML, English
  473.          2. HTML, French
  474.          3. Postscript, English
  475.  
  476.    Content negotiation is the process by which the best variant is
  477.    selected if the resource is accessed.  The selection is done by
  478.    matching the properties of the available variants to the capabilities
  479.    of the user agent and the preferences of the user.
  480.  
  481.    It has always been possible under HTTP to have multiple
  482.    representations available for one resource, and to return the most
  483.    appropriate representation for each subsequent request.  However,
  484.    HTTP/1.1 is the first version of HTTP which has provisions for doing
  485.    this in a cache-friendly way.  These provisions include the Vary
  486.    response header, entity tags, and the If-None-Match request header.
  487.  
  488. 4.2 HTTP/1.0 style negotiation scheme
  489.  
  490.    The HTTP/1.0 protocol elements allow for a negotiation scheme as
  491.    follows:
  492.  
  493.       Server _____ proxy _____ proxy _____ user
  494.       x.org        cache       cache       agent
  495.  
  496.         < ----------------------------------
  497.         |      GET http://x.org/paper
  498.         |          Accept- headers
  499.       choose
  500.         |
  501.          ---------------------------------- >
  502.                     Best variant
  503.  
  504.  
  505.  
  506. Holtman & Mutz                Experimental                      [Page 9]
  507.  
  508. RFC 2295            Transparent Content Negotiation           March 1998
  509.  
  510.  
  511.    When the resource is accessed, the user agent sends (along with its
  512.    request) various Accept- headers which express the user agent
  513.    capabilities and the user preferences.  Then the origin server uses
  514.    these Accept- headers to choose the best variant, which is returned
  515.    in the response.
  516.  
  517.    The biggest problem with this scheme is that it does not scale well.
  518.    For all but the most minimal user agents, Accept- headers expressing
  519.    all capabilities and preferences would be very large, and sending
  520.    them in every request would be hugely inefficient, in particular
  521.    because only a small fraction of the resources on the web have
  522.    multiple variants.
  523.  
  524. 4.3 Transparent content negotiation scheme
  525.  
  526.    The transparent content negotiation scheme eliminates the need to
  527.    send huge Accept- headers, and nevertheless allows for a selection
  528.    process that always yields either the best variant, or an error
  529.    message indicating that user agent is not capable of displaying any
  530.    of the available variants.
  531.  
  532.    Under the transparent content negotiation scheme, the server sends a
  533.    list with the available variants and their properties to the user
  534.    agent.  An example of a list with three variants is
  535.  
  536.       {"paper.1" 0.9 {type text/html} {language en}},
  537.       {"paper.2" 0.7 {type text/html} {language fr}},
  538.       {"paper.3" 1.0 {type application/postscript} {language en}}
  539.  
  540.    The syntax and semantics of the variant descriptions in this list are
  541.    covered in section 5.  When the list is received, the user agent can
  542.    choose the best variant and retrieve it.  Graphically, the
  543.    communication can be represented as follows:
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562. Holtman & Mutz                Experimental                     [Page 10]
  563.  
  564. RFC 2295            Transparent Content Negotiation           March 1998
  565.  
  566.  
  567.       Server _____ proxy _____ proxy _____ user
  568.       x.org        cache       cache       agent
  569.  
  570.         < ----------------------------------
  571.         |      GET http://x.org/paper
  572.         |
  573.         ----------------------------------- >         [list response]
  574.                   return of list            |
  575.                                          choose
  576.                                             |
  577.         < ----------------------------------
  578.         |  GET http://x.org/paper.1
  579.         |
  580.          ---------------------------------- >         [normal response]
  581.                 return of paper.1
  582.  
  583.    The first response returning the list of variants is called a `list
  584.    response'.  The second response is a normal HTTP response: it does
  585.    not contain special content negotiation related information.  Only
  586.    the user agent needs to know that the second request actually
  587.    retrieves a variant.  For the other parties in the communication, the
  588.    second transaction is indistinguishable from a normal HTTP
  589.    transaction.
  590.  
  591.    With this scheme, information about capabilities and preferences is
  592.    only used by the user agent itself.  Therefore, sending such
  593.    information in large Accept- headers is unnecessary.  Accept- headers
  594.    do have a limited use in transparent content negotiation however; the
  595.    sending of small Accept- headers can often speed up the negotiation
  596.    process. This is covered in section 4.4.
  597.  
  598.    List responses are covered in section 10.1.  As an example, the list
  599.    response in the above picture could be:
  600.  
  601.      HTTP/1.1 300 Multiple Choices
  602.      Date: Tue, 11 Jun 1996 20:02:21 GMT
  603.      TCN: list
  604.      Alternates: {"paper.1" 0.9 {type text/html} {language en}},
  605.                  {"paper.2" 0.7 {type text/html} {language fr}},
  606.                  {"paper.3" 1.0 {type application/postscript}
  607.                      {language en}}
  608.      Vary: negotiate, accept, accept-language
  609.      ETag: "blah;1234"
  610.      Cache-control: max-age=86400
  611.      Content-Type: text/html
  612.      Content-Length: 227
  613.      <h2>Multiple Choices:</h2>
  614.      <ul>
  615.  
  616.  
  617.  
  618. Holtman & Mutz                Experimental                     [Page 11]
  619.  
  620. RFC 2295            Transparent Content Negotiation           March 1998
  621.  
  622.  
  623.      <li><a href=paper.1>HTML, English version</a>
  624.      <li><a href=paper.2>HTML, French version</a>
  625.      <li><a href=paper.3>Postscript, English version</a>
  626.      </ul>
  627.  
  628.    The Alternates header in the response contains the variant list.  The
  629.    Vary header is included to ensure correct caching by plain HTTP/1.1
  630.    caches (see section 10.6).  The ETag header allows the response to be
  631.    revalidated by caches, the Cache-Control header controls this
  632.    revalidation.  The HTML entity included in the response allows the
  633.    user to select the best variant by hand if desired.
  634.  
  635. 4.4 Optimizing the negotiation process
  636.  
  637.    The basic transparent negotiation scheme involves two HTTP
  638.    transactions: one to retrieve the list, and a second one to retrieve
  639.    the chosen variant.  There are however several ways to `cut corners'
  640.    in the data flow path of the basic scheme.
  641.  
  642.    First, caching proxies can cache both variant lists and variants.
  643.    Such caching can reduce the communication overhead, as shown in the
  644.    following example:
  645.  
  646.       Server _____ proxy _____ proxy __________ user
  647.       x.org        cache       cache            agent
  648.  
  649.                                  < --------------
  650.                                  |  GET ../paper
  651.                                  |
  652.                                has the list
  653.                                in cache
  654.                                  |
  655.                                   -------------  >  [list response]
  656.                                            list  |
  657.                                                  |
  658.                                               choose
  659.                                                  |
  660.                      < --------------------------
  661.                      |   GET ../paper.1
  662.                      |
  663.                   has the variant
  664.                   in cache
  665.                      |
  666.                       -------------------------- >  [normal response]
  667.                          return of paper.1
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674. Holtman & Mutz                Experimental                     [Page 12]
  675.  
  676. RFC 2295            Transparent Content Negotiation           March 1998
  677.  
  678.  
  679.    Second, the user agent can send small Accept- headers, which may
  680.    contain enough information to allow the server to choose the best
  681.    variant and return it directly.
  682.  
  683.       Server _____ proxy _____ proxy _____ user
  684.       x.org        cache       cache       agent
  685.  
  686.         < ----------------------------------
  687.         |      GET http://x.org/paper
  688.         |       small Accept- headers
  689.         |
  690.       able to choose on
  691.       behalf of user agent
  692.         |
  693.          ---------------------------------- >    [choice response]
  694.               return of paper.1 and list
  695.  
  696.    This choosing based on small Accept- headers is done with a `remote
  697.    variant selection algorithm'.  Such an algorithm takes the variant
  698.    list and the Accept- headers as input.  It then computes whether the
  699.    Accept- headers contain sufficient information to choose on behalf of
  700.    the user agent, and if so, which variant is the best variant.  If the
  701.    best variant is a neighboring variant, it may be returned, together
  702.    with the variant list, in a choice response.
  703.  
  704.    A server may only choose on behalf of a user agent supporting
  705.    transparent content negotiation if the user agent explicitly allows
  706.    the use of a particular remote variant selection algorithm in the
  707.    Negotiate request header.  User agents with sophisticated internal
  708.    variant selection algorithms may want to disallow a remote choice, or
  709.    may want to allow it only when retrieving inline images.  If the
  710.    local algorithm of the user agent is superior in only some difficult
  711.    areas of negotiation, it is possible to enable the remote algorithm
  712.    for the easy areas only.  More information about the use of a remote
  713.    variant selection algorithm can be found in [3].
  714.  
  715.    Choice responses are covered in section 10.2.  For example, the
  716.    choice response in the above picture could be:
  717.  
  718.      HTTP/1.1 200 OK
  719.      Date: Tue, 11 Jun 1996 20:05:31 GMT
  720.      TCN: choice
  721.      Content-Type: text/html
  722.      Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT
  723.      Content-Length: 5327
  724.      Cache-control: max-age=604800
  725.      Content-Location: paper.1
  726.      Alternates: {"paper.1" 0.9 {type text/html} {language en}},
  727.  
  728.  
  729.  
  730. Holtman & Mutz                Experimental                     [Page 13]
  731.  
  732. RFC 2295            Transparent Content Negotiation           March 1998
  733.  
  734.  
  735.                  {"paper.2" 0.7 {type text/html} {language fr}},
  736.                  {"paper.3" 1.0 {type application/postscript}
  737.                      {language en}}
  738.      Etag: "gonkyyyy;1234"
  739.      Vary: negotiate, accept, accept-language
  740.      Expires: Thu, 01 Jan 1980 00:00:00 GMT
  741.  
  742.      <title>A paper about ....
  743.  
  744.    Finally, the above two kinds of optimization can be combined; a
  745.    caching proxy which has the list will sometimes be able to choose on
  746.    behalf of the user agent.  This could lead to the following
  747.    communication pattern:
  748.  
  749.       Server _____ proxy _____ proxy __________ user
  750.       x.org        cache       cache            agent
  751.  
  752.                                  < ---------------
  753.                                  |  GET ../paper
  754.                                  |  small Accept
  755.                                  |
  756.                               able to choose
  757.                                 on behalf
  758.                                  |
  759.                      < ----------
  760.                      |  GET ../paper.1
  761.                      |
  762.                       ---------- >   [normal response]
  763.                         paper.1  |
  764.                                   ---------------- >  [choice response]
  765.                                    paper.1 and list
  766.  
  767.    Note that this cutting of corners not only saves bandwidth, it also
  768.    eliminates delays due to packet round trip times, and reduces the
  769.    load on the origin server.
  770.  
  771. 4.5 Downwards compatibility with non-negotiating user agents
  772.  
  773.    To handle requests from user agents which do not support transparent
  774.    content negotiation, this specification allows the origin server to
  775.    revert to a HTTP/1.0 style negotiation scheme.  The specification of
  776.    heuristics for such schemes is beyond the scope of this document.
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786. Holtman & Mutz                Experimental                     [Page 14]
  787.  
  788. RFC 2295            Transparent Content Negotiation           March 1998
  789.  
  790.  
  791. 4.6 Retrieving a variant by hand
  792.  
  793.    It is always possible for a user agent to retrieve the variant list
  794.    which is bound to a negotiable resource.  The user agent can use this
  795.    list to make available a menu of all variants and their
  796.    characteristics to the user.  Such a menu allows the user to randomly
  797.    browse other variants, and makes it possible to manually correct any
  798.    sub-optimal choice made by the automatic negotiation process.
  799.  
  800. 4.7 Dimensions of negotiation
  801.  
  802.    Transparent content negotiation defines four dimensions of
  803.    negotiation:
  804.  
  805.       1. Media type (MIME type)
  806.       2. Charset
  807.       3. Language
  808.       4. Features
  809.  
  810.    The first three dimensions have traditionally been present in HTTP.
  811.    The fourth dimension is added by this specification.  Additional
  812.    dimensions, beyond the four mentioned above, could be added by future
  813.    specifications.
  814.  
  815.    Negotiation on the content encoding of a response (gzipped,
  816.    compressed, etc.) is left outside of the realm of transparent
  817.    negotiation.   See section 10.8 for more information.
  818.  
  819. 4.8 Feature negotiation
  820.  
  821.    Feature negotiation intends to provide for all areas of negotiation
  822.    not covered by the type, charset, and language dimensions.  Examples
  823.    are negotiation on
  824.  
  825.       * HTML extensions
  826.       * Extensions of other media types
  827.       * Color capabilities of the user agent
  828.       * Screen size
  829.       * Output medium (screen, paper, ...)
  830.       * Preference for speed vs. preference for graphical detail
  831.  
  832.    The feature negotiation framework (section 6) is the principal means
  833.    by which transparent negotiation offers extensibility; a new
  834.    dimension of negotiation (really a sub-dimension of the feature
  835.    dimension) can be added without the need for a new standards effort
  836.    by the simple registration of a `feature tag'.
  837.  
  838.  
  839.  
  840.  
  841.  
  842. Holtman & Mutz                Experimental                     [Page 15]
  843.  
  844. RFC 2295            Transparent Content Negotiation           March 1998
  845.  
  846.  
  847. 4.9 Length of variant lists
  848.  
  849.    As a general rule, variant lists should be short: it is expected that
  850.    a typical transparently negotiable resource will have 2 to 10
  851.    variants, depending on its purpose.  Variant lists should be short
  852.    for a number of reasons:
  853.  
  854.      1. The user must be able to pick a variant by hand to correct a
  855.         bad automatic choice, and this is more difficult with a long
  856.         variant list.
  857.  
  858.      2. A large number of variants will decrease the efficiency of
  859.         internet proxy caches.
  860.  
  861.      3. Long variant lists will make some transparently negotiated
  862.         responses longer.
  863.  
  864.    In general, it is not desirable to create a transparently negotiable
  865.    resource with hundreds of variants in order to fine-tune the
  866.    graphical presentation of a resource.  Any graphical fine-tuning
  867.    should be done, as much as possible, by using constructs which act at
  868.    the user agent side, for example
  869.  
  870.       <center><img src=titlebanner.gif width=100%
  871.       alt="MegaBozo Corp"></center>
  872.  
  873.    In order to promote user agent side fine tuning, which is more
  874.    scalable than fine tuning over the network, user agents which
  875.    implement a scripting language for content rendering are encouraged
  876.    to make the availability of this language visible for transparent
  877.    content negotiation, and to allow rendering scripts to access the
  878.    capabilities and preferences data used for content negotiation, as
  879.    far as privacy considerations permit this.
  880.  
  881. 4.10 Relation with other negotiation schemes
  882.  
  883.    The HTTP/1.x protocol suite allows for many different negotiation
  884.    mechanisms.  Transparent content negotiation specializes in scalable,
  885.    interoperable negotiation of content representations at the HTTP
  886.    level.  It is intended that transparent negotiation can co-exist with
  887.    other negotiation schemes, both open and proprietary, which cover
  888.    different application domains or work at different points in the
  889.    author-to-user chain.  Ultimately, it will be up to the resource
  890.    author to decide which negotiation mechanism, or combination of
  891.    negotiation mechanisms, is most appropriate for the task at hand.
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898. Holtman & Mutz                Experimental                     [Page 16]
  899.  
  900. RFC 2295            Transparent Content Negotiation           March 1998
  901.  
  902.  
  903. 5  Variant descriptions
  904.  
  905. 5.1 Syntax
  906.  
  907.    A variant can be described in a machine-readable way with a variant
  908.    description.
  909.  
  910.        variant-description =
  911.                   "{" <"> URI <"> source-quality *variant-attribute"}"
  912.  
  913.        source-quality = qvalue
  914.  
  915.        variant-attribute = "{" "type" media-type "}"
  916.                          | "{" "charset" charset "}"
  917.                          | "{" "language"  1#language-tag "}"
  918.                          | "{" "length" 1*DIGIT "}"
  919.                          | "{" "features" feature-list "}"
  920.                          | "{" "description"
  921.                                      quoted-string [ language-tag ] "}"
  922.                          | extension-attribute
  923.  
  924.        extension-attribute = "{" extension-name extension-value "}"
  925.        extension-name      = token
  926.        extension-value     = *( token | quoted-string | LWS
  927.                               | extension-specials )
  928.  
  929.        extension-specials  =
  930.                           <any element of tspecials except <"> and "}">
  931.  
  932.    The feature-list syntax is defined in section 6.4.
  933.  
  934.    Examples are
  935.  
  936.       {"paper.2" 0.7 {type text/html} {language fr}}
  937.  
  938.       {"paper.5" 0.9 {type text/html} {features tables}}
  939.  
  940.       {"paper.1" 0.001}
  941.  
  942.    The various attributes which can be present in a variant description
  943.    are covered in the subsections below.  Each attribute may appear only
  944.    once in a variant description.
  945.  
  946. 5.2 URI
  947.  
  948.    The URI attribute gives the URI of the resource from which the
  949.    variant can be retrieved with a GET request.  It can be absolute or
  950.    relative to the Request-URI.  The variant resource may vary (on the
  951.  
  952.  
  953.  
  954. Holtman & Mutz                Experimental                     [Page 17]
  955.  
  956. RFC 2295            Transparent Content Negotiation           March 1998
  957.  
  958.  
  959.    Cookie request header, for example), but MUST NOT engage in
  960.    transparent content negotiation itself.
  961.  
  962. 5.3 Source-quality
  963.  
  964.    The source-quality attribute gives the quality of the variant, as a
  965.    representation of the negotiable resource, when this variant is
  966.    rendered with a perfect rendering engine on the best possible output
  967.    medium.
  968.  
  969.    If the source-quality is less than 1, it often expresses a quality
  970.    degradation caused by a lossy conversion to a particular data format.
  971.    For example, a picture originally in JPEG form would have a lower
  972.    source quality when translated to the XBM format, and a much lower
  973.    source quality when translated to an ASCII-art variant.  Note
  974.    however, that degradation is a function of the source; an original
  975.    piece of ASCII-art may degrade in quality if it is captured in JPEG
  976.    form.
  977.  
  978.    The source-quality could also represent a level of quality caused by
  979.    skill of language translation, or ability of the used media type to
  980.    capture the intended artistic expression.
  981.  
  982.    Servers should use the following table a guide when assigning source
  983.    quality values:
  984.  
  985.       1.000  perfect representation
  986.       0.900  threshold of noticeable loss of quality
  987.       0.800  noticeable, but acceptable quality reduction
  988.       0.500  barely acceptable quality
  989.       0.300  severely degraded quality
  990.       0.000  completely degraded quality
  991.  
  992.    The same table can be used by local variant selection algorithms (see
  993.    appendix 19) when assigning degradation factors for different content
  994.    rendering mechanisms.  Note that most meaningful values in this table
  995.    are close to 1.  This is due to the fact that quality factors are
  996.    generally combined by multiplying them, not by adding them.
  997.  
  998.    When assigning source-quality values, servers should not account for
  999.    the size of the variant and its impact on transmission and rendering
  1000.    delays; the size of the variant should be stated in the length
  1001.    attribute and any size-dependent calculations should be done by the
  1002.    variant selection algorithm.  Any constant rendering delay for a
  1003.    particular media type (for example due to the startup time of a
  1004.    helper application) should be accounted for by the user agent, when
  1005.    assigning a quality factor to that media type.
  1006.  
  1007.  
  1008.  
  1009.  
  1010. Holtman & Mutz                Experimental                     [Page 18]
  1011.  
  1012. RFC 2295            Transparent Content Negotiation           March 1998
  1013.  
  1014.  
  1015. 5.4 Type, charset, language, and length
  1016.  
  1017.    The type attribute of a variant description carries the same
  1018.    information as its Content-Type response header counterpart defined
  1019.    in [1], except for any charset information, which MUST be carried in
  1020.    the charset attribute.  For, example, the header
  1021.  
  1022.       Content-Type: text/html; charset=ISO-8859-4
  1023.  
  1024.    has the counterpart attributes
  1025.  
  1026.       {type text/html} {charset ISO-8859-4}
  1027.  
  1028.    The language and length attributes carry the same information as
  1029.    their Content-* response header counterparts in [1].  The length
  1030.    attribute, if present, MUST thus reflect the length of the variant
  1031.    alone, and not the total size of the variant and any objects inlined
  1032.    or embedded by the variant.
  1033.  
  1034.    Though all of these attributes are optional, it is often desirable to
  1035.    include as many attributes as possible, as this will increase the
  1036.    quality of the negotiation process.
  1037.  
  1038.       Note: A server is not required to maintain a one-to-one
  1039.       correspondence between the attributes in the variant description
  1040.       and the Content-* headers in the variant response.  For example,
  1041.       if the variant description contains a language attribute, the
  1042.       response does not necessarily have to contain a Content-Language
  1043.       header. If a Content-Language header is present, it does not have
  1044.       to contain an exact copy of the information in the language
  1045.       attribute.
  1046.  
  1047. 5.5 Features
  1048.  
  1049.    The features attribute specifies how the presence or absence of
  1050.    particular feature tags in the user agent affects the overall quality
  1051.    of the variant.  This attribute is covered in section 6.4.
  1052.  
  1053. 5.6 Description
  1054.  
  1055.    The description attribute gives a textual description of the variant.
  1056.    It can be included if the URI and normal attributes of a variant are
  1057.    considered too opaque to allow interpretation by the user.  If a user
  1058.    agent is showing a menu of available variants compiled from a variant
  1059.    list, and if a variant has a description attribute, the user agent
  1060.    SHOULD show the description attribute of the variant instead of
  1061.    showing the normal attributes of the variant.  The description field
  1062.    uses the UTF-8 character encoding scheme [5], which is a superset of
  1063.  
  1064.  
  1065.  
  1066. Holtman & Mutz                Experimental                     [Page 19]
  1067.  
  1068. RFC 2295            Transparent Content Negotiation           March 1998
  1069.  
  1070.  
  1071.    US-ASCII, with ""%" HEX HEX" encoding.  The optional language tag MAY
  1072.    be used to specify the language used in the description text.
  1073.  
  1074. 5.7 Extension-attribute
  1075.  
  1076.    The extension-attribute allows future specifications to incrementally
  1077.    define dimensions of negotiation which cannot be created by using the
  1078.    feature negotiation framework, and eases content negotiation
  1079.    experiments.  In experimental situations, servers MUST ONLY generate
  1080.    extension-attributes whose names start with "x-".  User agents SHOULD
  1081.    ignore all extension attributes they do not recognize.  Proxies MUST
  1082.    NOT run a remote variant selection algorithm if an unknown extension
  1083.    attribute is present in the variant list.
  1084.  
  1085. 6  Feature negotiation
  1086.  
  1087.    This section defines the feature negotiation mechanism.  Feature
  1088.    negotiation has been introduced in section 4.8.  Appendix 19 contains
  1089.    examples of feature negotiation.
  1090.  
  1091. 6.1 Feature tags
  1092.  
  1093.    A feature tag (ftag) identifies something which can be negotiated on,
  1094.    for example a property (feature) of a representation, a capability
  1095.    (feature) of a user agent, or the preference of a user for a
  1096.    particular type of representation.  The use of feature tags need not
  1097.    be limited to transparent content negotiation, and not every feature
  1098.    tag needs to be usable in the HTTP transparent content negotiation
  1099.    framework.
  1100.  
  1101.       ftag = token | quoted-string
  1102.  
  1103.       Note: A protocol-independent system for feature tag registration
  1104.       is currently being developed in the IETF.  This specification does
  1105.       not define any feature tags.  In experimental situations, the use
  1106.       of tags which start with "x." is encouraged.
  1107.  
  1108.    Feature tags are used in feature sets (section 6.2) and in feature
  1109.    predicates (section 6.3).  Feature predicates are in turn used in
  1110.    features attributes (section 6.4), which are used in variant
  1111.    descriptions (section 5).  Variant descriptions can be transmitted in
  1112.    Alternates headers (section 8.3).
  1113.  
  1114.    The US-ASCII charset is used for feature tags.  Feature tag
  1115.    comparison is case-insensitive.  A token tag XYZ is equal to a
  1116.    quoted-string tag "XYZ". Examples are
  1117.  
  1118.       tables, fonts, blebber, wolx, screenwidth, colordepth
  1119.  
  1120.  
  1121.  
  1122. Holtman & Mutz                Experimental                     [Page 20]
  1123.  
  1124. RFC 2295            Transparent Content Negotiation           March 1998
  1125.  
  1126.  
  1127.    An example of the use of feature tags in a variant description is:
  1128.  
  1129.       {"index.html" 1.0 {type text/html} {features tables frames}}
  1130.  
  1131.    This specification follows general computing practice in that it
  1132.    places no restrictions on what may be called a feature.  At the
  1133.    protocol level, this specification does not distinguish between
  1134.    different uses of feature tags: a tag will be processed in the same
  1135.    way, no matter whether it identifies a property, capability, or
  1136.    preference.  For some tags, it may be fluid whether the tag
  1137.    represents a property, preference, or capability.  For example, in
  1138.    content negotiation on web pages, a "textonly" tag would identify a
  1139.    capability of a text-only user agent, but the user of a graphical
  1140.    user agent may use this tag to specify that text-only content is
  1141.    preferred over graphical content.
  1142.  
  1143. 6.1.1 Feature tag values
  1144.  
  1145.    The definition of a feature tag may state that a feature tag can have
  1146.    zero, one, or more values associated with it.  These values
  1147.    specialize the meaning of the tag.  For example, a feature tag
  1148.    `paper' could be associated with the values `A4' and `A5'.
  1149.  
  1150.       tag-value  = token | quoted-string
  1151.  
  1152.    The US-ASCII charset is used for feature tag values.  Equality
  1153.    comparison for tag values MUST be done with a case-sensitive, octet-
  1154.    by-octet comparison, where any ""%" HEX HEX" encodings MUST be
  1155.    processed as in [1].  A token value XYZ is equal to a quoted-string
  1156.    value "XYZ".
  1157.  
  1158. 6.2 Feature sets
  1159.  
  1160.    The feature set of a user agent is a data structure which records the
  1161.    capabilities of the user agent and the preferences of the user.
  1162.  
  1163.    Feature sets are used by local variant selection algorithms (see
  1164.    appendix 19 for an example).  A user agent can use the Accept-
  1165.    Features header (section 8.2) to make some of the contents of its
  1166.    feature set known to remote variant selection algorithms.
  1167.  
  1168.    Structurally, a feature set is a possibly empty set, containing
  1169.    records of the form
  1170.  
  1171.       ( feature tag , set of feature tag values )
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178. Holtman & Mutz                Experimental                     [Page 21]
  1179.  
  1180. RFC 2295            Transparent Content Negotiation           March 1998
  1181.  
  1182.  
  1183.    If a record with a feature tag is present in the set, this means that
  1184.    the user agent implements the corresponding capability, or that the
  1185.    user has expressed the corresponding preference.
  1186.  
  1187.    Each record in a feature set has a, possibly empty, set of tag
  1188.    values.  For feature tags which cannot have values associated with
  1189.    it, this set is always empty.  For feature tags which can have zero,
  1190.    one, or more values associated with it, this set contains those
  1191.    values currently associated with the tag.  If the set of a feature
  1192.    tag T has the value V in it, it is said that `the tag T is present
  1193.    with the value V'.
  1194.  
  1195.    This specification does not define a standard notation for feature
  1196.    sets.  An example of a very small feature set, in a mathematical
  1197.    notation, is
  1198.  
  1199.       { ( "frames" , { } ) ,
  1200.         ( "paper"  , { "A4" , "A5" } )
  1201.       }
  1202.  
  1203.    As feature registration is expected to be an ongoing process, it is
  1204.    generally not possible for a user agent to know the meaning of all
  1205.    feature tags it can possibly encounter in a variant description.  A
  1206.    user agent SHOULD treat all features tags unknown to it as absent
  1207.    from its feature set.
  1208.  
  1209.    A user agent may change the contents of its feature set depending on
  1210.    the type of request, and may also update it to reflect changing
  1211.    conditions, for example a change in the window size.  Therefore, when
  1212.    considering feature negotiation, one usually talks about `the feature
  1213.    set of the current request'.
  1214.  
  1215. 6.3 Feature predicates
  1216.  
  1217.    Feature predicates are predicates on the contents of feature sets.
  1218.    They appear in the features attribute of a variant description.
  1219.  
  1220.       fpred = [ "!" ] ftag
  1221.             | ftag ( "=" | "!=" ) tag-value
  1222.             | ftag "=" "[" numeric-range "]"
  1223.  
  1224.       numeric-range = [ number ] "-" [ number ]
  1225.  
  1226.    Feature predicates are used in features attributes (section 6.4),
  1227.    which are used in variant descriptions (section 5).  Variant
  1228.    descriptions can be transmitted in Alternates headers (section 8.3).
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234. Holtman & Mutz                Experimental                     [Page 22]
  1235.  
  1236. RFC 2295            Transparent Content Negotiation           March 1998
  1237.  
  1238.  
  1239.    Examples of feature predicates are
  1240.  
  1241.       blebber, !blebber, paper=a4, colordepth=5, blex!=54,
  1242.       dpi=[300-599], colordepth=[24-]
  1243.  
  1244.    Using the feature set of the current request, a user agent SHOULD
  1245.    compute the truth value of the different feature predicates as
  1246.    follows.
  1247.  
  1248.       ftag       true if the feature is present, false otherwise
  1249.  
  1250.       !ftag      true if the feature is absent, false otherwise
  1251.  
  1252.       ftag=V     true if the feature is present with the value V,
  1253.                  false otherwise,
  1254.  
  1255.       ftag!=V    true if the feature is not present with the value V,
  1256.                  false otherwise,
  1257.  
  1258.       ftag=[N-M] true if the feature is present with at least one
  1259.                  numeric value, while the highest value with which it
  1260.                  is present in the range N-M, false otherwise.  If N
  1261.                  is missing, the lower bound is 0.  If M is missing,
  1262.                  the upper bound is infinity.
  1263.  
  1264.    As an example, with the feature set
  1265.  
  1266.        { ( "blex"       , { } ),
  1267.          ( "colordepth" , { "5" } ),
  1268.          ( "UA-media"   , { "stationary" } ),
  1269.          ( "paper"      , { "A4", "A3" } ) ,
  1270.          ( "x-version"  , { "104", "200" } )
  1271.        }
  1272.  
  1273.    the following predicates are true:
  1274.  
  1275.    blex, colordepth=[4-], colordepth!=6, colordepth, !screenwidth, UA-
  1276.    media=stationary, UA-media!=screen, paper=A4, paper =!A0,
  1277.    colordepth=[ 4 - 6 ], x-version=[100-300], x-version=[200-300]
  1278.  
  1279.    and the following predicates are false:
  1280.  
  1281.       !blex, blebber, colordepth=6, colordepth=foo, !colordepth,
  1282.       screenwidth, screenwidth=640, screenwidth!=640, x-version=99, UA-
  1283.       media=screen, paper=A0, paper=a4, x-version=[100-199], wuxta
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290. Holtman & Mutz                Experimental                     [Page 23]
  1291.  
  1292. RFC 2295            Transparent Content Negotiation           March 1998
  1293.  
  1294.  
  1295. 6.4 Features attribute
  1296.  
  1297.       The features attribute, for which section 5.1 defines the syntax
  1298.  
  1299.       "{" "features" feature-list "}"
  1300.  
  1301.    is used in a variant description to specify how the presence or
  1302.    absence of particular feature tags in the user agent affects the
  1303.    overall quality of the variant.
  1304.  
  1305.        feature-list = 1%feature-list-element
  1306.  
  1307.        feature-list-element = ( fpred | fpred-bag )
  1308.                               [ ";" [ "+" true-improvement  ]
  1309.                                     [ "-" false-degradation ]
  1310.                               ]
  1311.  
  1312.        fpred-bag = "[" 1%fpred "]"
  1313.  
  1314.        true-improvement   =  short-float
  1315.        false-degradation  =  short-float
  1316.  
  1317.    Features attributes are used in variant descriptions (section 5).
  1318.    Variant descriptions can be transmitted in Alternates headers
  1319.    (section 8.3).
  1320.  
  1321.    Examples are:
  1322.  
  1323.        {features !textonly [blebber !wolx] colordepth=3;+0.7}
  1324.  
  1325.        {features !blink;-0.5 background;+1.5 [blebber !wolx];+1.4-0.8}
  1326.  
  1327.    The default value for the true-improvement is 1.  The default value
  1328.    for the false-degradation is 0, or 1 if a true-improvement value is
  1329.    given.
  1330.  
  1331.    A user agent SHOULD, and a remote variant selection algorithm MUST
  1332.    compute the quality degradation factor associated with the features
  1333.    attribute by multiplying all quality degradation factors of the
  1334.    elements of the feature-list.  Note that the result can be a factor
  1335.    greater than 1.
  1336.  
  1337.    A feature list element yields its true-improvement factor if the
  1338.    corresponding feature predicate is true, or if at least one element
  1339.    of the corresponding fpred-bag is true. The element yields its
  1340.    false-degradation factor otherwise.
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346. Holtman & Mutz                Experimental                     [Page 24]
  1347.  
  1348. RFC 2295            Transparent Content Negotiation           March 1998
  1349.  
  1350.  
  1351. 7  Remote variant selection algorithms
  1352.  
  1353.    A remote variant selection algorithm is a standardized algorithm by
  1354.    which a server can choose a best variant on behalf of a negotiating
  1355.    user agent.  The use of a remote algorithm can speed up the
  1356.    negotiation process by eliminating a request-response round trip.
  1357.  
  1358.    A remote algorithm typically computes whether the Accept- headers in
  1359.    the request contain sufficient information to allow a choice, and if
  1360.    so, which variant is the best variant.  This specification does not
  1361.    define any remote algorithms, but does define a mechanism to
  1362.    negotiate on the use of such algorithms.
  1363.  
  1364. 7.1 Version numbers
  1365.  
  1366.    A version numbering scheme is used to distinguish between different
  1367.    remote variant selection algorithms.
  1368.  
  1369.       rvsa-version = major "." minor
  1370.  
  1371.       major = 1*4DIGIT
  1372.       minor = 1*4DIGIT
  1373.  
  1374.    An algorithm with the version number X.Y, with Y>0, MUST be downwards
  1375.    compatible with all algorithms from X.0 up to X.Y.  Downwards
  1376.    compatibility means that, if supplied with the same information, the
  1377.    newer algorithm MUST make the same choice, or a better choice, as the
  1378.    old algorithm.  There are no compatibility requirements between
  1379.    algorithms with different major version numbers.
  1380.  
  1381. 8  Content negotiation status codes and headers
  1382.  
  1383.    This specification adds one new HTTP status code, and introduces six
  1384.    new HTTP headers.  It also extends the semantics of an existing
  1385.    HTTP/1.1 header.
  1386.  
  1387. 8.1 506 Variant Also Negotiates
  1388.  
  1389.    The 506 status code indicates that the server has an internal
  1390.    configuration error: the chosen variant resource is configured to
  1391.    engage in transparent content negotiation itself, and is therefore
  1392.    not a proper end point in the negotiation process.
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402. Holtman & Mutz                Experimental                     [Page 25]
  1403.  
  1404. RFC 2295            Transparent Content Negotiation           March 1998
  1405.  
  1406.  
  1407. 8.2 Accept-Features
  1408.  
  1409.    The Accept-Features request header can be used by a user agent to
  1410.    give information about the presence or absence of certain features in
  1411.    the feature set of the current request.  Servers can use this
  1412.    information when running a remote variant selection algorithm.
  1413.  
  1414.       Note: the name `Accept-Features' for this header was chosen
  1415.       because of symmetry considerations with other Accept- headers,
  1416.       even though the Accept-Features header will generally not contain
  1417.       an exhaustive list of features which are somehow `accepted'.  A
  1418.       more accurate name of this header would have been `Feature-Set-
  1419.       Info'.
  1420.  
  1421.        Accept-Features = "Accept-Features" ":"
  1422.                    #( feature-expr *( ";" feature-extension ) )
  1423.  
  1424.        feature-expr = [ "!" ] ftag
  1425.                     | ftag ( "=" | "!=" ) tag-value
  1426.                     | ftag "=" "{" tag-value "}"
  1427.                     | "*"
  1428.  
  1429.        feature-extension = token [ "=" ( token | quoted-string ) ]
  1430.  
  1431.    No feature extensions are defined in this specification.  An example
  1432.    is:
  1433.  
  1434.        Accept-Features: blex, !blebber, colordepth={5}, !screenwidth,
  1435.                   paper = A4, paper!="A2", x-version=104, *
  1436.  
  1437.    The different feature expressions have the following meaning:
  1438.  
  1439.       ftag       ftag is present
  1440.  
  1441.       !ftag      ftag is absent
  1442.  
  1443.       ftag=V     ftag is present with the value V
  1444.  
  1445.       ftag!=V    ftag is present, but not with the value V
  1446.  
  1447.       ftag={V}   ftag is present with the value V, and not with any
  1448.                  other values
  1449.  
  1450.       *          the expressions in this header do not fully describe
  1451.                  the feature set: feature tags not mentioned in this
  1452.                  header may also be present, and, except for the case
  1453.                  ftag={V}, tags may be present with more values than
  1454.                  mentioned.
  1455.  
  1456.  
  1457.  
  1458. Holtman & Mutz                Experimental                     [Page 26]
  1459.  
  1460. RFC 2295            Transparent Content Negotiation           March 1998
  1461.  
  1462.  
  1463.    Absence of the Accept-Features header in a request is equivalent to
  1464.    the inclusion of
  1465.  
  1466.       Accept-Features: *
  1467.  
  1468.    By using the Accept-Features header, a remote variant selection
  1469.    algorithm can sometimes determine the truth value of a feature
  1470.    predicate on behalf of the user agent.  For example, with the header
  1471.  
  1472.        Accept-Features: blex, !blebber, colordepth={5}, !screenwidth,
  1473.                   paper = A4, paper!="A2", x-version=104, *
  1474.  
  1475.    the algorithm can determine that the following predicates are true:
  1476.  
  1477.        blex, colordepth=[4-], colordepth!=6, colordepth, !screenwidth,
  1478.        paper=A4, colordepth=[4-6]
  1479.  
  1480.    and that the following predicates are false:
  1481.  
  1482.        !blex, blebber, colordepth=6, colordepth=foo, !colordepth,
  1483.        screenwidth, screenwidth=640, screenwidth!=640,
  1484.  
  1485.    but the truth value of the following predicates cannot be
  1486.    determined:
  1487.  
  1488.        UA-media=stationary, UA-media!=screen, paper!=a0,
  1489.        x-version=[100-300], x-version=[200-300], x-version=99,
  1490.        UA-media=screen, paper=A0, paper=a4, x-version=[100-199], wuxta
  1491.  
  1492. 8.3 Alternates
  1493.  
  1494.    The Alternates response header is used to convey the list of variants
  1495.    bound to a negotiable resource.  This list can also include
  1496.    directives for any content negotiation process.  If a response from a
  1497.    transparently negotiable resource includes an Alternates header, this
  1498.    header MUST contain the complete variant list bound to the negotiable
  1499.    resource.  Responses from resources which do not support transparent
  1500.    content negotiation MAY also use Alternates headers.
  1501.  
  1502.        Alternates = "Alternates" ":" variant-list
  1503.  
  1504.        variant-list = 1#( variant-description
  1505.                         | fallback-variant
  1506.                         | list-directive )
  1507.  
  1508.        fallback-variant = "{" <"> URI <"> "}"
  1509.  
  1510.        list-directive = ( "proxy-rvsa" "=" <"> 0#rvsa-version <"> )
  1511.  
  1512.  
  1513.  
  1514. Holtman & Mutz                Experimental                     [Page 27]
  1515.  
  1516. RFC 2295            Transparent Content Negotiation           March 1998
  1517.  
  1518.  
  1519.                         | extension-list-directive
  1520.  
  1521.        extension-list-directive =
  1522.                         token [ "=" ( token | quoted-string ) ]
  1523.  
  1524.    An example is
  1525.  
  1526.      Alternates: {"paper.1" 0.9 {type text/html} {language en}},
  1527.                  {"paper.2" 0.7 {type text/html} {language fr}},
  1528.                  {"paper.3" 1.0 {type application/postscript}
  1529.                      {language en}},
  1530.                  proxy-rvsa="1.0, 2.5"
  1531.  
  1532.    Any relative URI specified in a variant-description or fallback-
  1533.    variant field is relative to the request-URI.  Only one fallback-
  1534.    variant field may be present.  If the variant selection algorithm of
  1535.    the user agent finds that all described variants are unacceptable,
  1536.    then it SHOULD choose the fallback variant, if present, as the best
  1537.    variant.  If the user agent computes the overall quality values of
  1538.    the described variants, and finds that several variants share the
  1539.    highest value, then the first variant with this value in the list
  1540.    SHOULD be chosen as the best variant.
  1541.  
  1542.    The proxy-rvsa directive restricts the use of remote variant
  1543.    selection algorithms by proxies. If present, a proxy MUST ONLY use
  1544.    algorithms which have one of the version numbers listed, or have the
  1545.    same major version number and a higher minor version number as one of
  1546.    the versions listed.  Any restrictions set by proxy-rvsa come on top
  1547.    of the restrictions set by the user agent in the Negotiate request
  1548.    header.  The directive proxy-rvsa="" will disable variant selection
  1549.    by proxies entirely.  Clients SHOULD ignore all extension-list-
  1550.    directives they do not understand.
  1551.  
  1552.    A variant list may contain multiple differing descriptions of the
  1553.    same variant.  This can be convenient if the variant uses conditional
  1554.    rendering constructs, or if the variant resource returns multiple
  1555.    representations using a multipart media type.
  1556.  
  1557. 8.4 Negotiate
  1558.  
  1559.    The Negotiate request header can contain directives for any content
  1560.    negotiation process initiated by the request.
  1561.  
  1562.       Negotiate = "Negotiate" ":" 1#negotiate-directive
  1563.  
  1564.       negotiate-directive = "trans"
  1565.                           | "vlist"
  1566.                           | "guess-small"
  1567.  
  1568.  
  1569.  
  1570. Holtman & Mutz                Experimental                     [Page 28]
  1571.  
  1572. RFC 2295            Transparent Content Negotiation           March 1998
  1573.  
  1574.  
  1575.                           | rvsa-version
  1576.                           | "*"
  1577.                           | negotiate-extension
  1578.  
  1579.       negotiate-extension = token [ "=" token ]
  1580.  
  1581.    Examples are
  1582.  
  1583.       Negotiate: 1.0, 2.5
  1584.       Negotiate: *
  1585.  
  1586.    The negotiate directives have the following meaning
  1587.  
  1588.       "trans"
  1589.         The user agent supports transparent content negotiation for
  1590.         the current request.
  1591.  
  1592.       "vlist"
  1593.         The user agent requests that any transparently negotiated
  1594.         response for the current request includes an Alternates
  1595.         header with the variant list bound to the negotiable resource.
  1596.         Implies "trans".
  1597.  
  1598.       "guess-small"
  1599.         The user agent allows origin servers to run a custom algorithm
  1600.         which guesses the best variant for the request, and to return
  1601.         this variant in a choice response, if the resulting choice
  1602.         response is smaller than or not much larger than a list
  1603.         response.  The definition of `not much larger' is left to
  1604.         origin server heuristics.  Implies "vlist" and "trans".
  1605.  
  1606.       rvsa-version
  1607.         The user agent allows origin servers and proxies to run the
  1608.         remote variant selection algorithm with the indicated version
  1609.         number, or with the same major version number and a higher
  1610.         minor version number.  If the algorithm has sufficient
  1611.         information to choose a best, neighboring variant, the origin
  1612.         server or proxy MAY return a choice response with this
  1613.         variant.  Implies "trans".
  1614.  
  1615.       "*"
  1616.         The user agent allows origin servers and proxies to run any
  1617.         remote variant selection algorithm.  The origin server may
  1618.         even run algorithms which have not been standardized.  If the
  1619.         algorithm has sufficient information to choose a best,
  1620.         neighboring variant, the origin server or proxy MAY return a
  1621.         choice response with this variant.  Implies "trans".
  1622.  
  1623.  
  1624.  
  1625.  
  1626. Holtman & Mutz                Experimental                     [Page 29]
  1627.  
  1628. RFC 2295            Transparent Content Negotiation           March 1998
  1629.  
  1630.  
  1631.    Servers SHOULD ignore all negotiate-directives they do not
  1632.    understand.  If the Negotiate header allows a choice between multiple
  1633.    remote variant selection algorithms which are all supported by the
  1634.    server, the server SHOULD use some internal precedence heuristics to
  1635.    select the best algorithm.
  1636.  
  1637. 8.5 TCN
  1638.  
  1639.    The TCN response header is used by a server to signal that the
  1640.    resource is transparently negotiated.
  1641.  
  1642.        TCN = "TCN" ":" #( response-type
  1643.                         | server-side-override-directive
  1644.                         | tcn-extension )
  1645.  
  1646.        response-type = "list" | "choice" | "adhoc"
  1647.  
  1648.        server-side-override-directive = "re-choose" | "keep"
  1649.  
  1650.        tcn-extension = token [ "=" ( token | quoted-string ) ]
  1651.  
  1652.    If the resource is not transparently negotiated, a TCN header MUST
  1653.    NOT be included in any response.  If the resource is transparently
  1654.    negotiated, a TCN header, which includes the response-type value of
  1655.    the response, MUST be included in every response with a 2xx status
  1656.    code or any 3xx status code, except 304, in which it MAY be included.
  1657.    A TCN header MAY also be included, without a response-type value, in
  1658.    other responses from transparently negotiated resources.
  1659.  
  1660.    A server-side override directive MUST be included if the origin
  1661.    server performed a server-side override when choosing the response.
  1662.    If the directive is "re-choose", the server MUST include an
  1663.    Alternates header with the variant bound to the negotiable resource
  1664.    in the response, and user agent SHOULD use its internal variant
  1665.    selection algorithm to choose, retrieve, and display the best variant
  1666.    from this list.  If the directive is "keep" the user agent SHOULD NOT
  1667.    renegotiate on the response, but display it directly, or act on it
  1668.    directly if it is a redirection response.
  1669.  
  1670.    Clients SHOULD ignore all tcn-extensions they do not understand.
  1671.  
  1672. 8.6 Variant-Vary
  1673.  
  1674.    The Variant-Vary response header can be used in a choice response to
  1675.    record any vary information which applies to the variant data (the
  1676.    entity body combined with some of the entity headers) contained in
  1677.    the response, rather than to the response as a whole.
  1678.  
  1679.  
  1680.  
  1681.  
  1682. Holtman & Mutz                Experimental                     [Page 30]
  1683.  
  1684. RFC 2295            Transparent Content Negotiation           March 1998
  1685.  
  1686.  
  1687.          Variant-Vary  = "Variant-Vary" ":" ( "*" | 1#field-name )
  1688.  
  1689.    Use of the Variant-Vary header is discussed in section 10.2.
  1690.  
  1691. 9  Cache validators
  1692.  
  1693.    To allow for correct and efficient caching and revalidation of
  1694.    negotiated responses, this specification extends the caching model of
  1695.    HTTP/1.1 [1] in various ways.
  1696.  
  1697.    This specification does not introduce a `variant-list-max-age'
  1698.    directive which explicitly bounds the freshness lifetime of a cached
  1699.    variant list, like the `max-age' Cache-Control directive bounds the
  1700.    freshness lifetime of a cached response.  However, this specification
  1701.    does ensure that a variant list which is sent at a time T by the
  1702.    origin server will never be re-used without revalidation by
  1703.    semantically transparent caches after the time T+M.  This M is the
  1704.    maximum of all freshness lifetimes assigned (using max-age directives
  1705.    or Expires headers) by the origin server to
  1706.  
  1707.       a. the responses from the negotiable resource itself, and
  1708.  
  1709.       b. the responses from its neighboring variant resources
  1710.  
  1711.    If no freshness lifetimes are assigned by the origin server, M is the
  1712.    maximum of the freshness lifetimes which were heuristically assigned
  1713.    by all caches which can re-use the variant list.
  1714.  
  1715. 9.1 Variant list validators
  1716.  
  1717.    A variant list validator is an opaque value which acts as the cache
  1718.    validator of a variant list bound to a negotiable resource.
  1719.  
  1720.       variant-list-validator = <quoted-string not containing any ";">
  1721.  
  1722.    If two responses contain the same variant list validator, a cache can
  1723.    treat the Alternates headers in these responses as equivalent (though
  1724.    the headers themselves need not be identical).
  1725.  
  1726. 9.2 Structured entity tags
  1727.  
  1728.    A structured entity tag consists of a normal entity tag of which the
  1729.    opaque string is extended with a semicolon followed by the text
  1730.    (without the surrounding quotes) of a variant list validator:
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738. Holtman & Mutz                Experimental                     [Page 31]
  1739.  
  1740. RFC 2295            Transparent Content Negotiation           March 1998
  1741.  
  1742.  
  1743.         normal      |  variant list  |   structured
  1744.         entity tag  |  validator     |   entity tag
  1745.        -------------+----------------+-----------------
  1746.          "etag"     |     "vlv"      |   "etag;vlv"
  1747.         W/"etag"    |     "vlv"      |  W/"etag;vlv"
  1748.  
  1749.    Note that a structured entity tag is itself also an entity tag.  The
  1750.    structured nature of the tag allows caching proxies capable of
  1751.    transparent content negotiation to perform some optimizations defined
  1752.    in section 10.  When not performing such optimizations, a structured
  1753.    tag SHOULD be treated as a single opaque value, according to the
  1754.    general rules in HTTP/1.1.  Examples of structured entity tags are:
  1755.  
  1756.       "xyzzy;1234"  W/"xyzzy;1234"  "gonkxxxx;1234"  "a;b;c;;1234"
  1757.  
  1758.    In the last example, the normal entity tag is "a;b;c;" and the
  1759.    variant list validator is "1234".
  1760.  
  1761.    If a transparently negotiated response includes an entity tag, it
  1762.    MUST be a structured entity tag.  The variant list validator in the
  1763.    structured tag MUST act as a validator for the variant list contained
  1764.    in the Alternates header.  The normal entity tag in the structured
  1765.    tag MUST act as a validator of the entity body in the response and of
  1766.    all entity headers except Alternates.
  1767.  
  1768. 9.3 Assigning entity tags to variants
  1769.  
  1770.    To allow for correct revalidation of transparently negotiated
  1771.    responses by clients, origin servers SHOULD generate all normal
  1772.    entity tags for the neighboring variant resources of the negotiable
  1773.    resource in such a way that
  1774.  
  1775.      1. the same tag is never used by two different variants,
  1776.         unless this tag labels exactly the same entity on all occasions,
  1777.  
  1778.      2. if one normal tag "X" is a prefix of another normal tag "XY",
  1779.         then "Y" must never be a semicolon followed by a variant list
  1780.         validator.
  1781.  
  1782. 10 Content negotiation responses
  1783.  
  1784.    If a request on a transparently negotiated resource yields a response
  1785.    with a 2xx status code or any 3xx status code except 304, this
  1786.    response MUST always be either a list response, a choice response, or
  1787.    an adhoc response.  These responses MUST always include a TCN header
  1788.    which specifies their type.  Transparently negotiated responses with
  1789.    other status codes MAY also include a TCN header.
  1790.  
  1791.  
  1792.  
  1793.  
  1794. Holtman & Mutz                Experimental                     [Page 32]
  1795.  
  1796. RFC 2295            Transparent Content Negotiation           March 1998
  1797.  
  1798.  
  1799.    The conditions under which the different content negotiation
  1800.    responses may be sent are defined in section 12.1 for origin servers
  1801.    and in section 13 for proxies.
  1802.  
  1803.    After having constructed a list, choice, or adhoc response, a server
  1804.    MAY process any If-No-Match or If-Range headers in the request
  1805.    message and shorten the response to a 304 (Not Modified) or 206
  1806.    (Partial Content) response, following the rules in the HTTP/1.1
  1807.    specification [1].  In this case, the entity tag of the shortened
  1808.    response will identify it indirectly as a list, choice, or adhoc
  1809.    response.
  1810.  
  1811. 10.1 List response
  1812.  
  1813.    A list response returns the variant list of the negotiable resource,
  1814.    but no variant data.  It can be generated when the server does not
  1815.    want to, or is not allowed to, return a particular best variant for
  1816.    the request.  If the user agent supports transparent content
  1817.    negotiation, the list response will cause it to select a best variant
  1818.    and retrieve it.
  1819.  
  1820.    A list response MUST contain (besides the normal headers required by
  1821.    HTTP) a TCN header which specifies the "list" response-type, the
  1822.    Alternates header bound to the negotiable resource, a Vary header and
  1823.    (unless it was a HEAD request) an entity body which allows the user
  1824.    to manually select the best variant.
  1825.  
  1826.    An example of a list response is
  1827.  
  1828.      HTTP/1.1 300 Multiple Choices
  1829.      Date: Tue, 11 Jun 1996 20:02:21 GMT
  1830.      TCN: list
  1831.      Alternates: {"paper.1" 0.9 {type text/html} {language en}},
  1832.                  {"paper.2" 0.7 {type text/html} {language fr}},
  1833.                  {"paper.3" 1.0 {type application/postscript}
  1834.                      {language en}}
  1835.      Vary: negotiate, accept, accept-language
  1836.      ETag: "blah;1234"
  1837.      Cache-control: max-age=86400
  1838.      Content-Type: text/html
  1839.      Content-Length: 227
  1840.  
  1841.      <h2>Multiple Choices:</h2>
  1842.      <ul>
  1843.      <li><a href=paper.1>HTML, English version</a>
  1844.      <li><a href=paper.2>HTML, French version</a>
  1845.      <li><a href=paper.3>Postscript, English version</a>
  1846.      </ul>
  1847.  
  1848.  
  1849.  
  1850. Holtman & Mutz                Experimental                     [Page 33]
  1851.  
  1852. RFC 2295            Transparent Content Negotiation           March 1998
  1853.  
  1854.  
  1855.       Note: A list response can have any status code, but the 300
  1856.       (Multiple Choices) code is the most appropriate one for HTTP/1.1
  1857.       clients.  Some existing versions of HTTP/1.0 clients are known to
  1858.       silently ignore 300 responses, instead of handling them according
  1859.       to the HTTP/1.0 specification [2].  Servers should therefore be
  1860.       careful in sending 300 responses to non-negotiating HTTP/1.0 user
  1861.       agents, and in making these responses cacheable.  The 200 (OK)
  1862.       status code can be used instead.
  1863.  
  1864.    The Vary header in the response SHOULD ensure correct handling by
  1865.    plain HTTP/1.1 caching proxies.  This header can either be
  1866.  
  1867.       Vary: *
  1868.  
  1869.    or a more elaborate header; see section 10.6.1.
  1870.  
  1871.    Only the origin server may construct list responses.  Depending on
  1872.    the status code, a list response is cacheable unless indicated
  1873.    otherwise.
  1874.  
  1875.    According to the HTTP/1.1 specification [1], a user agent which does
  1876.    not support transparent content negotiation will, when receiving a
  1877.    list response with the 300 status code, display the entity body
  1878.    included in the response.  If the response contains a Location
  1879.    header, however, the user agent MAY automatically redirect to this
  1880.    location.
  1881.  
  1882.    The handling of list responses by clients supporting transparent
  1883.    content negotiation is described in sections 11.1 and 13.
  1884.  
  1885. 10.2 Choice response
  1886.  
  1887.    A choice response returns a representation of the best variant for
  1888.    the request, and may also return the variant list of the negotiable
  1889.    resource.  It can be generated when the server has sufficient
  1890.    information to be able to choose the best variant on behalf the user
  1891.    agent, but may only be generated if this best variant is a
  1892.    neighboring variant.  For request from user agents which do not
  1893.    support transparent content negotiation, a server may always generate
  1894.    a choice response, provided that the variant returned is a
  1895.    neighboring variant.  The variant returned in a choice response need
  1896.    not necessarily be listed in the variant list bound to the negotiable
  1897.    resource.
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906. Holtman & Mutz                Experimental                     [Page 34]
  1907.  
  1908. RFC 2295            Transparent Content Negotiation           March 1998
  1909.  
  1910.  
  1911.    A choice response merges a normal HTTP response from the chosen
  1912.    variant, a TCN header which specifies the "choice" response-type, and
  1913.    a Content-Location header giving the location of the variant.
  1914.    Depending on the status code, a choice response is cacheable unless
  1915.    indicated otherwise.
  1916.  
  1917.    Origin servers and proxy caches MUST construct choice responses with
  1918.    the following algorithm (or any other algorithm which gives equal end
  1919.    results for the client).
  1920.  
  1921.    In this algorithm, `the current Alternates header' refers to the
  1922.    Alternates header containing the variant list which was used to
  1923.    choose the best variant, and `the current variant list validator'
  1924.    refers to the validator of this list.  Section 10.4 specifies how
  1925.    these two items can be obtained by a proxy cache.
  1926.  
  1927.    The algorithm consists of four steps.
  1928.  
  1929.      1. Construct a HTTP request message on the best variant resource
  1930.         by rewriting the request-URI and Host header (if appropriate) of
  1931.         the received request message on the negotiable resource.
  1932.  
  1933.      2. Generate a valid HTTP response message, but not one with the
  1934.         304 (Not Modified) code, for the request message constructed in
  1935.         step 1.
  1936.  
  1937.         In a proxy cache, the response can be obtained from cache
  1938.         memory, or by passing the constructed HTTP request towards the
  1939.         origin server.  If the request is passed on, the proxy MAY add,
  1940.         modify, or delete If-None-Match and If-Range headers to optimize
  1941.         the transaction with the upstream server.
  1942.  
  1943.            Note: the proxy should be careful not to add entity tags of
  1944.            non-neighboring variants to If-* (conditional) headers of the
  1945.            request, as there are no global uniqueness requirements for
  1946.            these tags.
  1947.  
  1948.      3. Only in origin servers: check for an origin server
  1949.         configuration error. If the HTTP response message generated in
  1950.         step 2 contains a TCN header, then the best variant resource is
  1951.         not a proper end point in the transparent negotiation process,
  1952.         and a 506 (Variant Also Negotiates) error response message
  1953.         SHOULD be generated instead of going to step 4.
  1954.  
  1955.      4. Add a number of headers to the HTTP response message generated
  1956.         in step 2.
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962. Holtman & Mutz                Experimental                     [Page 35]
  1963.  
  1964. RFC 2295            Transparent Content Negotiation           March 1998
  1965.  
  1966.  
  1967.         a. Add a TCN header which specifies the "choice"
  1968.            response-type.
  1969.  
  1970.         b. Add a Content-Location header giving the location of the
  1971.            chosen variant.  Delete any Content-Location header which was
  1972.            already present.
  1973.  
  1974.               Note: According to the HTTP/1.1 specification [1], if the
  1975.               Content-Location header contains a relative URI, this URI
  1976.               is relative to the URI in the Content-Base header, if
  1977.               present, and relative to the request-URI if no Content-
  1978.               Base header is present.
  1979.  
  1980.         c. If any Vary headers are present in the response message
  1981.            from step 2, add, for every Vary header, a Variant-Vary
  1982.            header with a copy of the contents of this Vary header.
  1983.  
  1984.         d. Delete any Alternates headers which are present in in the
  1985.            response.  Now, the current Alternates header MUST be added
  1986.            if this is required by the Negotiate request header, or if
  1987.            the server returns "re-choose" in the TCN response header.
  1988.            Otherwise, the current Alternates header MAY be added.
  1989.  
  1990.               Note: It is usually a good strategy to always add the
  1991.               current Alternates header, unless it is very large
  1992.               compared to the rest of the response.
  1993.  
  1994.         e. Add a Vary header to ensure correct handling by plain
  1995.            HTTP/1.1 caching proxies.  This header can either be
  1996.  
  1997.               Vary: *
  1998.            or a more elaborate header, see section 10.6.
  1999.  
  2000.         f. To ensure compatibility with HTTP/1.0 caching proxies which
  2001.            do not recognize the Vary header, an Expires header with a
  2002.            date in the past MAY be added. See section 10.7 for more
  2003.            information.
  2004.  
  2005.         g. If an ETag header is present in the response message from
  2006.            step 2, then extend the entity tag in that header with the
  2007.            current variant list valiidator = <quocified in section 9.2.
  2008.  
  2009.               Note: Step g. is required even if the variant list itself
  2010.               is not added in step d.
  2011.  
  2012.         h. Only in proxy caches: set the Age header of the response to
  2013.  
  2014.               max( variant_age , alternates_age )
  2015.  
  2016.  
  2017.  
  2018. Holtman & Mutz                Experimental                     [Page 36]
  2019.  
  2020. RFC 2295            Transparent Content Negotiation           March 1998
  2021.  
  2022.  
  2023.            where variant_age is the age of the variant response obtained
  2024.            in step 2, calculated according to the rules in the HTTP/1.1
  2025.            specification [1], and alternates_age is the age of the
  2026.            Alternates header added in step d, calculated according to
  2027.            the rules in section 10.4.
  2028.  
  2029.    Note that a server can shorten the response produced by the above
  2030.    algorithm to a 304 (Not Modified) response if an If-None-Match header
  2031.    in the original request allows it.  If this is the case, an
  2032.    implementation of the above algorithm can avoid the unnecessary
  2033.    internal construction of full response message in step 2, it need
  2034.    only construct the parts which end up in the final 304 response.  A
  2035.    proxy cache which implements this optimization can sometimes generate
  2036.    a legal 304 response even if it has not cached the variant data
  2037.    itself.
  2038.  
  2039.    An example of a choice response is:
  2040.  
  2041.      HTTP/1.1 200 OK
  2042.      Date: Tue, 11 Jun 1996 20:05:31 GMT
  2043.      TCN: choice
  2044.      Content-Type: text/html
  2045.      Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT
  2046.      Content-Length: 5327
  2047.      Cache-control: max-age=604800
  2048.      Content-Location: paper.1
  2049.      Alternates: {"paper.1" 0.9 {type text/html} {language en}},
  2050.                  {"paper.2" 0.7 {type text/html} {language fr}},
  2051.                  {"paper.3" 1.0 {type application/postscript}
  2052.                      {language en}}
  2053.      Etag: "gonkyyyy;1234"
  2054.      Vary: negotiate, accept, accept-language
  2055.      Expires: Thu, 01 Jan 1980 00:00:00 GMT
  2056.  
  2057.      <title>A paper about ....
  2058.  
  2059. 10.3 Adhoc response
  2060.  
  2061.    An adhoc response can be sent by an origin server as an extreme
  2062.    measure, to achieve compatibility with a non-negotiating or buggy
  2063.    client if this compatibility cannot be achieved by sending a list or
  2064.    choice response.  There are very little requirements on the contents
  2065.    of an adhoc response.  An adhoc response MUST have a TCN header which
  2066.    specifies the "adhoc" response-type, and a Vary header if the
  2067.    response is cacheable.  It MAY contain the Alternates header bound to
  2068.    the negotiable resource.
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074. Holtman & Mutz                Experimental                     [Page 37]
  2075.  
  2076. RFC 2295            Transparent Content Negotiation           March 1998
  2077.  
  2078.  
  2079.    Any Vary header in the response SHOULD ensure correct handling by
  2080.    plain HTTP/1.1 caching proxies.  This header can either be
  2081.  
  2082.         Vary: *
  2083.  
  2084.    or a more elaborate header, see section 10.6.1.  Depending on the
  2085.    status code, an adhoc response is cacheable unless indicated
  2086.    otherwise.
  2087.  
  2088.    As an example of the use of an adhoc response, suppose that the
  2089.    variant resource "redirect-to-blah" yields redirection (302)
  2090.    responses.  A choice response with this variant could look as
  2091.    follows:
  2092.  
  2093.      HTTP/1.1 302 Moved Temporarily
  2094.      Date: Tue, 11 Jun 1996 20:02:28 GMT
  2095.      TCN: choice
  2096.      Content-location: redirect-to-blah
  2097.      Location: http://blah.org/
  2098.      Content-Type: text/html
  2099.      Content-Length: 62
  2100.  
  2101.      This document is available <a href=http://blah.org/>here</a>.
  2102.  
  2103.    Suppose that the server knows that the receiving user agent has a
  2104.    bug, which causes it to crash on responses which contain both a
  2105.    Content-Location and a Location header.  The server could then work
  2106.    around this bug by performing a server-side override and sending the
  2107.    following adhoc response instead:
  2108.  
  2109.         HTTP/1.1 302 Moved Temporarily
  2110.         Date: Tue, 11 Jun 1996 20:02:28 GMT
  2111.         TCN: adhoc, keep
  2112.         Location: http://blah.org/
  2113.         Content-Type: text/html
  2114.         Content-Length: 62
  2115.  
  2116.         This document is available <a href=http://blah.org/>here</a>.
  2117.  
  2118. 10.4 Reusing the Alternates header
  2119.  
  2120.    If a proxy cache has available a negotiated response which is
  2121.    cacheable, fresh, and has ETag and Alternates headers, then it MAY
  2122.    extract the Alternates header and associated variant list validator
  2123.    from the response, and reuse them (without unnecessary delay) to
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130. Holtman & Mutz                Experimental                     [Page 38]
  2131.  
  2132. RFC 2295            Transparent Content Negotiation           March 1998
  2133.  
  2134.  
  2135.    negotiate on behalf of the user agent (section 13) or to construct a
  2136.    choice response (section 10.2).  The age of the extracted Alternates
  2137.    header is the age of the response from which it is extracted,
  2138.    calculated according to the rules in the HTTP/1.1 specification [1].
  2139.  
  2140. 10.5 Extracting a normal response from a choice response
  2141.  
  2142.    If a proxy receives a choice response, it MAY extract and cache the
  2143.    normal HTTP response contained therein.  The normal response can be
  2144.    extracted by taking a copy of the choice response and then deleting
  2145.    any Content-Location, Alternates, and Vary headers, renaming any
  2146.    Variant-Vary headers to Vary headers, and shortening the structured
  2147.    entity tag in any ETag header to a normal entity tag.
  2148.  
  2149.    This normal response MAY be cached (as a HTTP response to the variant
  2150.    request as constructed in step 1. of section 10.2) and reused to
  2151.    answer future direct requests on the variant resource, according to
  2152.    the rules in the HTTP/1.1 specification [1].
  2153.  
  2154.       Note: The caching of extracted responses can decrease the upstream
  2155.       bandwidth usage with up to a factor 2, because two independent
  2156.       HTTP/1.1 cache entries, one associated with the negotiable
  2157.       resource URI and one with the variant URI, are created in the same
  2158.       transaction.  Without this optimization, both HTTP/1.1 cache
  2159.       entries can only be created by transmitting the variant data
  2160.       twice.
  2161.  
  2162.    For security reasons (see section 14.2), an extracted normal response
  2163.    MUST NEVER be cached if belongs to a non-neighboring variant
  2164.    resource.  If the choice response claims to contain data for a non-
  2165.    neighboring variant resource, the proxy SHOULD reject the choice
  2166.    response as a probable spoofing attempt.
  2167.  
  2168. 10.6 Elaborate Vary headers
  2169.  
  2170.    If a HTTP/1.1 [1] server can generate varying responses for a request
  2171.    on some resource, then the server MUST include a Vary header in these
  2172.    responses if they are cacheable.  This Vary header is a signal to
  2173.    HTTP/1.1 caches that something special is going on.  It prevents the
  2174.    caches from returning the currently chosen response for every future
  2175.    request on the resource.
  2176.  
  2177.    Servers engaging in transparent content negotiation will generate
  2178.    varying responses.  Therefore, cacheable list, choice, and adhoc
  2179.    responses MUST always include a Vary header.
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186. Holtman & Mutz                Experimental                     [Page 39]
  2187.  
  2188. RFC 2295            Transparent Content Negotiation           March 1998
  2189.  
  2190.  
  2191.    The most simple Vary header which can be included is
  2192.  
  2193.        Vary: *
  2194.  
  2195.    This header leaves the way in which the response is selected by the
  2196.    server completely unspecified.
  2197.  
  2198.    A more elaborate Vary header MAY be used to allow for certain
  2199.    optimizations in HTTP/1.1 caches which do not have specific
  2200.    optimizations for transparent content negotiation, but which do cache
  2201.    multiple variant responses for one resource.  Such a more elaborate
  2202.    Vary header lists all request headers which can be used by the server
  2203.    when selecting a response for a request on the resource.
  2204.  
  2205. 10.6.1 Construction of an elaborate Vary header
  2206.  
  2207.    Origin servers can construct a more elaborate Vary header in the
  2208.    following way.  First, start with the header
  2209.  
  2210.        Vary: negotiate
  2211.  
  2212.    `negotiate' is always included because servers use the information in
  2213.    the Negotiate header when choosing between a list, choice, or adhoc
  2214.    response.
  2215.  
  2216.    Then, if any of the following attributes is present in any variant
  2217.    description in the Alternates header, add the corresponding header
  2218.    name to the Vary header
  2219.  
  2220.          attribute  |   header name to add
  2221.          -----------+---------------------
  2222.           type      |   accept
  2223.           charset   |   accept-charset
  2224.           language  |   accept-language
  2225.           features  |   accept-features
  2226.  
  2227.  
  2228.    The Vary header constructed in this way specifies the response
  2229.    variation which can be caused by the use of a variant selection
  2230.    algorithm in proxies.  If the origin server will in some cases, for
  2231.    example if contacted by a non-negotiating user agent, use a custom
  2232.    negotiation algorithm which takes additional headers into account,
  2233.    these names of these headers SHOULD also be added to the Vary header.
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242. Holtman & Mutz                Experimental                     [Page 40]
  2243.  
  2244. RFC 2295            Transparent Content Negotiation           March 1998
  2245.  
  2246.  
  2247. 10.6.2 Caching of an elaborate Vary header
  2248.  
  2249.    A proxy cache cannot construct an elaborate vary header using the
  2250.    method above, because this method requires exact knowledge of any
  2251.    custom algorithms present in the origin server.  However, when
  2252.    extracting an Alternates header from a response (section 10.4) caches
  2253.    MAY also extract the Vary header in the response, and reuse it along
  2254.    with the Alternates header.  A clean Vary header can however only be
  2255.    extracted if the variant does not vary itself, i.e. if a Variant-Vary
  2256.    header is absent.
  2257.  
  2258. 10.7 Adding an Expires header for HTTP/1.0 compatibility
  2259.  
  2260.    To ensure compatibility with HTTP/1.0 caching proxies which do not
  2261.    recognize the Vary header, an Expires header with a date in the past
  2262.    can be added to the response, for example
  2263.  
  2264.         Expires: Thu, 01 Jan 1980 00:00:00 GMT
  2265.  
  2266.    If this is done by an origin server, the server SHOULD usually also
  2267.    include a Cache-Control header for the benefit of HTTP/1.1 caches,
  2268.    for example
  2269.  
  2270.               Cache-Control: max-age=604800
  2271.  
  2272.    which overrides the freshness lifetime of zero seconds specified by
  2273.    the included Expires header.
  2274.  
  2275.       Note: This specification only claims downwards compatibility with
  2276.       the HTTP/1.0 proxy caches which implement the HTTP/1.0
  2277.       specification [2].  Some legacy proxy caches which return the
  2278.       HTTP/1.0 protocol version number do not honor the HTTP/1.0 Expires
  2279.       header as specified in [2].  Methods for achieving compatibility
  2280.       with such proxy caches are beyond the scope of this specification.
  2281.  
  2282. 10.8 Negotiation on content encoding
  2283.  
  2284.    Negotiation on the content encoding of a response is orthogonal to
  2285.    transparent content negotiation.  The rules for when a content
  2286.    encoding may be applied are the same as in HTTP/1.1: servers MAY
  2287.    content-encode responses that are the result of transparent content
  2288.    negotiation whenever an Accept-Encoding header in the request allows
  2289.    it.  When negotiating on the content encoding of a cacheable
  2290.    response, servers MUST add the accept-encoding header name to the
  2291.    Vary header of the response, or add `Vary: *'.
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298. Holtman & Mutz                Experimental                     [Page 41]
  2299.  
  2300. RFC 2295            Transparent Content Negotiation           March 1998
  2301.  
  2302.  
  2303.    Servers SHOULD always be able to provide unencoded versions of every
  2304.    transparently negotiated response.  This means in particular that
  2305.    every variant in the variant list SHOULD at least be available in an
  2306.    unencoded form.
  2307.  
  2308.    Like HTTP/1.1, this specification allows proxies to encode or decode
  2309.    relayed or cached responses on the fly, unless explicitly forbidden
  2310.    by a Cache-Control directive.  The encoded or decoded response still
  2311.    contains the same variant as far as transparent content negotiation
  2312.    is concerned.  Note that HTTP/1.1 requires proxies to add a Warning
  2313.    header if the encoding of a response is changed.
  2314.  
  2315. 11 User agent support for transparent negotiation
  2316.  
  2317.    This section specifies the requirements a user agent needs to satisfy
  2318.    in order to support transparent negotiation.  If the user agent
  2319.    contains an internal cache, this cache MUST conform to the rules for
  2320.    proxy caches in section 13.
  2321.  
  2322. 11.1 Handling of responses
  2323.  
  2324.    If a list response is received when a resource is accessed, the user
  2325.    agent MUST be able to automatically choose, retrieve, and display the
  2326.    best variant, or display an error message if none of the variants are
  2327.    acceptable.
  2328.  
  2329.    If a choice response is received when a resource is accessed, the
  2330.    usual action is to automatically display the enclosed entity.
  2331.    However, if a remote variant selection algorithm which was enabled
  2332.    could have made a choice different from the choice the local
  2333.    algorithm would make, the user agent MAY apply its local algorithm to
  2334.    any variant list in the response, and automatically retrieve and
  2335.    display another variant if the local algorithm makes an other choice.
  2336.  
  2337.    When receiving a choice response, a user agent SHOULD check if
  2338.    variant resource is a neighboring variant resource of the negotiable
  2339.    resource.  If this is not the case, the user agent SHOULD reject the
  2340.    choice response as a probable spoofing attempt and display an error
  2341.    message, for example by internally replacing the choice response with
  2342.    a 502 (bad gateway) response.
  2343.  
  2344. 11.2 Presentation of a transparently negotiated resource
  2345.  
  2346.    If the user agent is displaying a variant which is not an embedded or
  2347.    inlined object and which is the result of transparent content
  2348.    negotiation, the following requirements apply.
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354. Holtman & Mutz                Experimental                     [Page 42]
  2355.  
  2356. RFC 2295            Transparent Content Negotiation           March 1998
  2357.  
  2358.  
  2359.     1. The user agent SHOULD allow the user to review a list of all
  2360.        variants bound to the negotiable resource, and to manually
  2361.        retrieve another variant if desired.  There are two general ways
  2362.        of providing such a list.  First, the information in the
  2363.        Alternates header of the negotiable resource could be used to
  2364.        make an annotated menu of variants.  Second, the entity included
  2365.        in a list response of the negotiable resource could be displayed.
  2366.        Note that a list response can be obtained by doing a GET request
  2367.        which only has the "trans" directive in the Negotiate header.
  2368.  
  2369.     2. The user agent SHOULD make available though its user interface
  2370.        some indication that the resource being displayed is a negotiated
  2371.        resource instead of a plain resource.  It SHOULD also allow the
  2372.        user to examine the variant list included in the Alternates
  2373.        header.  Such a notification and review mechanism is needed
  2374.        because of privacy considerations, see section 14.1.
  2375.  
  2376.     3. If the user agent shows the URI of the displayed information to
  2377.        the user, it SHOULD be the negotiable resource URI, not the
  2378.        variant URI that is shown.  This encourages third parties, who
  2379.        want to refer to the displayed information in their own
  2380.        documents, to make a hyperlink to the negotiable resource as a
  2381.        whole, rather than to the variant resource which happens to be
  2382.        shown.  Such correct linking is vital for the interoperability of
  2383.        content across sites.  The user agent SHOULD however also provide
  2384.        a means for reviewing the URI of the particular variant which is
  2385.        currently being displayed.
  2386.  
  2387.     4. Similarly, if the user agent stores a reference to the
  2388.        displayed information for future use, for example in a hotlist,
  2389.        it SHOULD store the negotiable resource URI, not the variant URI.
  2390.  
  2391.    It is encouraged, but not required, that some of the above
  2392.    functionality is also made available for inlined or embedded objects,
  2393.    and when a variant which was selected manually is being displayed.
  2394.  
  2395. 12 Origin server support for transparent negotiation
  2396.  
  2397. 12.1 Requirements
  2398.  
  2399.    To implement transparent negotiation on a resource, the origin server
  2400.    MUST be able to send a list response when getting a GET request on
  2401.    the resource.  It SHOULD also be able to send appropriate list
  2402.    responses for HEAD requests.  When getting a request on a
  2403.    transparently negotiable resource, the origin server MUST NEVER
  2404.    return a response with a 2xx status code or any 3xx status code,
  2405.    except 304, which is not a list, choice, or adhoc response.
  2406.  
  2407.  
  2408.  
  2409.  
  2410. Holtman & Mutz                Experimental                     [Page 43]
  2411.  
  2412. RFC 2295            Transparent Content Negotiation           March 1998
  2413.  
  2414.  
  2415.    If the request includes a Negotiate header with a "vlist" or "trans"
  2416.    directive, but without any directive which allows the server to
  2417.    select a best variant, a list response MUST ALWAYS be sent, except
  2418.    when the server is performing a server-side override for bug
  2419.    compatibility.  If the request includes a Negotiate header with a
  2420.    "vlist" or "guess-small" directive, an Alternates header with the
  2421.    variant list bound to the negotiable resource MUST ALWAYS be sent in
  2422.    any list, choice, or adhoc response, except when the server is
  2423.    performing a server-side override for bug compatibility.
  2424.  
  2425.    If the Negotiate header allows it, the origin server MAY run a remote
  2426.    variant selection algorithm.  If the algorithm has sufficient
  2427.    information to choose a best variant, and if the best variant is a
  2428.    neighboring variant, the origin server MAY return a choice response
  2429.    with this variant.
  2430.  
  2431.    When getting a request on a transparently negotiable resource from a
  2432.    user agent which does not support transparent content negotiation,
  2433.    the origin server MAY use a custom algorithm to select between
  2434.    sending a list, choice, or adhoc response.
  2435.  
  2436.    The following table summarizes the rules above.
  2437.  
  2438.      |Req on   |Usr agnt|server-  |         Response may be:         |
  2439.      |trans neg|capable |side     +------+------+------+------+------+
  2440.      |resource?|of TCN? |override?|list  |choice|adhoc |normal|error |
  2441.      +---------+--------+---------+------+------+------+------+------+
  2442.      |   Yes   |  Yes   |  No     |always|smt(*)|never |never |always|
  2443.      +---------+--------+---------+------+------+------+------+------+
  2444.      |   Yes   |  Yes   |  Yes    |always|always|always|never |always|
  2445.      +---------+--------+---------+------+------+------+------+------+
  2446.      |   Yes   |  No    |   -     |always|always|always|never |always|
  2447.      +---------+--------+---------+------+------+------+------+------+
  2448.      |   No    |   -    |   -     |never |never |never |always|always|
  2449.      +---------+--------+---------+------+------+------+------+------+
  2450.         (*) sometimes, when allowed by the Negotiate request header
  2451.  
  2452.    Negotiability is a binary property: a resource is either
  2453.    transparently negotiated, or it is not.  Origin servers SHOULD NOT
  2454.    vary the negotiability of a resource, or the variant list bound to
  2455.    that resource, based on the request headers which are received.  The
  2456.    variant list and the property of being negotiated MAY however change
  2457.    through time.  The Cache-Control header can be used to control the
  2458.    propagation of such time-dependent changes through caches.
  2459.  
  2460.    It is the responsibility of the author of the negotiable resource to
  2461.    ensure that all resources in the variant list serve the intended
  2462.    content, and that the variant resources do not engage in transparent
  2463.  
  2464.  
  2465.  
  2466. Holtman & Mutz                Experimental                     [Page 44]
  2467.  
  2468. RFC 2295            Transparent Content Negotiation           March 1998
  2469.  
  2470.  
  2471.    content negotiation themselves.
  2472.  
  2473. 12.2 Negotiation on transactions other than GET and HEAD
  2474.  
  2475.    If a resource is transparently negotiable, this only has an impact on
  2476.    the GET and HEAD transactions on the resource.  It is not possible
  2477.    (under this specification) to do transparent content negotiation on
  2478.    the direct result of a POST request.
  2479.  
  2480.    However, a POST request can return an unnegotiated 303 (See Other)
  2481.    response which causes the user agent to do a GET request on a second
  2482.    resource.  This second resource could then use transparent content
  2483.    negotiation to return an appropriate final response.  The figure
  2484.    below illustrates this.
  2485.  
  2486.       Server ______ proxy ______ proxy ______ user
  2487.       x.org         cache        cache        agent
  2488.  
  2489.         < -------------------------------------
  2490.         |     POST http://x.org/cgi/submit
  2491.         |     <form contents in request body>
  2492.         |
  2493.         -------------------------------------- >
  2494.               303 See Other                    |
  2495.               Location: http://x.org/result/OK |
  2496.                                                |
  2497.         < -------------------------------------
  2498.         |     GET http://x.org/result/OK
  2499.         |      small Accept- headers
  2500.         |
  2501.       able to choose on
  2502.       behalf of user agent
  2503.         |
  2504.          ------------------------------------- >
  2505.               choice response with             |
  2506.               ..result/OK.nl variant           |
  2507.                                            displays OK.nl
  2508.  
  2509.    See the HTTP/1.1 specification [1] for details on the 303 (See Other)
  2510.    status code.  Note that this status code is not understood by some
  2511.    HTTP/1.0 clients.
  2512.  
  2513. 13 Proxy support for transparent negotiation
  2514.  
  2515.    Transparent content negotiation is an extension on top of HTTP/1.x.
  2516.    It is designed to work through any proxy which only implements the
  2517.    HTTP/1.1 specification [1].  If Expires headers are added as
  2518.    discussed in section 10.7, negotiation will also work though proxies
  2519.  
  2520.  
  2521.  
  2522. Holtman & Mutz                Experimental                     [Page 45]
  2523.  
  2524. RFC 2295            Transparent Content Negotiation           March 1998
  2525.  
  2526.  
  2527.    which implement HTTP/1.0 [2].  Thus, every HTTP/1.0 or HTTP/1.1 proxy
  2528.    provides support for transparent content negotiation.  However, if it
  2529.    is to be claimed that a HTTP/1.x proxy offers transparent content
  2530.    negotiation services, at least one of the specific optimizations
  2531.    below MUST be implemented.
  2532.  
  2533.    An HTTP/1.x proxy MUST ONLY optimize (change) the HTTP traffic
  2534.    flowing through it in ways which are explicitly allowed by the
  2535.    specification(s) it conforms to.  A proxy which supports transparent
  2536.    content negotiation on top of HTTP/1.x MAY perform the optimizations
  2537.    allowed for by HTTP/1.x.  In addition, it MAY perform three
  2538.    additional optimizations, defined below, on the HTTP traffic for
  2539.    transparently negotiated resources and their neighboring variant
  2540.    resources.
  2541.  
  2542.    First, when getting a request on a transparently negotiable resource
  2543.    from a user agent which supports transparent content negotiation, the
  2544.    proxy MAY return any cached, fresh list response from that resource,
  2545.    even if the selecting request headers, as specified by the Vary
  2546.    header, do not match.
  2547.  
  2548.    Second, when allowed by the user agent and origin server, a proxy MAY
  2549.    reuse an Alternates header taken from a previous response (section
  2550.    10.4) to run a remote variant selection algorithm.  If the algorithm
  2551.    has sufficient information to choose a best variant, and if the best
  2552.    variant is a neighboring variant, the proxy MAY return a choice
  2553.    response with this variant.
  2554.  
  2555.    Third, if a proxy receives a choice response, it MAY extract and
  2556.    cache the normal response embedded therein, as described in section
  2557.    10.5.
  2558.  
  2559. 14 Security and privacy considerations
  2560.  
  2561. 14.1 Accept- headers revealing personal information
  2562.  
  2563.    Accept- headers, in particular Accept-Language headers, may reveal
  2564.    information which the user would rather keep private unless it will
  2565.    directly improve the quality of service.  For example, a user may not
  2566.    want to send language preferences to sites which do not offer multi-
  2567.    lingual content.  The transparent content negotiation mechanism
  2568.    allows user agents to omit sending of the Accept-Language header by
  2569.    default, without adversely affecting the outcome of the negotiation
  2570.    process if transparently negotiated multi-lingual content is
  2571.    accessed.
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. Holtman & Mutz                Experimental                     [Page 46]
  2579.  
  2580. RFC 2295            Transparent Content Negotiation           March 1998
  2581.  
  2582.  
  2583.    However, even if Accept- headers are never sent, the automatic
  2584.    selection and retrieval of a variant by a user agent will reveal a
  2585.    preference for this variant to the server.  A malicious service
  2586.    author could provide a page with `fake' negotiability on (ethnicity-
  2587.    correlated) languages, with all variants actually being the same
  2588.    English document, as a means of obtaining privacy-sensitive
  2589.    information.  Such a plot would however be visible to an alert victim
  2590.    if the list of available variants and their properties is reviewed.
  2591.  
  2592.    Some additional privacy considerations connected to Accept- headers
  2593.    are discussed in [1].
  2594.  
  2595. 14.2 Spoofing of responses from variant resources
  2596.  
  2597.    The caching optimization in section 10.5 gives the implementer of a
  2598.    negotiable resource control over the responses cached for all
  2599.    neighboring variant resources.  This is a security problem if a
  2600.    neighboring variant resource belongs to another author.  To provide
  2601.    security in this case, the HTTP server will have to filter the
  2602.    Content-Location headers in the choice responses generated by the
  2603.    negotiable resource implementation.
  2604.  
  2605. 14.3 Security holes revealed by negotiation
  2606.  
  2607.    Malicious servers could use transparent content negotiation as a
  2608.    means of obtaining information about security holes which may be
  2609.    present in user agents.  This is a risk in particular for negotiation
  2610.    on the availability of scripting languages and libraries.
  2611.  
  2612. 15 Internationalization considerations
  2613.  
  2614.    This protocol defines negotiation facilities which can be used for
  2615.    the internationalization of web content.  For the
  2616.    internationalization of list response bodies (section 10.1), HTTP/1.0
  2617.    style negotiation (section 4.2) can be used.
  2618.  
  2619. 16 Acknowledgments
  2620.  
  2621.    Work on HTTP content negotiation has been done since at least 1993.
  2622.    The authors are unable to trace the origin of many of the ideas
  2623.    incorporated in this document.  Many members of the HTTP working
  2624.    group have contributed to the negotiation model in this
  2625.    specification.  The authors wish to thank the individuals who have
  2626.    commented on earlier versions of this document, including Brian
  2627.    Behlendorf, Daniel DuBois, Martin J. Duerst, Roy T. Fielding, Jim
  2628.    Gettys, Yaron Goland, Dirk van Gulik, Ted Hardie, Graham Klyne, Scott
  2629.    Lawrence, Larry Masinter, Jeffrey Mogul, Henrik Frystyk Nielsen,
  2630.    Frederick G.M. Roeber, Paul Sutton, and Klaus Weide and Mark Wood.
  2631.  
  2632.  
  2633.  
  2634. Holtman & Mutz                Experimental                     [Page 47]
  2635.  
  2636. RFC 2295            Transparent Content Negotiation           March 1998
  2637.  
  2638.  
  2639. 17 References
  2640.  
  2641.    [1] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., and
  2642.        T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC
  2643.        2068, January 1997.
  2644.  
  2645.    [2] Berners-Lee, T., Fielding, R., and H. Frystyk, "Hypertext
  2646.        Transfer Protocol -- HTTP/1.0", RFC 1945, May 1996.
  2647.  
  2648.    [3] Holtman, K., and A. Mutz, "HTTP Remote Variant Selection
  2649.        Algorithm -- RVSA/1.0", RFC 2296, March 1998.
  2650.  
  2651.    [4] Bradner, S., "Key words for use in RFCs to Indicate Requirement
  2652.        Levels", BCP 14, RFC 2119, March 1997.
  2653.  
  2654.    [5] Yergeau, F., "UTF-8, a transformation format of Unicode and ISO
  2655.        10646", RFC 2044, October 1996.
  2656.  
  2657. 18 Authors' Addresses
  2658.  
  2659.    Koen Holtman
  2660.    Technische Universiteit Eindhoven
  2661.    Postbus 513
  2662.    Kamer HG 6.57
  2663.    5600 MB Eindhoven (The Netherlands)
  2664.  
  2665.    EMail: koen@win.tue.nl
  2666.  
  2667.  
  2668.    Andrew H. Mutz
  2669.    Hewlett-Packard Company
  2670.    1501 Page Mill Road 3U-3
  2671.    Palo Alto CA 94304, USA
  2672.  
  2673.    Fax +1 415 857 4691
  2674.    EMail: mutz@hpl.hp.com
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690. Holtman & Mutz                Experimental                     [Page 48]
  2691.  
  2692. RFC 2295            Transparent Content Negotiation           March 1998
  2693.  
  2694.  
  2695. 19 Appendix: Example of a local variant selection algorithm
  2696.  
  2697.    A negotiating user agent will choose the best variant from a variant
  2698.    list with a local variant selection algorithm.  This appendix
  2699.    contains an example of such an algorithm.
  2700.  
  2701.    The inputs of the algorithm are a variant list from an Alternates
  2702.    header, and an agent-side configuration database, which contains
  2703.  
  2704.      - the feature set of the current request,
  2705.  
  2706.      - a collection of quality values assigned to media types,
  2707.        languages, and charsets for the current request, following the
  2708.        model of the corresponding HTTP/1.1 [1] Accept- headers,
  2709.  
  2710.      - a table which lists `forbidden' combinations of media types and
  2711.        charsets, i.e. combinations which cannot be displayed because of
  2712.        some internal user agent limitation.
  2713.  
  2714.    The output of the algorithm is either the best variant, or the
  2715.    conclusion that none of the variants are acceptable.
  2716.  
  2717. 19.1 Computing overall quality values
  2718.  
  2719.    As a first step in the local variant selection algorithm, the overall
  2720.    qualities associated with all variant descriptions in the list are
  2721.    computed.
  2722.  
  2723.    The overall quality Q of a variant description is the value
  2724.  
  2725.       Q = round5( qs * qt * qc * ql * qf * qa )
  2726.  
  2727.    where rounds5 is a function which rounds a floating point value to 5
  2728.    decimal places after the point.  It is assumed that the user agent
  2729.    can run on multiple platforms: the rounding function makes the
  2730.    algorithm independent of the exact characteristics of the underlying
  2731.    floating point hardware.
  2732.  
  2733.    The factors qs, qt, qc, ql, qf, and qa are determined as follows.
  2734.  
  2735.       qs Is the source quality factor in the variant description.
  2736.  
  2737.       qt The media type quality factor is 1 if there is no type
  2738.          attribute in the variant description.  Otherwise, it is the
  2739.          quality value assigned to this type by the configuration
  2740.          database.  If the database does not assign a value, then the
  2741.          factor is 0.
  2742.  
  2743.  
  2744.  
  2745.  
  2746. Holtman & Mutz                Experimental                     [Page 49]
  2747.  
  2748. RFC 2295            Transparent Content Negotiation           March 1998
  2749.  
  2750.  
  2751.       qc The charset quality factor is 1 if there is no charset
  2752.          attribute in the variant description.  Otherwise, it is the
  2753.          quality value assigned to this charset by the configuration
  2754.          database.  If the database does not assign a value, then the
  2755.          factor is 0.
  2756.  
  2757.       ql The language quality factor is 1 if there is no language
  2758.          attribute in the variant description.  Otherwise, it is the
  2759.          highest quality value the configuration database assigns to any
  2760.          of the languages listed in the language attribute.  If the
  2761.          database does not assign a value to any of the languages
  2762.          listed, then the factor is 0.
  2763.  
  2764.       qf The features quality factor is 1 if there is no features
  2765.          attribute in the variant description.  Otherwise, it is the
  2766.          quality degradation factor computed for the features attribute
  2767.          using the feature set of the current request.
  2768.  
  2769.       qa The quality adjustment factor is 0 if the variant description
  2770.          lists a media type - charset combination which is `forbidden'
  2771.          by the table, and 1 otherwise.
  2772.  
  2773.    As an example, if a variant list contains the variant description
  2774.  
  2775.      {"paper.2" 0.7 {type text/html} {language fr}}
  2776.  
  2777.    and if the configuration database contains the quality value
  2778.    assignments
  2779.  
  2780.      types:     text/html;q=1.0, type application/postscript;q=0.8
  2781.      languages: en;q=1.0, fr;q=0.5
  2782.  
  2783.    then the local variant selection algorithm will compute the overall
  2784.    quality for the variant description as follows:
  2785.  
  2786.      {"paper.2" 0.7 {type text/html} {language fr}}
  2787.                  |           |                 |
  2788.                  |           |                 |
  2789.                  V           V                 V
  2790.        round5 ( 0.7   *     1.0        *      0.5 ) = 0.35000
  2791.  
  2792.    With same configuration database, the variant list
  2793.  
  2794.      {"paper.1" 0.9 {type text/html} {language en}},
  2795.      {"paper.2" 0.7 {type text/html} {language fr}},
  2796.      {"paper.3" 1.0 {type application/postscript} {language en}}
  2797.  
  2798.    would yield the following computations:
  2799.  
  2800.  
  2801.  
  2802. Holtman & Mutz                Experimental                     [Page 50]
  2803.  
  2804. RFC 2295            Transparent Content Negotiation           March 1998
  2805.  
  2806.  
  2807.        round5 ( qs  * qt  * qc  * ql  * qf  * qa ) = Q
  2808.                 ---   ---   ---   ---   ---   ---
  2809.       paper.1:  0.9 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0  = 0.90000
  2810.       paper.1:  0.7 * 1.0 * 1.0 * 0.5 * 1.0 * 1.0  = 0.35000
  2811.       paper.3:  1.0 * 0.8 * 1.0 * 1.0 * 1.0 * 1.0  = 0.80000
  2812.  
  2813. 19.2 Determining the result
  2814.  
  2815.    Using all computed overall quality values, the end result of the
  2816.    local variant selection algorithm is determined as follows.
  2817.  
  2818.    If all overall quality values are 0, then the best variant is the
  2819.    fallback variant, if there is one in the list, else the result is the
  2820.    conclusion that none of the variants are acceptable.
  2821.  
  2822.    If at least one overall quality value is greater than 0, then the
  2823.    best variant is the variant which has the description with the
  2824.    highest overall quality value, or, if there are multiple variant
  2825.    descriptions which share the highest overall quality value, the
  2826.    variant of the first variant description in the list which has this
  2827.    highest overall quality value.
  2828.  
  2829. 19.3 Ranking dimensions
  2830.  
  2831.    Consider the following variant list:
  2832.  
  2833.      {"paper.greek"   1.0 {language el} {charset ISO-8859-7}},
  2834.      {"paper.english" 1.0 {language en} {charset ISO-8859-1}}
  2835.  
  2836.    It could be the case that the user prefers the language "el" over
  2837.    "en", while the user agent can render "ISO-8859-1" better than "ISO-
  2838.    8859-7".  The result is that in the language dimension, the first
  2839.    variant is best, while the second variant is best in the charset
  2840.    dimension.  In this situation, it would be preferable to choose the
  2841.    first variant as the best variant: the user settings in the language
  2842.    dimension should take precedence over the hard-coded values in the
  2843.    charset dimension.
  2844.  
  2845.    To express this ranking between dimensions, the user agent
  2846.    configuration database should have a higher spread in the quality
  2847.    values for the language dimension than for the charset dimension.
  2848.    For example, with
  2849.  
  2850.      languages: el;q=1.0, en-gb;q=0.7, en;q=0.6, da;q=0, ...
  2851.  
  2852.      charsets:  ISO-8859-1;q=1.0, ISO-8859-7;q=0.95,
  2853.                 ISO-8859-5;q=0.97, unicode-1-1;q=0, ...
  2854.  
  2855.  
  2856.  
  2857.  
  2858. Holtman & Mutz                Experimental                     [Page 51]
  2859.  
  2860. RFC 2295            Transparent Content Negotiation           March 1998
  2861.  
  2862.  
  2863.    the first variant will have an overall quality of 0.95000, while the
  2864.    second variant will have an overall quality 0.70000.  This makes the
  2865.    first variant the best variant.
  2866.  
  2867. 20 Appendix: feature negotiation examples
  2868.  
  2869.    This appendix contains examples of the use of feature tags in variant
  2870.    descriptions.  The tag names used here are examples only, they do not
  2871.    in general reflect the tag naming scheme proposed in [4].
  2872.  
  2873. 20.1 Use of feature tags
  2874.  
  2875.    Feature tags can be used in variant lists to express the quality
  2876.    degradation associated with the presence or absence of certain
  2877.    features.  One example is
  2878.  
  2879.      {"index.html.plain" 0.7 },
  2880.      {"index.html"       1.0 {features tables frames}}
  2881.  
  2882.    Here, the "{features tables frames}" part expresses that index.html
  2883.    uses the features tagged as tables and frames.  If these features are
  2884.    absent, the overall quality of index.html degrades to 0.  Another
  2885.    example is
  2886.  
  2887.      {"home.graphics" 1.0 {features !textonly}},
  2888.      {"home.textonly" 0.7 }
  2889.  
  2890.    where the "{features !textonly}" part expresses that home.graphics
  2891.    requires the absence of the textonly feature.  If the feature is
  2892.    present, the overall quality of home.graphics degrades to 0.
  2893.  
  2894.    The absence of a feature need not always degrade the overall quality
  2895.    to 0.  In the example
  2896.  
  2897.      {"x.html.1" 1.0 {features fonts;-0.7}}
  2898.  
  2899.    the absence of the fonts feature degrades the quality with a factor
  2900.    of 0.7.  Finally, in the example
  2901.  
  2902.       {"y.html" 1.0 {features [blebber wolx] }}
  2903.  
  2904.    The "[blebber wolx]" expresses that y.html requires the presence of
  2905.    the blebber feature or the wolx feature.  This construct can be used
  2906.    in a number of cases:
  2907.  
  2908.      1. blebber and wolx actually tag the same feature, but they were
  2909.         registered by different people, and some user agents say they
  2910.         support blebber while others say they support wolx.
  2911.  
  2912.  
  2913.  
  2914. Holtman & Mutz                Experimental                     [Page 52]
  2915.  
  2916. RFC 2295            Transparent Content Negotiation           March 1998
  2917.  
  2918.  
  2919.      2. blebber and wolx are HTML tags of different vendors which
  2920.         implement the same functionality, and which are used together in
  2921.         y.html without interference.
  2922.  
  2923.      3. blebber and wolx are HTML tags of different vendors which
  2924.         implement the same functionality, and y.html uses the tags in a
  2925.         conditional HTML construct.
  2926.  
  2927.      4. blebber is a complicated HTML tag with only a sketchy
  2928.         definition, implemented by one user agent vendor, and wolx
  2929.         indicates implementation of a well-defined subset of the blebber
  2930.         tag by some other vendor(s).  y.html uses only this well-defined
  2931.         subset.
  2932.  
  2933. 20.2 Use of numeric feature tags
  2934.  
  2935.    As an example of negotiation in a numeric area, the following variant
  2936.    list describes four variants with title graphics designed for
  2937.    increasing screen widths:
  2938.  
  2939.      {"home.pda"    1.0 {features screenwidth=[-199] }},
  2940.      {"home.narrow" 1.0 {features screenwidth=[200-599] }},
  2941.      {"home.normal" 1.0 {features screenwidth=[600-999] }},
  2942.      {"home.wide"   1.0 {features screenwidth=[1000-] }},
  2943.      {"home.normal"}
  2944.  
  2945.    The last element of the list specifies a safe default for user agents
  2946.    which do not implement screen width negotiation.  Such user agents
  2947.    will reject the first four variants as unusable, as they seem to rely
  2948.    on a feature which they do not understand.
  2949.  
  2950. 20.3 Feature tag design
  2951.  
  2952.    When designing a new feature tag, it is important to take into
  2953.    account that existing user agents, which do not recognize the new tag
  2954.    will treat the feature as absent.  In general, a new feature tag
  2955.    needs to be designed in such a way that absence of the tag is the
  2956.    default case which reflects current practice.  If this design
  2957.    principle is ignored, the resulting feature tag will generally be
  2958.    unusable.
  2959.  
  2960.    As an example, one could try to support negotiation between
  2961.    monochrome and color content by introducing a `color' feature tag,
  2962.    the presence of which would indicate the capability to display color
  2963.    graphics.  However, if this new tag is used in a variant list, for
  2964.    example
  2965.  
  2966.       {"rainbow.gif"      1.0 {features color} }
  2967.  
  2968.  
  2969.  
  2970. Holtman & Mutz                Experimental                     [Page 53]
  2971.  
  2972. RFC 2295            Transparent Content Negotiation           March 1998
  2973.  
  2974.  
  2975.       {"rainbow.mono.gif" 0.6 {features !color}}
  2976.  
  2977.    then existing user agents, which would not recognize the color tag,
  2978.    would all display the monochrome rainbow.  The color tag is therefore
  2979.    unusable in situations where optimal results for existing user agents
  2980.    are desired.  To provide for negotiation in this area, one must
  2981.    introduce a `monochrome' feature tag; its presence indicates that the
  2982.    user agent can only render (or the user prefers to view) monochrome
  2983.    graphics.
  2984.  
  2985. 21 Appendix: origin server implementation considerations
  2986.  
  2987. 21.1 Implementation with a CGI script
  2988.  
  2989.    Transparent content negotiation has been designed to allow a broad
  2990.    range of implementation options at the origin server side.  A very
  2991.    minimal implementation can be done using the CGI interface.  The CGI
  2992.    script below is an example.
  2993.  
  2994.       #!/bin/sh
  2995.  
  2996.       cat - <<'blex'
  2997.       TCN: list
  2998.       Alternates: {"stats.tables.html" 1.0 {type text/html} {features
  2999.       tables}}, {"stats.html" 0.8 {type text/html}}, {"stats.ps" 0.95
  3000.       {type application/postscript}}
  3001.       Vary: *
  3002.       Content-Type: text/html
  3003.  
  3004.       <title>Multiple Choices for Web Statistics</title>
  3005.       <h2>Multiple Choices for Web Statistics:</h2>
  3006.       <ul>
  3007.       <li><a href=stats.tables.html>Version with HTML tables</a>
  3008.       <p>
  3009.       <li><a href=stats.html>Version without HTML tables</a>
  3010.       <p>
  3011.       <li><a href=stats.ps>Postscript version</a>
  3012.       </ul>
  3013.       blex
  3014.  
  3015.    The Alternates header in the above script must be read as a single
  3016.    line.  The script always generates a list response with the 200 (OK)
  3017.    code, which ensures compatibility with non-negotiating HTTP/1.0
  3018.    agents.
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026. Holtman & Mutz                Experimental                     [Page 54]
  3027.  
  3028. RFC 2295            Transparent Content Negotiation           March 1998
  3029.  
  3030.  
  3031. 21.2 Direct support by HTTP servers
  3032.  
  3033.    Sophisticated HTTP servers could make a transparent negotiation
  3034.    module available to content authors.  Such a module could incorporate
  3035.    a remote variant selection algorithm and an implementation of the
  3036.    algorithm for generating choice responses (section 10.2).  The
  3037.    definition of interfaces to such modules is beyond the scope of this
  3038.    specification.
  3039.  
  3040. 21.3 Web publishing tools
  3041.  
  3042.    Web publishing tools could automatically generate several variants of
  3043.    a document (for example the original TeX version, a HTML version with
  3044.    tables, a HTML version without tables, and a Postscript version),
  3045.    together with an appropriate variant list in the interface format of
  3046.    a HTTP server transparent negotiation module.  This would allow
  3047.    documents to be published as transparently negotiable resources.
  3048.  
  3049. 22 Appendix: Example of choice response construction
  3050.  
  3051.    The following is an example of the construction of a choice response
  3052.    by a proxy cache which supports HTTP/1.1 and transparent content
  3053.    negotiation.  The use of the HTTP/1.1 conditional request mechanisms
  3054.    is also shown.
  3055.  
  3056.    Assume that a user agent has cached a variant list with the validator
  3057.    "1234" for the negotiable resource http://x.org/paper.  Also assume
  3058.    that it has cached responses from two neighboring variants, with the
  3059.    entity tags "gonkyyyy" and W/"a;b".  Assume that all three user agent
  3060.    cache entries are stale: they would need to be revalidated before the
  3061.    user agent can use them.  If http://x.org/paper accessed in this
  3062.    situation, the user agent could send the following request to its
  3063.    proxy cache:
  3064.  
  3065.      GET /paper HTTP/1.1
  3066.      Host: x.org
  3067.      User-Agent: WuxtaWeb/2.4
  3068.      Negotiate: 1.0
  3069.      Accept: text/html, application/postscript;q=0.4, */*
  3070.      Accept-Language: en
  3071.      If-None-Match: "gonkyyyy;1234", W/"a;b;1234"
  3072.  
  3073.    Assume that the proxy cache has cached the same three items as the
  3074.    user agent, but that it has revalidated the variant list 8000 seconds
  3075.    ago, so that the list is still fresh for the proxy.  This means that
  3076.    the proxy can run a remote variant selection algorithm on the list
  3077.    and the incoming request.
  3078.  
  3079.  
  3080.  
  3081.  
  3082. Holtman & Mutz                Experimental                     [Page 55]
  3083.  
  3084. RFC 2295            Transparent Content Negotiation           March 1998
  3085.  
  3086.  
  3087.    Assume that the remote algorithm is able to choose paper.html.en as
  3088.    the best variant.  The proxy can now construct a choice response,
  3089.    using the algorithm in section 10.2.  In steps 1 and 2 of the
  3090.    algorithm, the proxy can construct the following conditional request
  3091.    on the best variant, and send it to the origin server:
  3092.  
  3093.      GET /paper.html.en HTTP/1.1
  3094.      Host: x.org
  3095.      User-Agent: WuxtaWeb/2.4
  3096.      Negotiate: 1.0
  3097.      Accept: text/html, application/postscript;q=0.4, */*
  3098.      Accept-Language: en
  3099.      If-None-Match: "gonkyyyy", W/"a;b"
  3100.      Via: 1.1 fred
  3101.  
  3102.    On receipt of the response
  3103.  
  3104.      HTTP/1.1 304 Not Modified
  3105.      Date: Tue, 11 Jun 1996 20:05:31 GMT
  3106.      Etag: "gonkyyyy"
  3107.  
  3108.    from the origin server, the proxy can use its freshly revalidated
  3109.    paper.html.en cache entry to expand the response to a non-304
  3110.    response:
  3111.  
  3112.      HTTP/1.1 200 OK
  3113.      Date: Tue, 11 Jun 1996 20:05:31 GMT
  3114.      Content-Type: text/html
  3115.      Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT
  3116.      Content-Length: 5327
  3117.      Cache-control: max-age=604800
  3118.      Etag: "gonkyyyy"
  3119.      Via: 1.1 fred
  3120.      Age: 0
  3121.  
  3122.      <title>A paper about ....
  3123.  
  3124.    Using this 200 response, the proxy can construct a choice response
  3125.    in step 4 of the algorithm:
  3126.  
  3127.      HTTP/1.1 200 OK
  3128.      Date: Tue, 11 Jun 1996 20:05:31 GMT
  3129.      TCN: choice
  3130.      Content-Type: text/html
  3131.      Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT
  3132.      Content-Length: 5327
  3133.      Cache-control: max-age=604800
  3134.      Content-Location: paper.html.en
  3135.  
  3136.  
  3137.  
  3138. Holtman & Mutz                Experimental                     [Page 56]
  3139.  
  3140. RFC 2295            Transparent Content Negotiation           March 1998
  3141.  
  3142.  
  3143.      Alternates: {"paper.html.en" 0.9 {type text/html} {language en}},
  3144.                  {"paper.html.fr" 0.7 {type text/html} {language fr}},
  3145.                  {"paper.ps.en"   1.0 {type application/postscript}
  3146.                      {language en}}
  3147.  
  3148.      Etag: "gonkyyyy;1234"
  3149.      Vary: negotiate, accept, accept-language
  3150.      Expires: Thu, 01 Jan 1980 00:00:00 GMT
  3151.      Via: 1.1 fred
  3152.      Age: 8000
  3153.  
  3154.      <title>A paper about ....
  3155.  
  3156.    The choice response can subsequently be shortened to a 304 response,
  3157.    because of the If-None-Match header in the original request from the
  3158.    user agent.  Thus, the proxy can finally return
  3159.  
  3160.      HTTP/1.1 304 Not Modified
  3161.      Date: Tue, 11 Jun 1996 20:05:31 GMT
  3162.      Etag: "gonkyyyy;1234"
  3163.      Content-Location: paper.html.en
  3164.      Vary: negotiate, accept, accept-language
  3165.      Expires: Thu, 01 Jan 1980 00:00:00 GMT
  3166.      Via: 1.1 fred
  3167.      Age: 8000
  3168.  
  3169.    to the user agent.
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194. Holtman & Mutz                Experimental                     [Page 57]
  3195.  
  3196. RFC 2295            Transparent Content Negotiation           March 1998
  3197.  
  3198.  
  3199. 23 Full Copyright Statement
  3200.  
  3201.    Copyright (C) The Internet Society (1998).  All Rights Reserved.
  3202.  
  3203.    This document and translations of it may be copied and furnished to
  3204.    others, and derivative works that comment on or otherwise explain it
  3205.    or assist in its implementation may be prepared, copied, published
  3206.    and distributed, in whole or in part, without restriction of any
  3207.    kind, provided that the above copyright notice and this paragraph are
  3208.    included on all such copies and derivative works.  However, this
  3209.    document itself may not be modified in any way, such as by removing
  3210.    the copyright notice or references to the Internet Society or other
  3211.    Internet organizations, except as needed for the purpose of
  3212.    developing Internet standards in which case the procedures for
  3213.    copyrights defined in the Internet Standards process must be
  3214.    followed, or as required to translate it into languages other than
  3215.    English.
  3216.  
  3217.    The limited permissions granted above are perpetual and will not be
  3218.    revoked by the Internet Society or its successors or assigns.
  3219.  
  3220.    This document and the information contained herein is provided on an
  3221.    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  3222.    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  3223.    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  3224.    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  3225.    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250. Holtman & Mutz                Experimental                     [Page 58]
  3251.  
  3252.