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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24