view Side-By-Side changes
HTTP Working Group Koen Holtman, TUE Internet-Draft Andrew Mutz, Hewlett-Packard Expires:September 9,November 26, 1997March 9,May 26, 1997 Transparent Content Negotiation in HTTPdraft-ietf-http-negotiation-01.txtdraft-ietf-http-negotiation-02.txt STATUS OF THIS MEMO This document is an Internet-Draft. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress". To learn the current status of any Internet-Draft, please check the "1id-abstracts.txt" listing contained in the Internet-Drafts Shadow Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe), munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast). Distribution of this document is unlimited. Please send comments to the HTTP working group at <http-wg@cuckoo.hpl.hp.com>. Discussions of the working group are archived at <URL:http://www.ics.uci.edu/pub/ietf/http/>. General discussions about HTTP and the applications which use HTTP should take place on the <www-talk@w3.org> mailing list. HTML and change bar versions of this document, are available at <URL:http://gewis.win.tue.nl/~koen/conneg/>. ABSTRACT HTTP allows web site authors to put multiple versions of the same information under a single URL. Transparent content negotiation is a mechanism, layered on top of HTTP, for automatically selecting the best version when the URL is accessed. This enables the smooth deployment of new web data formats and markup tags. OVERVIEW OF THE TRANSPARENT CONTENT NEGOTIATION DOCUMENT SET An up-to-date overview of documents related to transparent content negotiation is maintained on the web page <URL:http://gewis.win.tue.nl/~koen/conneg/>. The transparent content negotiation document set currently consists of three series of internet drafts. 1. draft-ietf-http-negotiation-XX.txt (this document) `Transparent Content Negotiation in HTTP' Defines the core mechanism. Standards track. 2. draft-ietf-http-rvsa-v10-XX.txt `HTTP Remote Variant Selection Algorithm -- RVSA/1.0' Defines the remote variant selection algorithm version 1.0. Standards track. 3. draft-ietf-http-feature-reg-XX.txt `Feature Tag Registration Procedures' Defines feature tag registration. Best Current Practice track. An additional document about `the core feature set', which may later become an informational RFC, may also appear. Currently, there are two internet drafts which discuss parts of what could be a core feature set: draft-mutz-http-attributes-XX.txt and draft-goland-http-headers-XX.txt Older versions of the text in documents 1 and 2 may be found in the draft-holtman-http-negotiation-XX.txt series of internet drafts. TABLE OF CONTENTS 1 Introduction 1.1 Background 1.2 Revision history 2 Terminology 2.1 Terms from HTTP/1.1 2.2 New terms 3 Notation 4 Overview 4.1 Content negotiation 4.2 HTTP/1.0 style negotiation scheme 4.3 Transparent content negotiation scheme 4.4 Optimizing the negotiation process 4.5 Downwards compatibility with non-negotiating user agents 4.6 Retrieving a variant by hand 4.7 Dimensions of negotiation 4.8 Feature negotiation 4.9 Length of variant lists 4.10 Relation with other negotiation schemes 5 Variant descriptions 5.1 Syntax 5.2 URI 5.3 Source-quality 5.4 Type, charset, language, and length 5.5 Features 5.6 Description 5.7 Extension-attribute 6 Feature negotiation 6.1 Feature tags 6.1.1 Feature tag values 6.2Accept-Features headerFeature sets 6.3 Feature predicates 6.4 Features attribute 7 Remote variant selection algorithms 7.1 Version numbers 8 Content negotiation status codes and headers 8.1 506 Variant Also Negotiates 8.2 Accept-Charset 8.3 Accept-Features 8.4 Alternates 8.5 Content-Features 8.6 Negotiate 8.7 TCN 8.8 Variant-Vary 9 Cache validators 9.1 Variant list validators 9.2 Structured entity tags 9.3 Assigning entity tags to variants 10 Content negotiation responses 10.1 List response 10.2 Choice response 10.3Ad hocAdhoc response 10.4 Reusing the Alternates header 10.5 Extracting a normal response from a choice response 10.6 Elaborate Vary headers 10.6.1 Construction of an elaborate Vary header 10.6.2 Caching of an elaborate Vary header 10.7 Adding an Expires header to ensure HTTP/1.0 compatibility 10.8 Negotiation on content encoding 11 User agent support for transparent negotiation 11.1 Handling of responses 11.2 Presentation of a transparently negotiated resource 12 Origin server support for transparent negotiation 12.1 Requirements 12.2 Negotiation on transactions other than GET and HEAD 13 Proxy support for transparent negotiation 14 Security and privacy considerations 14.1 Accept- headers revealing information of a private nature 14.2 Spoofing of responses from variant resources 15 Acknowledgments 16 References 17 Authors' addresses 18 Appendix: Example of a local variant selection algorithm 18.1 Computing overall quality values 18.2 Determining the result 18.3 Ranking dimensions 19 Appendix: feature negotiation examples18.119.1 Use of feature tags18.219.2 Use of numeric feature tags18.319.3 Feature tag design1920 Appendix: origin server implementation considerations19.120.1 Implementation with a CGI script19.220.2 Direct support by HTTP servers19.320.3 Web publishing tools2021 Appendix: Example of choice response construction 1 Introduction HTTP allows web site authors to put multiple versions of the same information under a single URI. Each of these versions is called a `variant'. Transparent content negotiation is a mechanism for automatically and efficiently retrieving the best variant when a GET or HEAD request is made. This enables the smooth deployment of new web data formats and markup tags. This specification defines transparent content negotiation as an extension on top of the HTTP/1.1 protocol [1]. However, use of this extension does not require use of HTTP/1.1: transparent content negotiation can also be done if some or all of the parties are HTTP/1.0 [3] systems. Transparent content negotiation is called `transparent' because it makes all variants which exist inside the origin server visible to outside parties. Note: Though this specification is limited to negotiation on HTTP transactions, elements of this specification could also be used in other contexts. For example, feature predicates could be used in conditional HTML, and variant descriptions could be used in multipart mail messages. Such use in other contexts is encouraged. 1.1 Background The addition of content negotiation to the web infrastructure has been considered important since the early days of the web. Among the expected benefits of a sufficiently powerful system for content negotiation are * smooth deployment of new data formats and markup tags will allow graceful evolution of the web * eliminating the need to choose between a `state of the art multimedia homepage' and one which can be viewed by all web users * enabling good service to a wider range of browsing platforms (from low-end PDA's to high-end VR setups) * eliminating error-prone and cache-unfriendly User-Agent based negotiation * enabling construction of sites without `click here for the X version' links * internationalization, and the ability to offer multi-lingual content without a bias towards one language. 1.2 Revision history Majorsemanticalchanges in this version are: -The TCN headerExplanatory text about the length of variant lists and about the relation with other negotiation schemes has beenintroducedadded. - In order toreducemake therequirements in section 10 onvariant description definitions more accessible other groups who want to re-use this metadata format, - an appendix with an example of a local variant selection algorithm has been added - theusedescription ofexisting HTTP/1.1 headers andfeature negotiation has been made independent of HTTP concepts: it no longer relies on theAlternatesHTTP-specific Accept-Features header.This reduction in requirements should- To make it easier touse these headers in otherfuture negotiation schemes to re-use the transparent content negotiation transport/caching infrastructure, and to make it easier for protocols which work on top of transparent content negotiation to override parts of the transparent content negotiationschemes.requirements temporarily, -Thethe requirement thatproxies filter out illegal choice responsesan Alternates header is always included in a negotiated response has beenremoved. Many small errors have been corrected,dropped - the vocabulary of the Negotiate and TCN headers has been expanded to accommodate new types of variant selection - a `server-side override' mode has been added. In addition, some existing text has been improved. 2 Terminology 2.1 Terms from HTTP/1.1 This specification mostly uses the terminology of the HTTP/1.1 specification [1]. The definitions below were reproduced from [1]. request An HTTP request message. response An HTTP response message. resource A network data object or service that can be identified by a URI. Resources may be available in multiple representations (e.g. multiple languages, data formats, size, resolutions) or vary in other ways. content negotiation The mechanism for selecting the appropriate representation when servicing a request. variant A resource may have one, or more than one, representation(s) associated with it at any given instant. Each of these representations is termed a `variant.' Use of the term `variant' does not necessarily imply that the resource is subject to content negotiation. client A program that establishes connections for the purpose of sending requests. user agent The client which initiates a request. These are often browsers, editors, spiders (web-traversing robots), or other end user tools. server An application program that accepts connections in order to service requests by sending back responses. Any given program may be capable of being both a client and a server; our use of these terms refers only to the role being performed by the program for a particular connection, rather than to the program's capabilities in general. Likewise, any server may act as an origin server, proxy, gateway, or tunnel, switching behavior based on the nature of each request. origin server The server on which a given resource resides or is to be created. proxy An intermediary program which acts as both a server and a client for the purpose of making requests on behalf of other clients. Requests are serviced internally or by passing them on, with possible translation, to other servers. A proxy must implement both the client and server requirements of this specification. age The age of a response is the time since it was sent by, or successfully validated with, the origin server. fresh A response is fresh if its age has not yet exceeded its freshness lifetime. 2.2 New terms transparently negotiable resource A resource, identified by a single URI, which has multiple representations (variants) associated with it. When servicing a request on its URI, it allows selection of the best representation using the transparent content negotiation mechanism. A transparently negotiable resource always has a variant list bound to it, which can be represented as an Alternates header. variant list A list containing variant descriptions, which can be bound to a transparently negotiable resource. variant description A machine-readable description of a variant resource, usually found in a variant list. A variant description contains the variant resource URI and various attributes which describe properties of the variant. Variant descriptions are defined in section 5. variant resource A resource from which a variant of a negotiable resource can be retrieved with a simple GET request. neighboring variant A variant resource is called a neighboring variant resource of some transparently negotiable HTTP resource if the variant resource has a HTTP URL, and if the absolute URL of the variant resource up to its last slash equals the absolute URL of the negotiable resource up to its last slash, where equality is determined with the URI comparison rules in section 3.2.3 of [1]. The property of being a neighboring variant is important because of security considerations (section 14.2). Not all variants of a negotiable resource need to be neighboring variants. However, access to neighboring variants can be more highly optimized by the use of remote variant selection algorithms (section 7) and choice responses (section 10.2). remote variant selection algorithm A standardized algorithm by which a server can sometimes choose a best variant on behalf of a negotiating user agent. The algorithm typically computes whether the Accept- headers in the request contain sufficient information to allow a choice, and if so, which variant is the best variant. The use of a remote algorithm can speed up the negotiation process. list response A list responsecontainsreturns the variant list of the negotiable resource, but no variant data. Itiscan be generated when the server does not(perhaps cannot) choosewant to, or is not allowed to, return a particular best variant for the request. List responses are defined in section 10.1. choice response A choice responsecontains both the variant list of the negotiable resource andreturns a representation of the best variant for therequest.request, and may also return the variant list of the negotiable resource. It can be generated when the server has sufficient information to be able to choose the best variant on behalf the user agent, but may only be generated if this best variant is a neighboring variant. Choice responses are defined in section 10.2.ad hocadhoc response Anad hocadhoc responsecontains the variant list of the negotiable resource, and any other data the origin server wants to send. Itcan begeneratedsent by an origin server asa responsean extreme measure, to achieve compatibility with a non-negotiatinguser agentor buggy client if this compatibility cannot be achieved by sending a list or choice response. There are very little requirements on theserver does not (perhaps cannot) choose any particular variant. Ad hoccontents of an adhoc response. Adhoc responses are defined in section 10.3. Accept- headers The request headers: Accept, Accept-Charset, Accept-Language, and Accept-Features. supports transparent content negotiation From the viewpoint of an origin server or proxy, a user agent supports transparent content negotiation if and only if it sends a Negotiate header (section 8.6) which indicates such support. server-side override If a request on a transparently negotiated resource is made by a client which supports transparent content negotiation, an origin server is said to perform a server-side override if the server ignores the directives in the Negotiate request header, and instead uses a custom algorithm to choose an appropriate response. A server-side override can sometimes be used to work around known client bugs. It could also be used by protocol extensions on top of transparent content negotiation. 3 Notation The notation [## ... ##] in this document encloses an editorial comment. Such a comment will be either removed or replaced by real text in the final version of this document. The version of BNF used in this document is taken from [1], and many of the nonterminals used are defined in [1]. One new BNF construct is added: 1%rule stands for one or more instances of "rule", separated by whitespace: 1%rule = rule *( 1*LWS rule ) This specification also introduces number = 1*DIGIT short-float = 1*3DIGIT [ "." 0*3DIGIT ] This specification uses the same conventions as in [1] (see section 1.2 of [1]) for defining the significance of each particular requirement. 4 Overview This section gives an overview of transparent content negotiation. It starts with a more general discussion of negotiation as provided by HTTP. 4.1 Content negotiation HTTP/1.1 allows web site authors to put multiple versions of the same information under a single resource URI. Each of these versions is called a `variant'. For example, a resource http://x.org/paper could bind to three different variants of a paper: 1. HTML, English 2. HTML, French 3. Postscript, English Content negotiation is the process by which the best variant is selected if the resource is accessed. The selection is done by matching the properties of the available variants to the capabilities of the user agent and the preferences of the user. It has always been possible under HTTP to have multiple representations available for one resource, and to return the most appropriate representation for each subsequent request. However, HTTP/1.1 is the first version of HTTP which has provisions for doing this in a cache-friendly way. These provisions include the Vary response header, entity tags, and the If-None-Match request header. 4.2 HTTP/1.0 style negotiation scheme The HTTP/1.0 protocol elements allow for a negotiation scheme as follows: Server _____ proxy _____ proxy _____ user x.org cache cache agent < ---------------------------------- | GET http://x.org/paper | Accept- headers choose | ---------------------------------- > Best variant When the resource is accessed, the user agent sends (along with its request) various Accept- headers which express the user agent capabilities and the user preferences. Then the origin server uses these Accept- headers to choose the best variant, which is returned in the response. The biggest problem with this scheme is that it does not scale well. For all but the most minimal user agents, Accept- headers expressing all capabilities and preferences would be very large, and sending them in every request would be hugely inefficient, in particular because only a small fraction of the resources on the web have multiple variants. 4.3 Transparent content negotiation scheme The transparent content negotiation scheme eliminates the need to send huge Accept- headers, and nevertheless allows for a selection process that always yields either the best variant, or an error message indicating that user agent is not capable of displaying any of the available variants. Under the transparent content negotiation scheme, the server sends a list with the available variants and their properties to the user agent. An example of a list with three variants is{"paper.html.en"{"paper.1" 0.9 {type text/html} {language en}},{"paper.html.fr"{"paper.2" 0.7 {type text/html} {language fr}},{"paper.ps.en"{"paper.3" 1.0 {type application/postscript} {language en}} The syntax and semantics of the variant descriptions in this list are covered in section 5. When the list is received, the user agent can choose the best variant and retrieve it. Graphically, the communication can be represented as follows: Server _____ proxy _____ proxy _____ user x.org cache cache agent < ---------------------------------- | GET http://x.org/paper | ----------------------------------- > [list response] return of list | choose | < ---------------------------------- | GEThttp://x.org/paper.html.enhttp://x.org/paper.1 | ---------------------------------- > [normal response] return ofhtml.enpaper.1 The first response returning the list of variants is called a `list response'. The second response is a normal HTTP response: it does not contain special content negotiation related information. Only the user agent needs to know that the second request actually retrieves a variant. For the other parties in the communication, the second transaction is indistinguishable from a normal HTTP transaction. With this scheme, information about capabilities and preferences is only used by the user agent itself. Therefore, sending such information in large Accept- headers is unnecessary. Accept- headers do have a limited use in transparent content negotiation however; the sending of small Accept- headers can often speed up the negotiation process. This is covered in section 4.4. List responses are covered in section 10.1. As an example, the list response in the above picture could be: HTTP/1.1 300 Multiple Choices Date: Tue, 11 Jun 1996 20:02:21 GMT TCN: list Alternates:{"paper.html.en"{"paper.1" 0.9 {type text/html} {language en}},{"paper.html.fr"{"paper.2" 0.7 {type text/html} {language fr}},{"paper.ps.en"{"paper.3" 1.0 {type application/postscript} {language en}} Vary: negotiate, accept, accept-language ETag: "blah;1234" Cache-control: max-age=86400 Content-Type: text/html Content-Length: 227 <h2>Multiple Choices:</h2> <ul> <li><ahref=paper.html.en>HTML,href=paper.1>HTML, English version</a> <li><ahref=paper.html.fr>HTML,href=paper.2>HTML, French version</a> <li><ahref=paper.ps.en>Postscript,href=paper.3>Postscript, English version</a> </ul> The Alternates header in the response contains the variant list. The Vary header is included to ensure correct caching by plain HTTP/1.1 caches (see section 10.6). The ETag header allows the response to be revalidated by caches, the Cache-Control header controls this revalidation. The HTML entity included in the response allows the user to select the best variant by hand if desired. 4.4 Optimizing the negotiation process The basic transparent negotiation scheme involves two HTTP transactions: one to retrieve the list, and a second one to retrieve the chosen variant. There are however several ways to `cut corners' in the data flow path of the basic scheme. First, caching proxies can cache both variant lists and variants. Such caching can reduce the communication overhead, as shown in the following example: Server _____ proxy _____ proxy __________ user x.org cache cache agent < -------------- | GET ../paper | has the list in cache | ------------- > [list response] list | | choose | < -------------------------- | GET../paper.html.en../paper.1 | has the variant in cache | -------------------------- > [normal response] return ofhtml.enpaper.1 Second, the user agent can send small Accept- headers, which may contain enough information to allow the server to choose the best variant and return it directly. Server _____ proxy _____ proxy _____ user x.org cache cache agent < ---------------------------------- | GET http://x.org/paper | small Accept- headers | able to choose on behalf of user agent | ---------------------------------- > [choice response] return ofhtml.enpaper.1 and list This choosing based on small Accept- headers is done with a `remote variant selection algorithm'. Such an algorithm takes the variant list and the Accept- headers as input. It then computes whether the Accept- headers contain sufficient information to choose on behalf of the user agent, and if so, which variant is the best variant. If the best variant is a neighboring variant, it may be returned, together with the variant list, in a choice response. A server may only choose on behalf of a user agent supporting transparent content negotiation if the user agent explicitly allows the use of a particular remote variant selection algorithm in the Negotiate request header. User agents with sophisticated internal variant selection algorithms may want to disallow a remote choice, or may want to allow it only when retrieving inline images. If the local algorithm of the user agent is superior in only some difficult areas of negotiation, it is possible to enable the remote algorithm for the easy areas only. More information about the use of a remote variant selection algorithm can be found in [5]. Choice responses are covered in section 10.2. For example, the choice response in the above picture could be: HTTP/1.1 200 OK Date: Tue, 11 Jun 1996 20:05:31 GMT TCN: choice Content-Type: text/html Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT Content-Length: 5327 Cache-control: max-age=604800 Content-Location: paper.html.en Alternates:{"paper.html.en"{"paper.1" 0.9 {type text/html} {language en}},{"paper.html.fr"{"paper.2" 0.7 {type text/html} {language fr}},{"paper.ps.en"{"paper.3" 1.0 {type application/postscript} {language en}} Etag: "gonkyyyy;1234" Vary: negotiate, accept, accept-language Expires: Thu, 01 Jan 1980 00:00:00 GMT <title>A paper about .... Finally, the above two kinds of optimization can be combined; a caching proxy which has the list will sometimes be able to choose on behalf of the user agent. This could lead to the following communication pattern: Server _____ proxy _____ proxy __________ user x.org cache cache agent < --------------- | GET ../paper | small Accept | able to choose on behalf | < ---------- | GET../paper.html.en../paper.1 | ---------- > [normal response] html.en | ---------------- > [choice response]html.enpaper.1 and list Note that this cutting of corners not only saves bandwidth, it also eliminates delays due to packet round trip times, and reduces the load on the origin server. 4.5 Downwards compatibility with non-negotiating user agents To handle requests from user agents which do not support transparent content negotiation, this specification allows the origin server to revert to a HTTP/1.0 style negotiation scheme. The specification of heuristics for such schemes is beyond the scope of this document. 4.6 Retrieving a variant by handIf a transparently negotiated resourceIt isaccessed, thealways possible for a user agentwill always at some point receiveto retrieve the variant listof available variants.which is bound to a negotiable resource. The user agent can use this list to make available a menu of all variants and their characteristics to the user. Such a menu allows the user to randomly browse other variants, and makes it possible to manually correct any sub-optimal choice made by the automatic negotiation process. 4.7 Dimensions of negotiation Transparent content negotiation defines four dimensions of negotiation: 1. Media type (MIME type) 2. Charset 3. Language 4. Features The first three dimensions have traditionally been present in HTTP. The fourth dimension is added by this specification. Additional dimensions, beyond the four mentioned above, could be added by future specifications. Negotiation on the content encoding of a response (gzipped, compressed, etc.) is left outside of the realm of transparent negotiation. See section 10.8 for more information. 4.8 Feature negotiation Feature negotiation intends to provide for all areas of negotiation not covered by the type, charset, and language dimensions. Examples are negotiation on * HTML extensions * Extensions of other media types * Color capabilities of the user agent * Screen size * Output medium (screen, paper, ...) * Preference for speed vs. preference for graphical detail The feature negotiation framework (section 6) is the principal means by which transparent negotiation offers extensibility; a new dimension of negotiation (really a sub-dimension of the feature dimension) can be added without the need for a new standards effort by the simple registration of a `feature tag'. Feature tag registration is discussed in [4].5 Variant descriptions 5.1 Syntax A4.9 Length of variantcanlists As a general rule, variant lists should bedescribed inshort: it is expected that amachine-readable waytypical transparently negotiable resource will have 2 to 10 variants, depending on its purpose. Variant lists should be short for a number of reasons: 1. The user must be able to pick a variant by hand to correct a bad automatic choice, and this is more difficult with a long variantdescription. variant-description = "{" <">list. 2. A large number of variants will decrease the efficiency of internet proxy caches. 3. Long variant lists will make some transparently negotiated responses longer. In general, it is not desirable to create a transparently negotiable resource with hundreds of variants in order to fine-tune the graphical presentation of a resource. Any graphical fine-tuning should be done, as much as possible, by using constructs which act at the user agent side, for example <center><img src=titlebanner.gif width=100% alt="MegaBozo Corp"></center> In order to promote user agent side fine tuning, which is more scalable than fine tuning over the network, user agents which implement a scripting language for content rendering are encouraged to make the availability of this language visible for transparent content negotiation, and to allow rendering scripts to access the capabilities and preferences data used for content negotiation, as far as privacy considerations permit this. 4.10 Relation with other negotiation schemes The HTTP/1.x protocol suite allows for many different negotiation mechanisms. Transparent content negotiation specializes in scalable, interoperable negotiation of content representations at the HTTP level. It is intended that transparent negotiation will co-exist with other negotiation schemes, both open and proprietary, which cover different application domains or work at different points in the author-to-user chain. Ultimately, it will be up to the resource author to decide which negotiation mechanism, or combination of negotiation mechanisms, is most appropriate for the task at hand. As far as the relation with other negotiation mechanisms is concerned, two parts of this specification are particularly important: 1. the syntax and semantics of variant descriptions (section 5-6) 2. the transport and caching protocol for negotiated data (section 8-10) This specification explicitly encourages other negotiation mechanisms to re-use both parts. 5 Variant descriptions 5.1 Syntax A variant can be described in a machine-readable way with a variant description. variant-description = "{" <"> URI <"> source-quality *variant-attribute"}" source-quality = qvalue variant-attribute = "{" "type" media-type "}" | "{" "charset" charset "}" | "{" "language" 1#language-tag "}" | "{" "length" 1*DIGIT "}" | "{" "features" feature-list "}" | "{" "description" quoted-string "}" | extension-attribute [##Note: Should we define shorter alternate versions for the above keywords, like "t" for "type" and "f" for "features"?##] extension-attribute = "{" extension-name extension-value "}" extension-name = token extension-value = *( token | quoted-string | LWS | extension-specials ) extension-specials = <any element of tspecials except <"> and "}"> Examples are{"paper.html.fr"{"paper.2" 0.7 {type text/html} {language fr}}{"paper.html.tables"{"paper.5" 0.9 {type text/html} {features tables}}{"paper.html.en"}{"paper.1" 0.001} The various attributes which can be present in a variant description are covered in the subsections below. Each attribute may appear only once in a variant description. 5.2 URI The URI attribute gives the URI of the resource from which the variant can be retrieved with a GET request. It can be absolute or relative to the Request-URI. The variant resource may vary (on the Cookie request header, for example), but MUST NOT engage in transparent content negotiation itself. 5.3 Source-quality The source-quality attribute gives the quality of the variant, as a representation of the negotiable resource, when this variant is rendered with a perfect rendering engine on the best possible output medium. If the source-quality is less than 1, it often expresses a quality degradation caused by a lossy conversion to a particular data format. For example, a picture originally in JPEG form would have a lower source quality when translated to the XBM format, and a much lower source quality when translated to an ASCII-art variant. Note however, that degradation is a function of the source; an original piece of ASCII-art may degrade in quality if it is captured in JPEG form. The source-quality could also represent a level of quality caused by skill of language translation, or ability of the used media type to capture the intended artistic expression. It is important that content providers do not assign very low source quality values without good reason, as this would limit the ability of users to influence the negotiation process with their own preference settings. The following table SHOULD be used as a guide when assigning source quality values: 1.000 perfect representation 0.900 threshold of noticeable loss of quality 0.800 noticeable, but acceptable quality reduction 0.500 barely acceptable quality 0.300 severely degraded quality 0.000 completely degraded quality Note that most meaningful values in this table are close to 1. This is due to the fact that quality factors are generally combined by multiplying them, not by adding them. When assigning source-quality values, content providers MUST NOT account for the size of the variant and its impact on transmission and rendering delays. Any constant rendering delay for a particular media type (for example due to the startup time of a helper application) SHOULD be accounted for by the user agent, when assigning a quality factor to that media type. 5.4 Type, charset, language, and length The type attribute of a variant description carries the same information as its Content-Type response header counterpart defined in [1], except for any charset information, which MUST be carried in the charset attribute. For, example, the header Content-Type: text/html; charset=ISO-8859-4 has the counterpart attributes {type text/html} {charset ISO-8859-4} The language and length attributes carry the same information as their Content-* response header counterparts in [1]. The length attribute, if present, MUST thus reflect the length of the variant alone, and not the total size of the variant and any objects inlined or embedded by the variant. Though all of these attributes are optional, it is often desirable to include as many attributes as possible, as this will increase the quality of the negotiation process. Note: A server is not required to maintain a one-to-one correspondence between the attributes in the variant description and the Content-* headers in the variant response. For example, if the variant description contains a language attribute, the response does not necessarily have to contain a Content-Language header. If a Content-Language header is present, it does not have to contain an exact copy of the information in the language attribute. 5.5 Features The features attribute specifies how the presence or absence of particular feature tags in the user agent affects the overall quality of the variant. This attribute is covered in section 6.4. 5.6 Description The description attribute gives a textual description of the variant. It can be included if the URI and normal attributes of a variant are considered too opaque to allow interpretation by the user. If a user agent is showing a menu of available variants compiled from a variant list, and if a variant has a description attribute, the user agent SHOULD show the description attribute of the variant instead of showing the normal attributes of the variant. The description field uses the UTF-8 charset (which is a superset of US-ASCII) with ""%" HEX HEX" encoding. [##Todo: add reference to UTF-8##] 5.7 Extension-attribute The extension-attribute allows future specifications to incrementally define new dimensions of negotiation, and eases content negotiation experiments. In experimental situations, servers MUST ONLY generate extension-attributes whose names start with "x-". User agents SHOULD ignore all extension attributes they do not recognize. Proxies MUST NOT run a remote variant selection algorithm if an unknown extension attribute is present in the variant list. 6 Feature negotiation This section defines the feature negotiation mechanism. Feature negotiation has been introduced in section 4.8. Appendix1819 contains examples of feature negotiation. 6.1 Feature tags A feature tag (ftag) identifies something which can be negotiated on, for example a property (feature) of a representation, a capability (feature) of a useragentagent, orathe preference of auser. Auser for a particular type of representation. The use of featureis saidtags need not be limited to transparent content negotiation, and not every feature tag needs to be`present'usable ina user agent ifthecorresponding capability is implemented, or if the user has expressed corresponding preference.HTTP transparent content negotiation framework. ftag = 1*<any CHAR except CTLs or tspecials or "!"> tspecials = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT (tspecials definition reproduced from [1]) Feature tag comparison is case-insensitive. Examples are tables, fonts, blebber, wolx, screenwidth, colordepth An example of the use of feature tags in a variant description is: {"index.html" 1.0 {type text/html} {features tables frames}} This specification follows general computing practice in that it places no restrictions on what may be called a feature. Featuretags are case-insensitive. The definitiontag definitions SHOULD describe the tag from the viewpoint of the variant author. For example, a definition could start with `the X feature tagmay state that alabels variants which are intended for...'. At the protocol level, this specification does not distinguish between different uses of featuretag, if present, can have associated withtags: a tag will be processed in the same way, no matter whether itone or more values which reflectidentifies aparticular capabilityproperty, capability, or preference. Forexample, a feature tag `paper' could be present with the values `A4' and `A5'. Note that contextsome tags, it maydeterminebe fluid whethera featurethe tagexpressesrepresents acapabilityproperty, preference, or capability. For example, in content negotiation on web pages, apreference. The `textonly'"textonly" tagis naturally present forwould identify a capability of a text-only user agent, but the user of a graphical user agentcould set themay use this tag tobe present ifspecify that text-only content is preferredtoover graphical content.As feature registration [4] willWhile the usage of some tags may bean ongoing process,fluid, it isgenerally not possible forexpected that other tag definitions will strictly limit the usage of auser agenttag toknowexpressing a property, capability, or preference only. However, themeaningprotocol does not contain any facilities which could enforce such limitations. 6.1.1 Feature tag values The definition ofalla featuretags it can possibly encounter intag may state that avariant description. A user agent SHOULD treat all features with tags unknown to it as absent. 6.2 Accept-Features header The Accept-Features request headerfeature tag canbe used by a client to give information about the presencehave zero, one, orabsencemore values associated with it. These values specialize the meaning ofcertain features. Accept-Features = "Accept-Features" ":" #( feature-expr *( ";" feature-extension ) ) feature-expr = [ "!" ] ftag | ftag [ "!" ] "=" tag-value | ftag "=" "{" tag-value "}" | ftag "<=" number | ftag "=" "<" numeric-range ">" | "*"the tag. For example, a feature tag `paper' could be associated with the values `A4' and `A5'. tag-value = token | quoted-stringnumeric-range = [ number ] "-" [ number ] feature-extension = token [ "=" ( token | quoted-string ) ] TagEquality comparison for tag values MUST becompared case-insensitively, anddone with a case-sensitive, octet-by-octet comparison, where any ""%" HEX HEX" encodings MUST be processed as in [1]. A token value XYZ is equal to a quoted-string value "XYZ".No feature extensions are defined in this specification. An example is: Accept-Features: blex, !blebber, colordepth<=5, !screenwidth, UA-media={stationary}, paper = a4, paper!="a0", x_version=<100-205>, *6.2 Feature sets Thedifferentfeatureexpressions have the following meaning: ftag ftag is present !ftag ftag is absent ftag=V ftagset of a user agent ispresent witha data structure which records thevalue V (it may also be present with other values) ftag!=V ftag is present, but not withcapabilities of thevalue V ftag={V} ftag is present withuser agent and thevalue V,andnot with any other values ftag<=N ftag is present withpreferences of thenumeric values from 0 up to and including N, and not with any other values ftag=<N-M> ftaguser. Structurally, a feature set is a, possibly empty, set of feature tags. If a feature tag is presentwithin thenumericset, this means that the user agent implements the corresponding capability, or that the user has expressed the corresponding preference. Each feature tag in a feature set has a, possibly empty, set of valuesfrom N up to and including M, and notassociated withany other values.it. IfN is missing,thelower boundvalue set of a feature tag T has the value V in it, it is0. If Msaid that `the tag T ismissing,present with theupper boundvalue V'. This specification does not define a standard notation for feature sets. An example of a very small feature set, in a mathematical notation, isinfinity. * makes true all{ ( "frames" , { } ) , ( "paper" , { "A4" , "A5" } ) } As featurepredicates (section 6.3) which wereregistration [4] will be an ongoing process, it is generally notassigned truth values by other elements ofpossible for a user agent to know theheader Absencemeaning ofthe Accept-Features headerall feature tags it can possibly encounter in arequest is equivalentvariant description. A user agent SHOULD treat all features tags unknown to it as absent from its feature set. A user agent may change theinclusioncontents ofAccept-Features: *its feature set depending on the type of request, and may also update it to reflect changing conditions, for example a change in the window size. Therefore, when considering feature negotiation, one usually talks about `the feature set of the current request'. 6.3 Feature predicates Feature predicates areused inpredicates on the contents of the feature set of the current request. They appear in the features attribute of a variant description. fpred = [ "!" ] ftag | ftag [ "!" ] "=" tag-value | ftag "=""<""[" numeric-range "]" numeric-range = [ number ] "-" [ number ] [##Note: the earlier range notation, with ranges like `<0-10>', was revised because this notation would make it hard to embed variant descriptions in HTML documents: the ">" would prematurely end a <META ...> tag when parsed by some older browsers.##] Examples of feature predicates are blebber, !blebber, paper=a4, colordepth=5, blex!=54,dpi=<300-599>, colordepth=<24-> A server can computedpi=[300-599], colordepth=[24-] Using thetruth value of afeaturepredicate by using the knowledge gained from the Accept-Features header inset of the currentrequest. Therequest, a user agent SHOULD compute the truth valueMUST be assigned as follows, depending on the formof thepredicate:different feature predicates as follows. ftag true if the feature isknown to be presentpresent, falseif the feature is known to be absentotherwise !ftag true if the feature isknown to be absentabsent, falseif the feature is known to be presentotherwise ftag=V true if the feature isknown to bepresent with the value V, falseif the feature is known not to be present with the value Votherwise, ftag!=V true if the feature isknown to be present, but knownnotto bepresent with the value V, falseif the feature is known to be absent or present with the value V ftag=<N-M>otherwise, ftag=[N-M] true if the feature isknown to bepresent withsomeat least one numericvalues,value, while the highest value with which it is presentis known andin the range N-M, falseif the feature is known to be absent, or if it is known to be present with some numeric values, while the highest value with which it is present is known and not in the range N-M.otherwise. If N is missing, the lower bound is 0. If M is missing, the upper bound is infinity.If the information in the Accept-Features header does not provide sufficient knowledge to assign a value to a predicate using the above rules, then the value is true if there is a "*" in the Accept-Features header, false otherwise.As an example, with theheader Accept-Features: blex, !blebber, colordepth<=5, !screenwidth, UA-media={stationary}, paper = a4, paper!="a0", x_version=<100-205>, * makes the following predicates true: blex, colordepth=4,feature set { ( "blex" , { } ), ( "colordepth" , { "5" } ), ( "UA-media" , { "stationary" } ), ( "paper" , { "A4", "A3" } ) , ( "x_version" , { "104", "200" } ) } the following predicates are true: blex, colordepth=[4-], colordepth!=6, colordepth, !screenwidth, UA-media=stationary,!UA-media=screen, paper=a4,UA-media!=screen, paper=A4, paper=!a0, colordepth=<=!A0, colordepth=[ 4 - 6>, x_version="101" The * in the header makes all of the following predicates true: blex=wox, blex!=wox, paper=a5, frtnbf, !frtnbf, frtnbf=4, frtnbf!=4, frtnbf=<1-42> The header makes], x_version=[100-300], x_version=[200-300] and the following predicates are false: !blex, blebber, colordepth=6, colordepth=foo, !colordepth, screenwidth, screenwidth=640, screenwidth!=640, x_version=99, UA-media=screen,paper=a0paper=A0, paper=a4, x_version=[100-199], wuxta 6.4 Features attribute The features attribute "{" "features" feature-list "}" is used in a variant description to specify how the presence or absence of particular feature tags in the user agent affects the overall quality of the variant. feature-list = 1%feature-list-element feature-list-element = ( fpred | fpred-bag ) [ ":" true-improvement ] [ "/" false-degradation ] fpred-bag = "[" 1%fpred "]" true-improvement = short-float false-degradation = short-float Examples are: {features !textonly [blebber !wolx] colordepth=3:0.7} {features !blink/0.5 background:1.5 [blebber !wolx]:1.4/0.8} The default value for the true-improvement is 1. The default value for the false-degradation is 0, or 1 if a true-improvement value is given. A user agent SHOULD, and a remote variant selection algorithm MUST compute the quality degradation factor associated with the features attribute by multiplying all quality degradation factors of the elements of the feature-list. Note that the result can be a factor greater than 1. A feature list element yields its true-improvement factor if the corresponding feature predicate is true, or if at least one element of the corresponding fpred-bag is true. The element yields its false-degradation factor otherwise. 7 Remote variant selection algorithms A remote variant selectionalgorithmsalgorithm is a standardized algorithm by which a server can choose a best variant on behalf of a negotiating user agent. The use of a remote algorithm can speed up the negotiation process by eliminating a request-response round trip. A remote algorithm typically computes whether the Accept- headers in the request contain sufficient information to allow a choice, and if so, which variant is the best variant. This specification does not define any remote algorithms, but does define a mechanism to negotiate on the use of such algorithms. 7.1 Version numbers A version numbering scheme is used to distinguish between different remote variant selection algorithms. rvsa-version = major "." minor major = 1*4DIGIT minor = 1*4DIGIT An algorithm with the version number X.Y, with Y>0, MUST be downwards compatible with all algorithms from X.0 up to X.Y. Downwards compatibility means that, if supplied with the same information, the newer algorithm MUST make the same choice, or a better choice, as the old algorithm. There are no compatibility requirements between algorithms with different major version numbers. 8 Content negotiation status codes and headers This specification adds one new HTTP status code, and introduces six new HTTP headers. It also extends the semantics of an existing HTTP/1.1 header. 8.1 506 Variant Also Negotiates The 506 status code indicates that the server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process. 8.2 Accept-Charset The Accept-Charset header is defined in the HTTP/1.1 specification [1]. HTTP/1.1 allows the following Accept-Charset header to be sent: Accept-Charset: iso-8859-5;q=0.8, *;q=0.9 but HTTP/1.1 does not assign any special meaning to the charset "*". This specification does assign a special meaning: servers and clients which support transparent content negotiation MUST take "*" as a wildcard matching every character set not explicitly mentioned elsewhere in the Accept-Charset header. As an example, the above header assigns a quality value of 0.9 to the iso-8859-2 charset. If no "*" is present in an Accept-Charset header, then all character sets not explicitly mentioned get a quality factor of 0, except for ISO-8859-1, which gets a quality factor of 1 if not explicitly mentioned.Note:[##Note: The omission of a wildcard from the Accept-Charset header in [1] is believed to be due to an oversight during the design of HTTP/1.1. A future revision of [1]maywill probably correct this oversight, and make this sectionredundant.redundant.##] 8.3 Accept-FeaturesThis request header was defined in section 6.2. 8.4 AlternatesTheAlternates responseAccept-Features request headeriscan be used by a client toconveygive information about thelistpresence or absence ofvariants bound to a negotiable resource. This list can also include directivescertain features in the feature set forany content negotiation process. Alternatesthe current request. Servers can use this information when running a remote variant selection algorithm. Accept-Features ="Alternates""Accept-Features" ":"variant-list variant-list#( feature-expr *( ";" feature-extension ) ) feature-expr =1#( variant-description[ "!" ] ftag |fallback-variantftag [ "!" ] "=" tag-value |list-directive ) fallback-variant =ftag "=" "{"<"> URI <">tag-value "}"list-directive = ( "proxy-rvsa" "=" <"> 0#rvsa-version <"> )|extension-list-directive extension-list-directive"*" feature-extension = token [ "=" ( token | quoted-string ) ] No feature extensions are defined in this specification. An example is: Accept-Features: blex, !blebber, colordepth={5}, !screenwidth, paper = A4, paper!="A2", x_version=104, * The different feature expressions have the following meaning: ftag ftag isAlternates: {"paper.html.en" 0.9 {type text/html} {language en}}, {"paper.html.fr" 0.7 {type text/html} {language fr}}, {"paper.ps.en" 1.0 {type application/postscript} {language en}}, proxy-rvsa="1.0, 2.5" Any relative URI specified in a variant-description or fallback-variant fieldpresent !ftag ftag isrelative toabsent ftag=V ftag is present with therequest-URI. Only one fallback-variant field may be present. Ifvalue V ftag!=V ftag is present, but not with thevariant selection algorithm of the user agent finds that all described variants are unacceptable, then it SHOULD choose the fallback variant, if present, as the best variant. If the user agent computes the overall quality values ofvalue V ftag={V} ftag is present with thedescribed variants,value V, andfinds that several variants share the highest value, then the first variantnot with any other values * the expressions in thisvalueheader do not fully describe the feature set: feature tags not mentioned in this header may also be present, and, except for thelist SHOULDcase ftag={V}, tags may bechosen aspresent with more values than mentioned. Absence of thebest variant. The proxy-rvsa directive restrictsAccept-Features header in a request is equivalent to theuseinclusion of Accept-Features: * By using the Accept-Features header, a remote variant selectionalgorithms by proxies. If present, a proxy MUST ONLY use algorithms which have one of the version numbers listed, or havealgorithm can sometimes determine thesame major version number and a higher minor version number as onetruth value ofthe versions listed. Any restrictions set by proxy-rvsa comea feature predicate ontopbehalf of therestrictions set by theuseragent inagent. For example, with theNegotiate request header. The directive proxy-rvsa="" will disable variant selection by proxies entirely. Clients SHOULD ignore all extension-list-directives they do not understand. A variant list may contain multiple differing descriptions ofheader Accept-Features: blex, !blebber, colordepth={5}, !screenwidth, paper = A4, paper!="A2", x_version=104, * thesame variant. Thisalgorithm canbe convenient ifdetermine that thevariant uses conditional rendering constructs, or iffollowing predicates are true: blex, colordepth=[4-], colordepth!=6, colordepth, !screenwidth, paper=A4, colordepth=[4-6] and that thevariant resource returns multiple representations using a multipart media type. 8.5 Content-Features The Content-Features response header can be used by a server to indicate how the presence or absence of particular feature tags in the user agent affectsfollowing predicates are false: !blex, blebber, colordepth=6, colordepth=foo, !colordepth, screenwidth, screenwidth=640, screenwidth!=640, but theoverall qualitytruth value of theresponse. Content-Features = "Content-Features" ":" feature-list Note: Thisfollowing predicates cannot be determined: UA-media=stationary, UA-media!=screen, paper!=a0, x_version=[100-300], x_version=[200-300], x_version=99, UA-media=screen, paper=A0, paper=a4, x_version=[100-199], wuxta 8.4 Alternates The Alternates response headermainly exists because of symmetry considerations. Itis used to convey thecounterpartlist ofthe features attribute which can be present in variant descriptions. If present invariants bound to aresponse, the header will therefore not in general specify all user agent capabilities used by the response. 8.6 Negotiate The Negotiate request headernegotiable resource. This list cancontainalso include directives for any content negotiationprocess initiated byprocess. If a response from a transparently negotiable resource includes an Alternates header, this header MUST contain therequest. Negotiatecomplete variant list bound to the negotiable resource. Responses from resources which do not support transparent content negotiation MAY also use Alternates headers. Alternates ="Negotiate""Alternates" ":"1#negotiate-directive negotiate-directivevariant-list variant-list ="trans"1#( variant-description |rvsa-versionfallback-variant |"*"list-directive ) fallback-variant = "{" <"> URI <"> "}" list-directive = ( "proxy-rvsa" "=" <"> 0#rvsa-version <"> ) |negotiate-extension negotiate-extensionextension-list-directive extension-list-directive = token [ "=" ( token | quoted-string ) ]Examples are Negotiate: 1.0, 2.5 Negotiate: * The negotiate directives have the following meaning "trans" The user agent supports transparent content negotiation for the current request. rvsa-version The user agent allows origin servers and proxies to run the remote variant selection algorithm with the indicated version number,An example is Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, {"paper.html.fr" 0.7 {type text/html} {language fr}}, {"paper.ps.en" 1.0 {type application/postscript} {language en}}, proxy-rvsa="1.0, 2.5" Any relative URI specified in a variant-description orwithfallback-variant field is relative to thesame major version number and a higher minor version number.request-URI. Only one fallback-variant field may be present. If the variant selection algorithmhas sufficient information toof the user agent finds that all described variants are unacceptable, then it SHOULD choosea best, neighboringthe fallback variant, if present, as theorigin server or proxy MAY return a choice response with thisbest variant.Implies "trans". "*" TheIf the user agentallows origin serverscomputes the overall quality values of the described variants, andproxies to run anyfinds that several variants share the highest value, then the first variant with this value in the list SHOULD be chosen as the best variant. The proxy-rvsa directive restricts the use of remote variant selectionalgorithm. The origin server may even runalgorithmswhich have not been standardized.by proxies. Ifthe algorithm has sufficient information to choosepresent, abest, neighboring variant,proxy MUST ONLY use algorithms which have one of theorigin serverversion numbers listed, orproxy MAY returnhave the same major version number and achoice response with this variant. Implies "trans". Servershigher minor version number as one of the versions listed. Any restrictions set by proxy-rvsa come on top of the restrictions set by the user agent in the Negotiate request header. The directive proxy-rvsa="" will disable variant selection by proxies entirely. Clients SHOULD ignore allnegotiate-directivesextension-list-directives they do not understand.If the Negotiate header allows a choice between multiple remoteA variantselection algorithms which are all supported bylist may contain multiple differing descriptions of theserver,same variant. This can be convenient if theserver SHOULD use some internal precedence heuristics to selectvariant uses conditional rendering constructs, or if thebest algorithm. 8.7 TCNvariant resource returns multiple representations using a multipart media type. 8.5 Content-Features TheTCNContent-Features response headeriscan be used by a server tosignal thatindicate how theresource is transparently negotiated. TCNpresence or absence of particular feature tags in the user agent affects the overall quality of the response. Content-Features ="TCN""Content-Features" ":"#( response-type | tcn-extension ) response-type = "list" | "choice" | "adhoc" tcn-extension = token [ "=" ( token | quoted-string ) ] If the resource is not transparently negotiated, a TCNfeature-list Note: This headerMUST NEVER be included in any response. If the resourcemainly exists because of symmetry considerations. It istransparently negotiated, a TCN header, which includestheresponse-type valuecounterpart of theresponse, MUSTfeatures attribute which can beincludedpresent inevery response with a 2xx status code or any 3xx status code, except 304,variant descriptions. If present inwhich it MAY be included. A TCN header MAY also be included, withoutaresponse-type value,response, the header will therefore not inother responses from transparently negotiated resources. Clients SHOULD ignoregeneral specify alltcn-extensions they do not understand. 8.8 Variant-Varyuser agent capabilities used by the response. 8.6 Negotiate TheVariant-Vary responseNegotiate request header canbe used in a choice response to recordcontain directives for anyvary information which applies to the variant data (the entity body combined with some of the entity headers) contained in the response, rather than tocontent negotiation process initiated by theresponse as a whole. Variant-Varyrequest. Negotiate ="Variant-Vary""Negotiate" ":"(1#negotiate-directive negotiate-directive = "trans" | "vlist" | "guess-small" | rvsa-version | "*" |1#field-name ) Use ofnegotiate-extension negotiate-extension = token [ "=" token ] Examples are Negotiate: 1.0, 2.5 Negotiate: * The negotiate directives have theVariant-Vary header is discussed in section 10.2. 9 Cache validators To allowfollowing meaning "trans" The user agent supports transparent content negotiation forcorrect and efficient caching and revalidation ofthe current request. "vlist" The user agent requests that any transparently negotiatedresponses, this specification extendsresponse for thecaching model of HTTP/1.1 [1] in various ways. This specification does not introducecurrent request includes an Alternates header with the variant list bound to the negotiable resource. Implies "trans". "guess-small" The user agent allows origin servers to run a`variant-list-max-age' directivecustom algorithm whichexplicitly boundsguesses thefreshness lifetime of a cachedbest variantlist, like the `max-age' Cache-Control directive boundsfor thefreshness lifetime of a cached response. However,request, and to return thisspecification does ensure that avariantlist which is sent atin atime T by the origin server will never be re-used without revalidation by semantically transparent caches afterchoice response, if thetime T+M. This Mresulting choice response isthe maximum of all freshness lifetimes assigned (using max-age directivessmaller than orExpires headers) by thenot much larger than a list response. The definition of `not much larger' is left to origin serverto a. the responses from the negotiable resource itself,heuristics. Implies "vlist" andb. the responses from its neighboring"trans". rvsa-version The user agent allows origin servers and proxies to run the remote variantresources If no freshness lifetimes are assigned byselection algorithm with theorigin server, M isindicated version number, or with themaximum ofsame major version number and a higher minor version number. If thefreshness lifetimes which were heuristically assigned by all caches which can re-usealgorithm has sufficient information to choose a best, neighboring variant, the origin server or proxy MAY return a choice response with this variant. Implies "trans". "*" The user agent allows origin servers and proxies to run any remote variantlist. 9.1 Variant list validators A variant list validator is an opaque valueselection algorithm. The origin server may even run algorithms whichacts ashave not been standardized. If thecache validator of a variant list boundalgorithm has sufficient information to choose anegotiable resource. variant-list-validator = <quoted-stringbest, neighboring variant, the origin server or proxy MAY return a choice response with this variant. Implies "trans". Servers SHOULD ignore all negotiate-directives they do notcontaining any ";">understand. Iftwo responses containthesame variant list validator,Negotiate header allows acache can treatchoice between multiple remote variant selection algorithms which are all supported by theAlternates headers in these responses as equivalent (thoughserver, theheaders themselves need not be identical). 9.2 Structured entity tags A structured entity tag consists of a normal entity tag of whichserver SHOULD use some internal precedence heuristics to select theopaque stringbest algorithm. 8.7 TCN The TCN response header isextended with a semicolon followedused bythe text (without the surrounding quotes) ofavariant list validator: normal | variant list | structured entity tagserver to signal that the resource is transparently negotiated. TCN = "TCN" ":" #( response-type |validatorserver-side-override-directive |entity tag -------------+----------------+----------------- "etag"tcn-extension ) response-type = "list" |"vlv""choice" |"etag;vlv" W/"etag""adhoc" server-side-override-directive = "re-choose" |"vlv""keep" tcn-extension = token [ "=" ( token |W/"etag;vlv" Note thatquoted-string ) ] If the resource is not transparently negotiated, astructured entity tagTCN header MUST NEVER be included in any response. If the resource isitself also an entity tag. The structured nature oftransparently negotiated, a TCN header, which includes thetag allows caching proxies capableresponse-type value oftransparent content negotiation to perform some optimizations definedthe response, MUST be included insection 10. When not performing such optimizations,every response with astructured tag SHOULD2xx status code or any 3xx status code, except 304, in which it MAY betreated asincluded. A TCN header MAY also be included, without asingle opaqueresponse-type value,according to the general rulesinHTTP/1.1. Examples of structured entity tags are: "xyzzy;1234" W/"xyzzy;1234" "gonkxxxx;1234" "a;b;c;;1234" In the last example, the normal entity tag is "a;b;c;" and the variant list validator is "1234". If aother responses from transparently negotiatedresponse includes an entity tag, itresources. A server-side override directive MUST be included if the origin server performed astructured entity tag. The variant list validator inserver-side override when choosing thestructured tagresponse. If the directive is "re-choose", the server MUSTact as a validator forinclude an Alternates header with the variantlist containedbound to the negotiable resource in theAlternates header. The normal entity tag inresponse, and user agent SHOULD use its internal variant selection algorithm to choose, retrieve, and display thestructured tag MUSTbest variant from this list. If the directive is "keep" the user agent SHOULD NOT renegotiate on the response, but display it directly, or actason it directly if it is avalidator ofredirection response. Clients SHOULD ignore all tcn-extensions they do not understand. 8.8 Variant-Vary The Variant-Vary response header can be used in a choice response to record any vary information which applies to the variant data (the entity body combined with some of the entity headers) contained in the response, rather than to the responseandas a whole. Variant-Vary = "Variant-Vary" ":" ( "*" | 1#field-name ) Use ofall entity headers except Alternates. 9.3 Assigning entity tags to variantsthe Variant-Vary header is discussed in section 10.2. 9 Cache validators To allow for correct and efficient caching and revalidation oftransparentlynegotiatedresponses by clients, origin servers SHOULD generate all normal entity tags forresponses, this specification extends theneighboring variant resourcescaching model ofthe negotiable resourceHTTP/1.1 [1] insuchvarious ways. This specification does not introduce away that 1. the same tag is never used by two different variants, unless this tag labels exactly`variant-list-max-age' directive which explicitly bounds thesame entity on all occasions, 2. if one normal tag "X" isfreshness lifetime of aprefixcached variant list, like the `max-age' Cache-Control directive bounds the freshness lifetime ofanother normal tag "XY", then "Y" must never beasemicolon followed bycached response. However, this specification does ensure that a variant listvalidator. 10 Content negotiation responses Ifwhich is sent at arequest on a transparently negotiated resource yields a response with a 2xx status code or any 3xx status code except 304, this response MUST alwaystime T by the origin server will never beeither a list response, a choice response,re-used without revalidation by semantically transparent caches after the time T+M. This M is the maximum of all freshness lifetimes assigned (using max-age directives oran ad hoc response. These responses always includeExpires headers) by theAlternates header boundorigin server to a. thenegotiable resource, and a TCN header which specifies their type. Transparently negotiatedresponseswith other status codes MAY also include an Alternates header. After having constructed a list, choice, or ad hoc response, a server MAY process any If-No-Match or If-Range headers infrom therequest messagenegotiable resource itself, andshorten the response to a 304 (Not Modified) or 206 (Partial Content) response, followingb. therules inresponses from its neighboring variant resources If no freshness lifetimes are assigned by theHTTP/1.1 specification [1]. In this case,origin server, M is theentity tagmaximum of theshortened response will identify it indirectly as a list, choice, or ad-hoc response. 10.1 List response A list response MUST contain (besides the normal headers requiredfreshness lifetimes which were heuristically assigned byHTTP) a TCN headerall caches whichspecifiescan re-use the"list" response-type,variant list. 9.1 Variant list validators A variant list validator is an opaque value which acts as theAlternates headercache validator of a variant list bound tothea negotiableresource,resource. variant-list-validator = <quoted-string not containing any ";"> If two responses contain the same variant list validator, aVary header and (unless it was a HEAD request) an entity body which allows the user to manually selectcache can treat thebest variant. It is generatedAlternates headers in these responses as equivalent (though the headers themselves need not be identical). 9.2 Structured entity tags A structured entity tag consists of aresponse to a user agentnormal entity tag of whichsupports transparent content negotiation iftheserver does not, cannot, oropaque string isnot allowed to chooseextended with aparticular best variant forsemicolon followed by therequest. An exampletext (without the surrounding quotes) of a variant listresponse is HTTP/1.1 300 Multiple Choices Date: Tue, 11 Jun 1996 20:02:21 GMT TCN: list Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, {"paper.html.fr" 0.7 {type text/html} {language fr}}, {"paper.ps.en" 1.0 {type application/postscript} {language en}} Vary: negotiate, accept, accept-language ETag: "blah;1234" Cache-control: max-age=86400 Content-Type: text/html Content-Length: 227 <h2>Multiple Choices:</h2> <ul> <li><a href=paper.html.en>HTML, English version</a> <li><a href=paper.html.fr>HTML, French version</a> <li><a href=paper.ps.en>Postscript, English version</a> </ul> Note: Avalidator: normal | variant listresponse can have any status code, but the 300 (Multiple Choices) code| structured entity tag | validator | entity tag -------------+----------------+----------------- "etag" | "vlv" | "etag;vlv" W/"etag" | "vlv" | W/"etag;vlv" Note that a structured entity tag is itself also an entity tag. The structured nature of themost appropriate one for HTTP/1.1 clients. Some existing versionstag allows caching proxies capable ofHTTP/1.0 clients are knowntransparent content negotiation tosilently ignore 300 responses, instead of handling themperform some optimizations defined in section 10. When not performing such optimizations, a structured tag SHOULD be treated as a single opaque value, according to theHTTP/1.0 specification [3]. Servers should therefore be carefulgeneral rules insending 300 responses to non-negotiating HTTP/1.0 user agents,HTTP/1.1. Examples of structured entity tags are: "xyzzy;1234" W/"xyzzy;1234" "gonkxxxx;1234" "a;b;c;;1234" In the last example, the normal entity tag is "a;b;c;" andin making these responses cacheable. The 200 (OK) status code can be used instead. The Vary header inthe variant list validator is "1234". If a transparently negotiated responseSHOULD ensure correct handling by plain HTTP/1.1 caching proxies. This header can eitherincludes an entity tag, it MUST beVary: * oramore elaborate header; see section 10.6.1. Only the origin server may constructstructured entity tag. The variant listresponses. Depending onvalidator in thestatus code,structured tag MUST act as a validator for the variant listresponse is cacheable unless indicated otherwise. According tocontained in theHTTP/1.1 specification [1], a user agent which does not support transparent content negotiation will, when receivingAlternates header. The normal entity tag in the structured tag MUST act as alist response, displayvalidator of the entity bodyincludedin theresponse. If theresponsecontains a Location header, however, the user agent MAY automatically redirectand of all entity headers except Alternates. 9.3 Assigning entity tags tothis location. The handlingvariants To allow for correct revalidation oflisttransparently negotiated responses byclients supporting transparent content negotiation is described in sections 11.1 and 13. 10.2 Choice response A choice response merges aclients, origin servers SHOULD generate all normalHTTP response fromentity tags for thechosen variant, a TCN header which specifiesneighboring variant resources of the"choice" response-type,negotiable resource in such aContent-Location header givingway that 1. thelocation of the variant, and the Alternates headers bound to the negotiable resource. It can be generated when the server has sufficient information to be able to choosesame tag is never used by two different variants, unless this tag labels exactly thebest variantsame entity onbehalf the user agent, but may only be generatedall occasions, 2. ifthis best variantone normal tag "X" is aneighboring variant. Dependingprefix of another normal tag "XY", then "Y" must never be a semicolon followed by a variant list validator. 10 Content negotiation responses If a request onthe status code,achoicetransparently negotiated resource yields a response with a 2xx status code or any 3xx status code except 304, this responseis cacheable unless indicated otherwise. Origin servers and proxy cachesMUSTconstructalways be either a list response, a choice response, or an adhoc response. These responses MUST always include a TCN header which specifies their type. Transparently negotiated responses withthe following algorithm (or anyotheralgorithmstatus codes MAY also include a TCN header. The conditions under whichgives equal end resultsthe different content negotiation responses may be sent are defined in section 12.1 for origin servers and in section 13 for proxies. After having constructed a list, choice, or adhoc response, a server MAY process any If-No-Match or If-Range headers in theclient).request message and shorten the response to a 304 (Not Modified) or 206 (Partial Content) response, following the rules in the HTTP/1.1 specification [1]. In thisalgorithm, `the current Alternates header' refers tocase, theAlternates header containingentity tag of thevariant list which was used to chooseshortened response will identify it indirectly as a list, choice, or adhoc response. 10.1 List response A list response returns thebest variant, and `the currentvariant listvalidator' refers to the validatorofthis list. Section 10.4 specifies how these two itemsthe negotiable resource, but no variant data. It can beobtained by a proxy cache. The algorithm consists of four steps. 1. Construct a HTTP request message ongenerated when the server does not want to, or is not allowed to, return a particular best variantresource by rewritingfor therequest-URI and Host header (if appropriate) ofrequest. If thereceived request message onuser agent supports transparent content negotiation, thenegotiable resource. 2. Generate a valid HTTPlist responsemessage, but not one with the 304 (Not Modified) code, for the request message constructed in step 1. Inwill cause it to select aproxy cache, thebest variant and retrieve it. A list responsecan be obtained from cache memory, or by passing the constructed HTTP request towards the origin server. If the request is passed on,MUST contain (besides theproxy MAY add, modify, or delete If-None-Match and If-Rangenormal headersto optimize the transaction withrequired by HTTP) a TCN header which specifies theupstream server. Note:"list" response-type, theproxy should be careful notAlternates header bound toaddthe negotiable resource, a Vary header and (unless it was a HEAD request) an entitytags of non-neighboring variantsbody which allows the user toIf-* (conditional) headers ofmanually select therequest, as there are no global uniqueness requirements for these tags. 3. Only in origin servers: check for an origin server configuration error. If the HTTP response message generated in step 2 containsbest variant. An example of aTCN header, thenlist response is HTTP/1.1 300 Multiple Choices Date: Tue, 11 Jun 1996 20:02:21 GMT TCN: list Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, {"paper.html.fr" 0.7 {type text/html} {language fr}}, {"paper.ps.en" 1.0 {type application/postscript} {language en}} Vary: negotiate, accept, accept-language ETag: "blah;1234" Cache-control: max-age=86400 Content-Type: text/html Content-Length: 227 <h2>Multiple Choices:</h2> <ul> <li><a href=paper.1>HTML, English version</a> <li><a href=paper.2>HTML, French version</a> <li><a href=paper.3>Postscript, English version</a> </ul> Note: A list response can have any status code, but thebest variant resource300 (Multiple Choices) code isnot a proper end point inthetransparent negotiation process, and a 506 (Variant Also Negotiates) error response message SHOULD be generated insteadmost appropriate one for HTTP/1.1 clients. Some existing versions ofgoingHTTP/1.0 clients are known tostep 4. 4. Add a numbersilently ignore 300 responses, instead ofheadershandling them according to theHTTP response message generatedHTTP/1.0 specification [3]. Servers should therefore be careful instep 2. a. Add a TCN header which specifies the "choice" response-type. b. Add a Content-Location header giving the location of the chosen variant. Delete any Content-Location header which was already present. Note: Accordingsending 300 responses to non-negotiating HTTP/1.0 user agents, and in making these responses cacheable. The 200 (OK) status code can be used instead. The Vary header in the response SHOULD ensure correct handling by plain HTTP/1.1specification [1], if the Content-Locationcaching proxies. This headercontainscan either be Vary: * or arelative URI, this URI is relative to the URI in the Content-Base header, if present, and relative to the request-URI if no Content-Base header is present. c. If any Vary headers are present in the response message from step 2, add, for every Vary header, a Variant-Vary header with a copy ofmore elaborate header; see section 10.6.1. Only thecontents of this Vary header. d. Addorigin server may construct list responses. Depending on thecurrent Alternates header. Delete any Alternates header which was already present. e. Addstatus code, aVary headerlist response is cacheable unless indicated otherwise. According toensure correct handling by plainthe HTTP/1.1caching proxies. This header can either be Vary: * orspecification [1], amore elaborate header, see section 10.6. f. To ensure compatibility with HTTP/1.0 caching proxiesuser agent whichdodoes notrecognize the Vary header, an Expires header withsupport transparent content negotiation will, when receiving adate in the past MAY be added. See section 10.7 for more information. g. If an ETag header is present in thelist responsemessage from step 2, then extend the entity tag in that headerwith thecurrent variant list validator, as specified in section 9.2. f. Only300 status code, display the entity body included inproxy caches: settheAge header ofresponse. If the response contains a Location header, however, the user agent MAY automatically redirect tomax( variant_age , alternates_age ) where variant_agethis location. The handling of list responses by clients supporting transparent content negotiation isthe agedescribed in sections 11.1 and 13. 10.2 Choice response A choice response returns a representation of the best variantresponse obtained in step 2, calculated according to the rules infor theHTTP/1.1 specification [1],request, andalternates_age ismay also return theagevariant list of theAlternates header added in step d, calculated accordingnegotiable resource. It can be generated when the server has sufficient information to be able to choose therules in section 10.4. Note thatbest variant on behalf the user agent, but may only be generated if this best variant is a neighboring variant. For request from user agents which do not support transparent content negotiation, a servercan shortenmay always generate a choice response, provided that the variant returned is a neighboring variant. The variant returned in a choice responseproduced byneed not necessarily be listed in theabove algorithmvariant list bound to the negotiable resource. A choice response merges a304 (Not Modified)normal HTTP responseif an If-None-Matchfrom the chosen variant, a TCN headerinwhich specifies theoriginal request allows it. If this is"choice" response-type, and a Content-Location header giving thecase, an implementationlocation of theabove algorithm can avoidvariant. Depending on theunnecessary internal construction of fullstatus code, a choice responsemessage in step 2, it need onlyis cacheable unless indicated otherwise. Origin servers and proxy caches MUST construct choice responses with thepartsfollowing algorithm (or any other algorithm which gives equal endup inresults for thefinal 304 response. A proxy cache which implementsclient). In thisoptimization can sometimes generate a legal 304 response even if it has not cachedalgorithm, `the current Alternates header' refers to the Alternates header containing the variantdata itself. An example of a choice response is: HTTP/1.1 200 OK Date: Tue, 11 Jun 1996 20:05:31 GMT TCN: choice Content-Type: text/html Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT Content-Length: 5327 Cache-control: max-age=604800 Content-Location: paper.html.en Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, {"paper.html.fr" 0.7 {type text/html} {language fr}}, {"paper.ps.en" 1.0 {type application/postscript} {language en}} Etag: "gonkyyyy;1234" Vary: negotiate, accept, accept-language Expires: Thu, 01 Jan 1980 00:00:00 GMT <title>A paper about .... 10.3 Ad hoc response An ad hoc response has a TCN headerlist whichspecifies the "adhoc" response-type. It MUST contain the Alternates header boundwas used to choose thenegotiable resource,best variant, anda Vary header if`the current variant list validator' refers to theresponse is cacheable. It MAYvalidator of this list. Section 10.4 specifies how these two items can begeneratedobtained byan origin server asaresponse toproxy cache. The algorithm consists of four steps. 1. Construct anon-negotiating user agent, ifHTTP request message on theserver cannot or does not want to send a list or choice response. The Varybest variant resource by rewriting the request-URI and Host header (if appropriate) of the received request message on the negotiable resource. 2. Generate a valid HTTP response message, but not one with the 304 (Not Modified) code, for the request message constructed in step 1. In a proxy cache, the responseSHOULD ensure correct handling by plain HTTP/1.1 caching proxies. This headercaneitherbeVary: *obtained from cache memory, ora more elaborate header, see section 10.6.1. Depending onby passing thestatus code, an ad hoc responseconstructed HTTP request towards the origin server. If the request iscacheable unless indicated otherwise. An example of an ad hoc response is: HTTP/1.1 302 Moved Temporarily Date: Tue, 11 Jun 1996 20:02:28 GMT TCN: adhoc Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, {"paper.html.fr" 0.7 {type text/html} {language fr}}, {"paper.ps.en" 1.0 {type application/postscript} {language en}} Location: paper.html.en Content-Type: text/html Content-Length: 59 This document is available <a href=paper.html.en>here</a>. 10.4 Reusingpassed on, theAlternates header If aproxycache has available a negotiated response which is cacheable, fresh,MAY add, modify, or delete If-None-Match andhasIf-Range headers to optimize the transaction with the upstream server. Note: the proxy should be careful not to add entity tags of non-neighboring variants to If-* (conditional) headers of the request, as there are no global uniqueness requirements for these tags. 3. Only in origin servers: check for anETagorigin server configuration error. If the HTTP response message generated in step 2 contains a TCN header, thenit MAY extracttheAlternates header and associatedbest variantlist validator fromresource is not a proper end point in theresponse,transparent negotiation process, andreuse them (without unnecessary delay) to negotiate on behalfa 506 (Variant Also Negotiates) error response message SHOULD be generated instead ofthe user agent (section 13) orgoing toconstructstep 4. 4. Add achoice response (section 10.2). The agenumber of headers to theextracted AlternatesHTTP response message generated in step 2. a. Add a TCN headeriswhich specifies theage"choice" response-type. b. Add a Content-Location header giving the location of theresponse fromchosen variant. Delete any Content-Location header whichit is extracted, calculated accordingwas already present. Note: According to therules in theHTTP/1.1 specification[1]. 10.5 Extracting a normal response from[1], if the Content-Location header contains achoice response If a proxy receives a choice response, it MAY extractrelative URI, this URI is relative to the URI in the Content-Base header, if present, andcacherelative to the request-URI if no Content-Base header is present. c. If any Vary headers are present in thenormal HTTP response contained therein. The normalresponsecan be extracted by takingmessage from step 2, add, for every Vary header, a Variant-Vary header with a copy of thechoice response and then deleting the Content-Location, Alternates, andcontents of this Varyheaders, renamingheader. d. Delete anyVariant-VaryAlternates headersto Vary headers, and shortening the structured entity tagwhich are present inany ETagin the response. Now, the current Alternates headerto a normal entity tag. This normal response MAYMUST becached (as a HTTP response toadded if this is required by thevariantNegotiate requestas constructedheader, or if the server returns "re-choose" instep 1. of section 10.2) and reusedthe TCN response header. Otherwise, the current Alternates header MAY be added. Note: It is usually a good strategy toanswer future direct requests onalways add thevariant resource, accordingcurrent Alternates header, unless it is very large compared to therules inrest of the response. e. Add a Vary header to ensure correct handling by plain HTTP/1.1specification [1]. Note: Thecachingof extracted responsesproxies. This header candecrease the upstream bandwidth usage with up toeither be Vary: * or afactor 2, because two independent HTTP/1.1 cache entries, one associated with the negotiable resource URI and onemore elaborate header, see section 10.6. f. To ensure compatibility with HTTP/1.0 caching proxies which do not recognize thevariant URI, are createdVary header, an Expires header with a date in thesame transaction. Without this optimization, both HTTP/1.1 cache entries can onlypast MAY becreated by transmitting the variant data twice. For security reasons (seeadded. See section14.2), an extracted normal response MUST NEVER be cached if belongs to a non-neighboring variant resource. If the choice response claims to contain data10.7 fora non-neighboring variant resource, the proxy SHOULD rejectmore information. g. If an ETag header is present in thechoiceresponseas a probable spoofing attempt. 10.6 Elaborate Vary headers If a HTTP/1.1 [1] server can generate varying responses for a request on some resource,message from step 2, then extend theserver MUST include a Varyentity tag in that header with the current variant list validator, as specified inthese responsessection 9.2. Note: Step g. is required even ifthey are cacheable. This Vary headerthe variant list itself isa signalnot added in step d. h. Only in proxy caches: set the Age header of the response toHTTP/1.1 caches that something specialmax( variant_age , alternates_age ) where variant_age isgoing on. It preventsthecaches from returningage of thecurrently chosenvariant responsefor every future request onobtained in step 2, calculated according to theresource. Servers engagingrules intransparent content negotiation will generate varying responses. Therefore, cacheable list, choice,the HTTP/1.1 specification [1], andad hoc responses MUST always include a Vary header. The most simple Vary header which can be includedalternates_age isVary: * This header leavesthewayage of the Alternates header added inwhichstep d, calculated according to theresponse is selected by the server completely unspecified. A more elaborate Vary header MAY be used to allow for certain optimizationsrules inHTTP/1.1 caches which do not have specific optimizations for transparent content negotiation, but which do cache multiple variant responses for one resource. Suchsection 10.4. Note that amore elaborate Vary header lists all request headers whichserver canbe usedshorten the response produced by theserver when selectingabove algorithm to a 304 (Not Modified) responsefor a request on the resource. 10.6.1 Construction ofif anelaborate Vary header Origin servers can construct a more elaborate VaryIf-None-Match header in thefollowing way. First, start with the header Vary: negotiate `negotiate'original request allows it. If this isalways included because servers usetheinformation in the Negotiate header when choosing between a list, choice, or ad-hoc response. Then, if anycase, an implementation of thefollowing attributes is present in any variant description in the Alternates header, addabove algorithm can avoid thecorresponding header name tounnecessary internal construction of full response message in step 2, it need only construct theVary header attribute | header name to add -----------+--------------------- type | accept charset | accept-charset language | accept-language features | accept-features The Vary header constructedparts which end up inthis way specifiestheresponse variationfinal 304 response. A proxy cache which implements this optimization canbe caused by the use ofsometimes generate avariant selection algorithm in proxies. Iflegal 304 response even if it has not cached theorigin server will in some cases, forvariant data itself. An exampleif contacted by a non-negotiating user agent, useof acustom negotiation algorithm which takes additional headers into account, these names of these headers SHOULD alsochoice response is: HTTP/1.1 200 OK Date: Tue, 11 Jun 1996 20:05:31 GMT TCN: choice Content-Type: text/html Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT Content-Length: 5327 Cache-control: max-age=604800 Content-Location: paper.1 Alternates: {"paper.1" 0.9 {type text/html} {language en}}, {"paper.2" 0.7 {type text/html} {language fr}}, {"paper.3" 1.0 {type application/postscript} {language en}} Etag: "gonkyyyy;1234" Vary: negotiate, accept, accept-language Expires: Thu, 01 Jan 1980 00:00:00 GMT <title>A paper about .... 10.3 Adhoc response An adhoc response can beadded to the Vary header. 10.6.2 Caching ofsent by anelaborate Vary header A proxy cache cannot constructorigin server as anelaborate vary header using the method above, becauseextreme measure, to achieve compatibility with a non-negotiating or buggy client if thismethod requires exact knowledge of any custom algorithms present incompatibility cannot be achieved by sending a list or choice response. There are very little requirements on theorigin server. However, when extractingcontents of anAlternates header from aadhoc response. An adhoc response(section 10.4) caches MAY also extract the VaryMUST have a TCN headerinwhich specifies theresponse,"adhoc" response-type, andreuse it along with the Alternates header. A cleana Vary headercan however only be extractedif thevariant does not vary itself, i.e. if a Variant-Vary headerresponse isabsent. 10.7 Adding an Expirescacheable. It MAY contain the Alternates header bound toensure HTTP/1.0 compatibility To ensure compatibility with HTTP/1.0 caching proxies which do not recognizethe negotiable resource. Any Varyheader, an Expiresheaderwith a datein thepastresponse SHOULD ensure correct handling by plain HTTP/1.1 caching proxies. This header can either beadded toVary: * or a more elaborate header, see section 10.6.1. Depending on theresponse, for example Expires: Thu, 01 Jan 1980 00:00:00 GMT If thisstatus code, an adhoc response isdone bycacheable unless indicated otherwise. As anorigin server, the server SHOULD usually also include a Cache-Control header for the benefit of HTTP/1.1 caches, forexampleCache-Control: max-age=604800 which overridesof thefreshness lifetimeuse ofzero seconds specified byan adhoc response, suppose that theincluded Expires header. Note: This specification only claims downwards compatibilityvariant resource "redirect-to-blah" yields redirection (302) responses. A choice response with this variant could look as follows: HTTP/1.1 302 Moved Temporarily Date: Tue, 11 Jun 1996 20:02:28 GMT TCN: choice Content-location: redirect-to-blah Location: http://blah.org/ Content-Type: text/html Content-Length: 62 This document is available <a href=http://blah.org/>here</a>. Suppose that theHTTP/1.0 proxy caches which implementserver knows that theHTTP/1.0 specification [3]. Some legacy proxy cachesreceiving user agent has a bug, whichreturncauses it to crash on responses which contain both a Content-Location and a Location header. The server could then work around this bug by performing a server-side override and sending theHTTP/1.0 protocol version number do not honorfollowing adhoc response instead: HTTP/1.1 302 Moved Temporarily Date: Tue, 11 Jun 1996 20:02:28 GMT TCN: adhoc, keep Location: http://blah.org/ Content-Type: text/html Content-Length: 62 This document is available <a href=http://blah.org/>here</a>. 10.4 Reusing theHTTP/1.0 ExpiresAlternates headeras specified in [3]. Methods for achieving compatibility with suchIf a proxycaches are beyond the scope of this specification. 10.8 Negotiation on content encoding Negotiation on the content encoding ofcache has available a negotiated response which isorthogonal to transparent content negotiation. The rules for when a content encoding may be applied are the same as in HTTP/1.1: servers MAY content-encode responses that arecacheable, fresh, and has ETag and Alternates headers, then it MAY extract theresult of transparent content negotiation whenever an Accept-EncodingAlternates headerin the request allows it. When negotiating onand associated variant list validator from thecontent encoding of a cacheableresponse,servers MUST add the accept-encoding header nameand reuse them (without unnecessary delay) tothe Vary headernegotiate on behalf of theresponse,user agent (section 13) oradd `Vary: *'. Servers SHOULD always be able to provide unencoded versions of every transparently negotiated response. This means in particular that every variant in the variant list SHOULD at least be available in an unencoded form. Like HTTP/1.1, this specification allows proxiestoencode or decode relayed or cached responses on the fly, unless explicitly forbidden byconstruct aCache-Control directive. The encoded or decodedchoice responsestill contains(section 10.2). The age of thesame variant as far as transparent content negotiation is concerned. Note that HTTP/1.1 requires proxies to add a Warningextracted Alternates headerifis theencodingage ofathe response from which it ischanged. 11 User agent support for transparent negotiation This section specifies the requirements a user agent needs to satisfy in order to support transparent negotiation. If the user agent contains an internal cache, this cache MUST conformextracted, calculated according to the rulesfor proxy cachesinsection 13. 11.1 Handling of responses Ifthe HTTP/1.1 specification [1]. 10.5 Extracting alistnormal responseis received whenfrom aresource is accessed,choice response If a proxy receives a choice response, it MAY extract and cache theuser agent MUST be able to automatically choose, retrieve, and display the best variant, or display an error message if nonenormal HTTP response contained therein. The normal response can be extracted by taking a copy of thevariants are acceptable. If achoice responseis received whenand then deleting any Content-Location, Alternates, and Vary headers, renaming any Variant-Vary headers to Vary headers, and shortening the structured entity tag in any ETag header to aresource is accessed,normal entity tag. This normal response MAY be cached (as a HTTP response to theusual action isvariant request as constructed in step 1. of section 10.2) and reused toautomatically displayanswer future direct requests on theenclosed entity. However, if a remotevariantselection algorithm which was enabled could have made a choice different fromresource, according to thechoicerules in thelocal algorithm would make,HTTP/1.1 specification [1]. Note: The caching of extracted responses can decrease theuser agent MAY apply its local algorithmupstream bandwidth usage with up to a factor 2, because two independent HTTP/1.1 cache entries, one associated with the negotiable resource URI and one with the variantlistURI, are created in theresponse, and automatically retrieve and display another variant ifsame transaction. Without this optimization, both HTTP/1.1 cache entries can only be created by transmitting thelocal algorithm makesvariant data twice. For security reasons (see section 14.2), another choice. When receiving a choice response, a user agent SHOULD checkextracted normal response MUST NEVER be cached ifvariant resource isbelongs to aneighboringnon-neighboring variantresource of the negotiableresource. Ifthis is not the case, the user agent SHOULD rejectthe choice responseas a probable spoofing attempt and display an error message,claims to contain data forexample by internally replacinga non-neighboring variant resource, the proxy SHOULD reject the choice responsewith a 502 (bad gateway) response. 11.2 Presentation ofas atransparently negotiated resourceprobable spoofing attempt. 10.6 Elaborate Vary headers If a HTTP/1.1 [1] server can generate varying responses for a request on some resource, then theuser agent is displayingserver MUST include avariant whichVary header in these responses if they are cacheable. This Vary header isnot an embedded or inlined object and whicha signal to HTTP/1.1 caches that something special is going on. It prevents theresult of transparent negotiation, the following requirements apply. 1. The user agent SHOULD allowcaches from returning theuser to review a list of all variants bound tocurrently chosen response for every future request on thenegotiable resource,resource. Servers engaging in transparent content negotiation will generate varying responses. Therefore, cacheable list, choice, andto manually retrieve another variant if desired. There are two general ways of providing suchadhoc responses MUST always include alist. First, the information in the AlternatesVary header. The most simple Vary headerof the negotiable resource couldwhich can beused to make an annotated menu of variants. Second, the entityincluded is Vary: * This header leaves the way ina list response ofwhich thenegotiable resource could be displayed. Note that a listresponsecan be obtainedis selected bydoing a GET request which only hasthe"trans" directiveserver completely unspecified. A more elaborate Vary header MAY be used to allow for certain optimizations in HTTP/1.1 caches which do not have specific optimizations for transparent content negotiation, but which do cache multiple variant responses for one resource. Such a more elaborate Vary header lists all request headers which can be used by theNegotiate header. 2. The user agent SHOULD make available though its user interface some indication that the resource being displayed isserver when selecting anegotiated resource instead ofresponse for aplainrequest on the resource.It SHOULD also allow10.6.1 Construction of an elaborate Vary header Origin servers can construct a more elaborate Vary header in theuser to examinefollowing way. First, start with thevariant listheader Vary: negotiate `negotiate' is always included because servers use the information in theAlternates header. SuchNegotiate header when choosing between anotification and review mechanism is needed becauselist, choice, or adhoc response. Then, if any ofprivacy considerations, see section 14.1. 3. Iftheuser agent showsfollowing attributes is present in any variant description in theURI ofAlternates header, add thedisplayed informationcorresponding header name to theuser, it SHOULD be the negotiable resource URI, not the variant URI that is shown. This encourages third parties, who want to referVary header attribute | header name tothe displayed informationadd -----------+--------------------- type | accept charset | accept-charset language | accept-language features | accept-features The Vary header constructed intheir own documents, to make a hyperlink to the negotiable resource as a whole, rather than tothis way specifies thevariant resourceresponse variation whichhappens tocan beshown. Such correct linking is vital forcaused by theinteroperabilityuse ofcontent across sites. The user agent SHOULD however also provideameans for reviewing the URI of the particularvariantwhich is currently being displayed. 4. Similarly, ifselection algorithm in proxies. If the origin server will in some cases, for example if contacted by a non-negotiating useragent storesagent, use areferencecustom negotiation algorithm which takes additional headers into account, these names of these headers SHOULD also be added to thedisplayed information for future use, for exampleVary header. 10.6.2 Caching of an elaborate Vary header A proxy cache cannot construct an elaborate vary header using the method above, because this method requires exact knowledge of any custom algorithms present in the origin server. However, when extracting an Alternates header from ahotlist,response (section 10.4) caches MAY also extract the Vary header in the response, and reuse itSHOULD storealong with thenegotiable resource URI, notAlternates header. A clean Vary header can however only be extracted if the variantURI. It is encouraged, butdoes notrequired, that some of the above functionality is also made available for inlined or embedded objects, and whenvary itself, i.e. if avariant which was selected manuallyVariant-Vary header isbeing displayed. 12 Origin server support for transparent negotiation 12.1 Requirementsabsent. 10.7 Adding an Expires header to ensure HTTP/1.0 compatibility Toimplement transparent negotiation onensure compatibility with HTTP/1.0 caching proxies which do not recognize the Vary header, an Expires header with aresource,date in theorigin server MUSTpast can beableadded tosend a list response when gettingthe response, for example Expires: Thu, 01 Jan 1980 00:00:00 GMT If this is done by an origin server, the server SHOULD usually also include a Cache-Control header for the benefit of HTTP/1.1 caches, for example Cache-Control: max-age=604800 which overrides the freshness lifetime of zero seconds specified by the included Expires header. Note: This specification only claims downwards compatibility with the HTTP/1.0 proxy caches which implement the HTTP/1.0 specification [3]. Some legacy proxy caches which return the HTTP/1.0 protocol version number do not honor the HTTP/1.0 Expires header as specified in [3]. Methods for achieving compatibility with such proxy caches are beyond the scope of this specification. 10.8 Negotiation on content encoding Negotiation on the content encoding of a response is orthogonal to transparent content negotiation. The rules for when a content encoding may be applied are the same as in HTTP/1.1: servers MAY content-encode responses that are the result of transparent content negotiation whenever an Accept-Encoding header in the request allows it. When negotiating on the content encoding of a cacheable response, servers MUST add the accept-encoding header name to the Vary header of the response, or add `Vary: *'. Servers SHOULD always be able to provide unencoded versions of every transparently negotiated response. This means in particular that every variant in the variant list SHOULD at least be available in an unencoded form. Like HTTP/1.1, this specification allows proxies to encode or decode relayed or cached responses on the fly, unless explicitly forbidden by a Cache-Control directive. The encoded or decoded response still contains the same variant as far as transparent content negotiation is concerned. Note that HTTP/1.1 requires proxies to add a Warning header if the encoding of a response is changed. 11 User agent support for transparent negotiation This section specifies the requirements a user agent needs to satisfy in order to support transparent negotiation. If the user agent contains an internal cache, this cache MUST conform to the rules for proxy caches in section 13. 11.1 Handling of responses If a list response is received when a resource is accessed, the user agent MUST be able to automatically choose, retrieve, and display the best variant, or display an error message if none of the variants are acceptable. If a choice response is received when a resource is accessed, the usual action is to automatically display the enclosed entity. However, if a remote variant selection algorithm which was enabled could have made a choice different from the choice the local algorithm would make, the user agent MAY apply its local algorithm to any variant list in the response, and automatically retrieve and display another variant if the local algorithm makes an other choice. When receiving a choice response, a user agent SHOULD check if variant resource is a neighboring variant resource of the negotiable resource. If this is not the case, the user agent SHOULD reject the choice response as a probable spoofing attempt and display an error message, for example by internally replacing the choice response with a 502 (bad gateway) response. 11.2 Presentation of a transparently negotiated resource If the user agent is displaying a variant which is not an embedded or inlined object and which is the result of transparent content negotiation, the following requirements apply. 1. The user agent SHOULD allow the user to review a list of all variants bound to the negotiable resource, and to manually retrieve another variant if desired. There are two general ways of providing such a list. First, the information in the Alternates header of the negotiable resource could be used to make an annotated menu of variants. Second, the entity included in a list response of the negotiable resource could be displayed. Note that a list response can be obtained by doing a GET request which only has the "trans" directive in the Negotiate header. 2. The user agent SHOULD make available though its user interface some indication that the resource being displayed is a negotiated resource instead of a plain resource. It SHOULD also allow the user to examine the variant list included in the Alternates header. Such a notification and review mechanism is needed because of privacy considerations, see section 14.1. 3. If the user agent shows the URI of the displayed information to the user, it SHOULD be the negotiable resource URI, not the variant URI that is shown. This encourages third parties, who want to refer to the displayed information in their own documents, to make a hyperlink to the negotiable resource as a whole, rather than to the variant resource which happens to be shown. Such correct linking is vital for the interoperability of content across sites. The user agent SHOULD however also provide a means for reviewing the URI of the particular variant which is currently being displayed. 4. Similarly, if the user agent stores a reference to the displayed information for future use, for example in a hotlist, it SHOULD store the negotiable resource URI, not the variant URI. It is encouraged, but not required, that some of the above functionality is also made available for inlined or embedded objects, and when a variant which was selected manually is being displayed. 12 Origin server support for transparent negotiation 12.1 Requirements To implement transparent negotiation on a resource, the origin server MUST be able to send a list response when getting a GET request on the resource. It SHOULD also be able to send appropriate list responses for HEAD requests. When getting a request on a transparently negotiable resource, the origin server MUST NEVER return a response with a 2xx status code or any 3xx status code, except 304, which is not a list, choice, or adhoc response. If the request includes a Negotiate header with a "vlist" or "trans" directive, but without any directive which allows the server to select a best variant, a list response MUST ALWAYS be sent, except when the server is performing a server-side override for bug compatibility. If the request includes a Negotiate header with a "vlist" or "guess-small" directive, an Alternates header with the variant list bound to the negotiable resource MUST ALWAYS be sent in any list, choice, or adhoc response, except when the server is performing a server-side override for bug compatibility. If the Negotiate header allows it, the origin server MAY run a remote variant selection algorithm. If the algorithm has sufficient information to choose a best variant, and if the best variant is a neighboring variant, the origin server MAY return a choice response with this variant. When getting a request on a transparently negotiable resource from a user agent which does not support transparent content negotiation, the origin server MAY use a custom algorithm to select between sending a list, choice, or adhoc response. The following table summarizes the rules above. |Req on |Usr agnt|server- | Response may be: | |trans neg|capable |side +------+------+------+------+------+ |resource?|of TCN? |override?|list |choice|adhoc |normal|error | +---------+--------+---------+------+------+------+------+------+ | Yes | Yes | No |always|smt(*)|never |never |always| | Yes | Yes | Yes |always|always|always|never |always| +---------+--------+---------+------+------+------+------+------+ | Yes | No | - |always|always|always|never |always| +---------+--------+---------+------+------+------+------+------+ | No | - | - |never |never |never |always|always| +---------+--------+---------+------+------+------+------+------+ (*) sometimes, when allowed by the Negotiate request header Negotiability is a binary property: a resource is either transparently negotiated, or it is not. Origin servers SHOULD NOT vary the negotiability of a resource, or the variant list bound to that resource, based on the request headers which are received. The variant list and the property of being negotiated MAY however change through time. The Cache-Control header can be used to control the propagation of such time-dependent changes through caches. It is the responsibility of the author of the negotiable resource to ensure that all resources in the variant list serve the intended content, and that the variant resources do not engage in transparent content negotiation themselves. 12.2 Negotiation on transactions other than GET and HEAD If a resource is transparently negotiable, this only has an impact on the GET and HEAD transactions on the resource. It is not possible (under this specification) to do transparent content negotiation on the direct result of a POST request. However, a POST request can return an unnegotiated 303 (See Other) response which causes the user agent to do a GET request on a second resource. This second resource could then use transparent content negotiation to return an appropriate final response. The figure below illustrates this. Server ______ proxy ______ proxy ______ user x.org cache cache agent < ------------------------------------- | POST http://x.org/cgi/submit | <form contents in request body> | -------------------------------------- > 303 See Other | Location: http://x.org/result/OK | | < ------------------------------------- | GET http://x.org/result/OK | small Accept- headers | able to choose on behalf of user agent | ------------------------------------- > choice response with | ..result/OK.nl variant | displays OK.nl See the HTTP/1.1 specification [1] for details on the 303 (See Other) status code. Note that this status code is not understood by some HTTP/1.0 clients. 13 Proxy support for transparent negotiation Transparent content negotiation is an extension on top of HTTP/1.x. It is designed to work through any proxy which only implements the HTTP/1.1 specification [1]. If Expires headers are added as discussed in section 10.7, negotiation will also work though proxies which implement HTTP/1.0 [3]. Thus, every HTTP/1.0 or HTTP/1.1 proxy provides support for transparent content negotiation. However, if it is to be claimed that a HTTP/1.x proxy offers transparent content negotiation services, at least one of the specific optimizations below MUST be implemented. An HTTP/1.x proxy MUST ONLY optimize (change) the HTTP traffic flowing through it in ways which are explicitly allowed by the specification(s) it conforms to. A proxy which supports transparent content negotiation on top of HTTP/1.x MAY perform the optimizations allowed for by HTTP/1.x. In addition, it MAY perform three additional optimizations, defined below, on the HTTP traffic for transparently negotiated resources and their neighboring variant resources. First, when getting a request on a transparently negotiable resource from a user agent which supports transparent content negotiation, the proxy MAY return any cached, fresh list response from that resource, even if the selecting request headers, as specified by the Vary header, do not match. Second, when allowed by the user agent and origin server, a proxy MAY reuse an Alternates header taken from a previous response (section 10.4) to run a remote variant selection algorithm. If the algorithm has sufficient information to choose a best variant, and if the best variant is a neighboring variant, the proxy MAY return a choice response with this variant. Third, if a proxy receives a choice response, it MAY extract and cache the normal response embedded therein, as described in section 10.5. 14 Security and privacy considerations 14.1 Accept- headers revealing information of a private nature Accept- headers, in particular Accept-Language headers, may reveal information which the user would rather keep private unless it will directly improve the quality of service. For example, a user may not want to send language preferences to sites which do not offer multi-lingual content. The transparent content negotiation mechanism allows user agents to omit sending of the Accept-Language header by default, without adversely affecting the outcome of the negotiation process if transparently negotiated multi-lingual content is accessed. However, even if Accept- headers are never sent, the automatic selection and retrieval of a variant by a user agent will reveal a preference for this variant to the server. A malicious service author could provide a page with `fake' negotiability on (ethnicity-correlated) languages, with all variants actually being the same English document, as a means of obtaining privacy-sensitive information. Such a plot would however be visible to an alert victim if the list of available variants and their properties is reviewed. Some additional privacy considerations connected to Accept- headers are discussed in [1]. 14.2 Spoofing of responses from variant resources The caching optimization in section 10.5 gives the implementer of a negotiable resource control over the responses cached for all neighboring variant resources. This is a security problem if a neighboring variant resource belongs to another author. To provide security in this case, the HTTP server will have to filter the Content-Location headers in the choice responses generated by the negotiable resource implementation. 15 Acknowledgments Work on HTTP content negotiation has been done since at least 1993. The authors are unable to trace the origin of many of the ideas incorporated in this document. This specification builds on an earlier incomplete specification of content negotiation recorded in [2]. Many members of the HTTP working group have contributed to the negotiation model in this specification. The authors wish to thank the individuals who have commented on earlier versions of this document, including Brian Behlendorf, Daniel DuBois, Martin J. Duerst, Roy T. Fielding, Jim Gettys, Yaron Goland, Dirk van Gulik, Ted Hardie, Scott Lawrence, Larry Masinter, Jeffrey Mogul, Henrik Frystyk Nielsen, Frederick G.M. Roeber, Paul Sutton, and Klaus Weide. 16 References [1] R. Fielding, J. Gettys, J. C. Mogul, H. Frystyk, and T. Berners-Lee. Hypertext Transfer Protocol -- HTTP/1.1. RFC 2068, HTTP Working Group, January, 1997. [2] Roy T. Fielding, Henrik Frystyk Nielsen, and Tim Berners-Lee. Hypertext Transfer Protocol -- HTTP/1.1. Internet-Draft draft-ietf-http-v11-spec-01.txt, HTTP Working Group, January, 1996. [3] T. Berners-Lee, R. Fielding, and H. Frystyk. Hypertext Transfer Protocol -- HTTP/1.0. RFC 1945. MIT/LCS, UC Irvine, May 1996. [4] K. Holtman, A. Mutz. Feature Tag Registration Procedures. Internet-Draft draft-ietf-http-feature-reg-00.txt, HTTP Working Group, October 30, 1996. [5] K. Holtman, A. Mutz. HTTP Remote Variant Selection Algorithm -- RVSA/1.0. Internet-Draft draft-ietf-http-rvsa-v10-00.txt, HTTP Working Group. 17 Authors' addresses Koen Holtman Technische Universiteit Eindhoven Postbus 513 Kamer HG 6.57 5600 MB Eindhoven (The Netherlands) Email: koen@win.tue.nl Andrew H. Mutz Hewlett-Packard Company 1501 Page Mill Road 3U-3 Palo Alto CA 94304, USA Fax +1 415 857 4691 Email: mutz@hpl.hp.com 18 Appendix: Example of aGET request on the resource. It SHOULD also be able to send appropriate list responses for HEAD requests.local variant selection algorithm Alist response MUST ALWAYS be sent ifnegotiating user agent will choose therequest includesbest variant from aNegotiate headervariant list withonly a "trans" directive. If the Negotiate header allows it, the origin server MAY runaremotelocal variant selection algorithm.IfThis section contains an example of such an algorithm. The inputs of the algorithmhas sufficient information to chooseare abest variant, and if the bestvariantis a neighboring variant, the origin server MAY return a choice response with this variant. When getting a request on a transparently negotiable resourcelist froma user agentan Alternates header, and an agent-side configuration database, whichdoes not support transparent content negotiation,contains - theorigin server MAY use a custom algorithm to select between sending a list, choice, or ad hoc response. When getting a request on a transparently negotiable resource,feature set for theorigin server MUST NEVER return a response with a 2xx status code or any 3xx status code, except 304, which is not a list, choice, or ad hoc response. Negotiability is a binary property:current request, - aresource is either transparently negotiated, or it is not. Origin servers SHOULD NOT vary the negotiabilitycollection ofa resource, or the variant list boundquality values assigned tothat resource, based onmedia types, languages, and charsets for therequest headerscurrent request, following the model of the corresponding HTTP/1.1 [1] Accept* headers, - a table whichare received. The variant listlists `forbidden' combinations of media types andthe propertycharsets, i.e. combinations which cannot be displayed because ofbeing negotiated MAY however change through time.some internal user agent limitation. TheCache-Control header can be used to control the propagationoutput ofsuch time-dependent changes through caches. Itthe algorithm is either theresponsibility ofbest variant, or theauthorconclusion that none of thenegotiable resource to ensure that all resourcesvariants are acceptable. 18.1 Computing overall quality values As a first step in the local variantlist serve the intended content, and thatselection algorithm, the overall qualities associated with all variantresources do not engagedescriptions intransparent content negotiation themselves. 12.2 Negotiation on transactions other than GET and HEAD If a resource is transparently negotiable, this only has an impact on the GET and HEAD transactions on the resource. It is not possible (under this specification) to do transparent content negotiation onthedirect resultlist are computed. The overall quality Q of aPOST request. However, a POST request can return an unnegotiated 303 (See Other) response which causesvariant description is theuser agent to do a GET request onvalue Q = round5( qs * qt * qc * ql * qf * qa ) where rounds5 is asecond resource. This second resource could then use transparent content negotiation to return an appropriate final response. The figure below illustrates this. Server ______ proxy ______ proxy ______ user x.org cache cache agent < ------------------------------------- | POST http://x.org/cgi/submit | <form contents in request body> | -------------------------------------- > 303 See Other | Location: http://x.org/result/OK | | < ------------------------------------- | GET http://x.org/result/OK | small Accept- headers | ablefunction which rounds a floating point value tochoose on behalf of5 decimal places after the point. It is assumed that the user agent| ------------------------------------- > choice response with | ..result/OK.nlcan run on multiple platforms: the rounding function makes the algorithm independent of the exact characteristics of the underlying floating point hardware. The factors qs, qt, qc, ql, qf, and qa are determined as follows. qs Is the source quality factor in the variant| displays OK.nl Seedescription. qt The media type quality factor is 1 if there is no type attribute in theHTTP/1.1 specification [1] for details onvariant description. Otherwise, it is the303 (See Other) status code. Note thatquality value assigned to thisstatus code is not understoodtype bysome HTTP/1.0 clients. 13 Proxy support for transparent negotiation Transparent content negotiationthe configuration database. If the database does not assign a value, then the factor isan extension on top of HTTP/1.x. It0. qc The charset quality factor isdesigned1 if there is no charset attribute in the variant description. Otherwise, it is the quality value assigned towork through any proxy which only implementsthis charset by theHTTP/1.1 specification [1].configuration database. IfExpires headers are added as discussed in section 10.7, negotiation will also work though proxies which implement HTTP/1.0 [3]. Thus, every HTTP/1.0 or HTTP/1.1 proxy provides support for transparent content negotiation. However,the database does not assign a value, then the factor is 0. ql The language quality factor is 1 if there is no language attribute in the variant description. Otherwise, it is the highest quality value the configuration database assigns tobe claimed that a HTTP/1.x proxy offers transparent content negotiation services, at least oneany of the languages listed in the language attribute. If the database does not assign a value to any of thespecific optimizations below MUST be implemented. An HTTP/1.x proxy MUST ONLY optimize (change)languages listed, then theHTTP traffic flowing through itfactor is 0. qf The features quality factor is 1 if there is no features attribute inways which are explicitly allowed bythespecification(s)variant description. Otherwise, itconforms to. A proxy which supports transparent content negotiation on top of HTTP/1.x MAY performis theoptimizations allowedquality degradation factor computed forby HTTP/1.x. In addition, it MAY perform three additional optimizations, defined below, ontheHTTP trafficfeatures attribute using the feature set fortransparently negotiated resources and their neighboringthe current request. qa The quality adjustment factor is 0 if the variantresources. First, when getting a request on a transparently negotiable resource fromdescription lists auser agentmedia type - charset combination whichsupports transparent content negotiation,is `forbidden' by theproxy MAY return any cached, freshtable, and 1 otherwise. As an example, if a variant listresponse from that resource, evencontains the variant description {"paper.2" 0.7 {type text/html} {language fr}} and if theselecting request headers, as specified byconfiguration database contains the quality value assignments types: text/html;q=1.0, type application/postscript;q=0.8 languages: en;q=1.0, fr;q=0.5 then the local variant selection algorithm will compute the overall quality for the variant description as follows: {"paper.2" 0.7 {type text/html} {language fr}} | | | | | | V V V round5 ( 0.7 * 1.0 * 0.5 ) = 0.35000 With same configuration database, the variant list {"paper.1" 0.9 {type text/html} {language en}}, {"paper.2" 0.7 {type text/html} {language fr}}, {"paper.3" 1.0 {type application/postscript} {language en}} would yield the following computations: round5 ( qs * qt * qc * ql * qf * qa ) = Q --- --- --- --- --- --- paper.1: 0.9 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 = 0.90000 paper.1: 0.7 * 1.0 * 1.0 * 0.5 * 1.0 * 1.0 = 0.35000 paper.3: 1.0 * 0.8 * 1.0 * 1.0 * 1.0 * 1.0 = 0.80000 18.2 Determining the result Using all computed overall quality values, theVary header, do not match. Second, when allowed byend result of theuser agent and origin server, a proxy MAY reuse an Alternates header taken from a previous response (section 10.4) to run a remotelocal variant selectionalgorithm.algorithm is determined as follows. If all overall quality values are 0, then thealgorithm has sufficient information to choose abest variant is the fallback variant,andif there is one in the list, else the result is the conclusion that none of the variants are acceptable. If at least one overall quality value is greater than 0, then the best variant isa neighboring variant,theproxy MAY return a choice responsevariant which has the description withthis variant. Third, if a proxy receives a choice response, it MAY extract and cachethenormal response embedded therein, as described in section 10.5. 14 Security and privacy considerations 14.1 Accept- headers revealing information of a private nature Accept- headers, in particular Accept-Language headers, may reveal informationhighest overall quality value, or, if there are multiple variant descriptions which share theuser would rather keep private unless it will directly improve thehighest overall quality value, the variant ofservice. For example, a user may not want to send language preferences to sitesthe first variant description in the list whichdo not offer multi-lingual content. The transparent content negotiation mechanism allows user agents to omit sending ofhas this highest overall quality value. 18.3 Ranking dimensions Consider the following variant list: {"paper.greek" 1.0 {language el} {charset ISO-8859-7}}, {"paper.english" 1.0 {language en} {charset ISO-8859-1}} It could be theAccept-Language header by default, without adversely affectingcase that theoutcome ofuser prefers thenegotiation process if transparently negotiated multi-lingual content is accessed. However, even if Accept- headers are never sent,language "el" over "en", while theautomatic selection and retrieval of a variant by auser agentwill reveal a preference for thiscan render "ISO-8859-1" better than "ISO-8859-7". The result is that in the language dimension, the first varianttois best, while theserver. A malicious service author could provide a page with `fake' negotiability on (ethnicity-correlated) languages, with all variants actually beingsecond variant is best in thesame English document, as a means of obtaining privacy-sensitive information. Such a plotcharset dimension. In this situation, it wouldhoweverbevisiblepreferable toan alert victim ifchoose thelist of available variants and their properties is reviewed. Some additional privacy considerations connected to Accept- headers are discussed in [1]. 14.2 Spoofing of responses fromfirst variantresources The caching optimizationas the best variant: the user settings insection 10.5 givestheimplementer of a negotiable resource controllanguage dimension should take precedence over theresponses cached for all neighboring variant resources. This is a security problem if a neighboring variant resource belongs to another author. To provide securityhard-coded values in the charset dimension. To express thiscase,ranking between dimensions, theHTTP server willuser agent configuration database should haveto filter the Content-Location headersa higher spread in thechoice responses generated byquality values for thenegotiable resource implementation. 15 Acknowledgments Work on HTTP content negotiation has been done since at least 1993. The authors are unable to tracelanguage dimension than for theorigin of many ofcharset dimension. For example, with languages: el;q=1.0, en-gb;q=0.7, en;q=0.6, da;q=0, ... charsets: ISO-8859-1;q=1.0, ISO-8859-7;q=0.95, ISO-8859-5;q=0.97, unicode-1-1;q=0, ... theideas incorporated in this document. This specification builds onfirst variant will have anearlier incomplete specification of content negotiation recorded in [2]. Many membersoverall quality of 0.95000, while theHTTP working groupsecond variant will havecontributed toan overall quality 0.70000. This makes thenegotiation model in this specification. The authors wish to thankfirst variant theindividuals who have commented on earlier versions of this document, including Brian Behlendorf, Daniel DuBois, Roy T. Fielding, Dirk van Gulik, Ted Hardie, Larry Masinter, Jeffrey Mogul, Frederick G.M. Roeber, Paul Sutton, and Klaus Weide. 16 References [1] R. Fielding, J. Gettys, J. C. Mogul, H. Frystyk, and T. Berners-Lee. Hypertext Transfer Protocol -- HTTP/1.1. RFC 2068, HTTP Working Group, January, 1997. [2] Roy T. Fielding, Henrik Frystyk Nielsen, and Tim Berners-Lee. Hypertext Transfer Protocol -- HTTP/1.1. Internet-Draft draft-ietf-http-v11-spec-01.txt, HTTP Working Group, January, 1996. [3] T. Berners-Lee, R. Fielding, and H. Frystyk. Hypertext Transfer Protocol -- HTTP/1.0. RFC 1945. MIT/LCS, UC Irvine, May 1996. [4] K. Holtman, A. Mutz. Feature Tag Registration Procedures. Internet-Draft draft-ietf-http-feature-reg-00.txt, HTTP Working Group, October 30, 1996. [5] K. Holtman, A. Mutz. HTTP Remote Variant Selection Algorithm -- RVSA/1.0. Internet-Draft draft-ietf-http-rvsa-v10-00.txt, HTTP Working Group. 17 Authors' addresses Koen Holtman Technische Universiteit Eindhoven Postbus 513 Kamer HG 6.57 5600 MB Eindhoven (The Netherlands) Email: koen@win.tue.nl Andrew H. Mutz Hewlett-Packard Company 1501 Page Mill Road 3U-3 Palo Alto CA 94304, USA Fax +1 415 857 4691 Email: mutz@hpl.hp.com 18best variant. 19 Appendix: feature negotiation examples This appendix contains examples of the use of feature tags in variant descriptions. The tag names used here are examples only, they do not in general reflect the tag naming scheme proposed in [4].18.119.1 Use of feature tags Feature tags can be used in variant lists to express the quality degradation associated with the presence or absence of certain features. One example is {"index.html.plain" 0.7 }, {"index.html" 1.0 {features tables frames}} Here, the "{features tables frames}" part expresses that index.html uses the features tagged as tables and frames. If these features are absent, the overall quality of index.html degrades to 0. Another example is {"home.graphics" 1.0 {features !textonly}}, {"home.textonly" 0.7 } where the "{features !textonly}" part expresses that home.graphics requires the absence of the textonly feature. If the feature is present, the overall quality of home.graphics degrades to 0. The absence of a feature need not always degrade the overall quality to 0. In the example {"x.html.1" 1.0 {features fonts/0.7}} the absence of the fonts feature degrades the quality with a factor of 0.7. "fonts/0.7" can be pronounced as "fonts, or a degradation of 0.7". Finally, in the example {"y.html" 1.0 {features [blebber wolx] }} The "[blebber wolx]" expresses that y.html requires the presence of the blebber feature or the wolx feature. This construct can be used in a number of cases: 1. blebber and wolx actually tag the same feature, but they were registered by different people, and some user agents say they support blebber while others say they support wolx. 2. blebber and wolx are HTML tags of different vendors which implement the same functionality, and which are used together in y.html without interference. 3. blebber and wolx are HTML tags of different vendors which implement the same functionality, and y.html uses the tags in a conditional HTML construct. 4. blebber is a complicated HTML tag with only a sketchy definition, implemented by one user agent vendor, and wolx indicates implementation of a well-defined subset of the blebber tag by some other vendor(s). y.html uses only this well-defined subset.18.219.2 Use of numeric feature tags As an example of negotiation in a numeric area, the following variant list describes four variants with title graphics designed for increasing screen widths: {"home.pda" 1.0 {featuresscreenwidth=<-199>screenwidth=[-199] }}, {"home.narrow" 1.0 {featuresscreenwidth=<200-599>screenwidth=[200-599] }}, {"home.normal" 1.0 {featuresscreenwidth=<600-999>screenwidth=[600-999] }}, {"home.wide" 1.0 {featuresscreenwidth=<1000->screenwidth=[1000-] }}, {"home.normal"} The last element of the list specifies a safe default for user agents which do not implement screen width negotiation. Such user agents will reject the first four variants as unusable, as they seem to rely on a feature which they do not understand.18.319.3 Feature tag design When designing a new feature tag, it is important to take into account that existing user agents, which do not recognize the new tag will treat the feature as absent. In general, a new feature tag needs to be designed in such a way that absence of the tag is the default case which reflects current practice. If this design principle is ignored, the resulting feature tag will generally be unusable. As an example, one could try to support negotiation between monochrome and color content by introducing a `color' feature tag, the presence of which would indicate the capability to display color graphics. However, if this new tag is used in a variant list, for example {"rainbow.gif" 1.0 {features color} } {"rainbow.mono.gif" 0.6 {features !color}} then existing user agents, which would not recognize the color tag, would all display the monochrome rainbow. The color tag is therefore unusable in situations where optimal results for existing user agents are desired. To provide for negotiation in this area, one must introduce a `monochrome' feature tag; its presence indicates that the user agent can only render (or the user prefers to view) monochrome graphics.1920 Appendix: origin server implementation considerations19.120.1 Implementation with a CGI script Transparent content negotiation has been designed to allow a broad range of implementation options at the origin server side. A very minimal implementation can be done using the CGI interface. The CGI script below is an example. #!/bin/sh cat - <<'blex' TCN: list Alternates: {"stats.tables.html" 1.0 {type text/html} {features tables}}, {"stats.html" 0.8 {type text/html}}, {"stats.ps" 0.95 {type application/postscript}} Vary: * Content-Type: text/html <title>Multiple Choices for Web Statistics</title> <h2>Multiple Choices for Web Statistics:</h2> <ul> <li><a href=stats.tables.html>Version with HTML tables</a> <p> <li><a href=stats.html>Version without HTML tables</a> <p> <li><a href=stats.ps>Postscript version</a> </ul> blex The Alternates header in the above script must be read as a single line. The script always generates a list response with the 200 (OK) code, which ensures compatibility with non-negotiating HTTP/1.0 agents.19.220.2 Direct support by HTTP servers Sophisticated HTTP servers could make a transparent negotiation module available to content authors. Such a module could incorporate a remote variant selection algorithm and an implementation of the algorithm for generating choice responses (section 10.2). The definition of interfaces to such modules is beyond the scope of this specification.19.320.3 Web publishing tools Web publishing tools could automatically generate several variants of a document (for example the original TeX version, a HTML version with tables, a HTML version without tables, and a Postscript version), together with an appropriate variant list in the interface format of a HTTP server transparent negotiation module. This would allow documents to be published as transparently negotiable resources.2021 Appendix: Example of choice response construction The following is an example of the construction of a choice response by a proxy cache which supports HTTP/1.1 and transparent content negotiation. The use of the HTTP/1.1 conditional request mechanisms is also shown. Assume that a user agent has cached a variant list with the validator "1234" for the negotiable resource http://x.org/paper. Also assume that it has cached responses from two neighboring variants, with the entity tags "gonkyyyy" and W/"a;b". Assume that all three user agent cache entries are stale: they would need to be revalidated before the user agent can use them. If http://x.org/paper accessed in this situation, the user agent could send the following request to its proxy cache: GET /paper HTTP/1.1 Host: x.org User-Agent: WuxtaWeb/2.4 Negotiate: 1.0 Accept: text/html, application/postscript;q=0.4, */* Accept-Language: en If-None-Match: "gonkyyyy;1234", W/"a;b;1234" Assume that the proxy cache has cached the same three items as the user agent, but that it has revalidated the variant list 8000 seconds ago, so that the list is still fresh for the proxy. This means that the proxy can run a remote variant selection algorithm on the list and the incoming request. Assume that the remote algorithm is able to choose paper.en.html as the best variant. The proxy can now construct a choice response, using the algorithm in section 10.2. In steps 1 and 2 of the algorithm, the proxy can construct the following conditional request on the best variant, and send it to the origin server: GET /paper.html.en HTTP/1.1 Host: x.org User-Agent: WuxtaWeb/2.4 Negotiate: 1.0 Accept: text/html, application/postscript;q=0.4, */* Accept-Language: en If-None-Match: "gonkyyyy", W/"a;b" Via: 1.1 fred On receipt of the response HTTP/1.1 304 Not Modified Date: Tue, 11 Jun 1996 20:05:31 GMT Etag: "gonkyyyy" from the origin server, the proxy can use its freshly revalidated paper.html.en cache entry to expand the response to a non-304 response: HTTP/1.1 200 OK Date: Tue, 11 Jun 1996 20:05:31 GMT Content-Type: text/html Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT Content-Length: 5327 Cache-control: max-age=604800 Etag: "gonkyyyy" Via: 1.1 fred Age: 0 <title>A paper about .... Using this 200 response, the proxy can construct a choice response in step 4 of the algorithm: HTTP/1.1 200 OK Date: Tue, 11 Jun 1996 20:05:31 GMT TCN: choice Content-Type: text/html Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT Content-Length: 5327 Cache-control: max-age=604800 Content-Location: paper.html.en Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, {"paper.html.fr" 0.7 {type text/html} {language fr}}, {"paper.ps.en" 1.0 {type application/postscript} {language en}} Etag: "gonkyyyy;1234" Vary: negotiate, accept, accept-language Expires: Thu, 01 Jan 1980 00:00:00 GMT Via: 1.1 fred Age: 8000 <title>A paper about .... The choice response can subsequently be shortened to a 304 response, because of the If-None-Match header in the original request from the user agent. Thus, the proxy can finally return HTTP/1.1 304 Not Modified Date: Tue, 11 Jun 1996 20:05:31 GMT Etag: "gonkyyyy;1234" Content-Location: paper.html.en Vary: negotiate, accept, accept-language Expires: Thu, 01 Jan 1980 00:00:00 GMT Via: 1.1 fred Age: 8000 to the user agent. Expires:September 9,November 26, 1997 ----