/[suikacvs]/webroot/www/2004/id/draft-ietf-http-negotiation-02.txt
Suika

Contents of /webroot/www/2004/id/draft-ietf-http-negotiation-02.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Tue Jun 15 08:04:04 2004 UTC (20 years, 10 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
New

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24