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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24