1 |
wakaba |
1.1 |
Internet-Draft Koen Holtman/TUE |
2 |
|
|
Expires: February 14, 1997 August 14, 1996 |
3 |
|
|
|
4 |
|
|
|
5 |
|
|
Transparent Content Negotiation in HTTP |
6 |
|
|
|
7 |
|
|
draft-holtman-http-negotiation-02.txt |
8 |
|
|
|
9 |
|
|
|
10 |
|
|
STATUS OF THIS MEMO |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
This document is an Internet-Draft. Internet-Drafts are |
14 |
|
|
working documents of the Internet Engineering Task Force |
15 |
|
|
(IETF), its areas, and its working groups. Note that other |
16 |
|
|
groups may also distribute working documents as |
17 |
|
|
Internet-Drafts. |
18 |
|
|
|
19 |
|
|
Internet-Drafts are draft documents valid for a maximum of |
20 |
|
|
six months and may be updated, replaced, or obsoleted by |
21 |
|
|
other documents at any time. It is inappropriate to use |
22 |
|
|
Internet-Drafts as reference material or to cite them other |
23 |
|
|
than as "work in progress". |
24 |
|
|
|
25 |
|
|
To learn the current status of any Internet-Draft, please |
26 |
|
|
check the "1id-abstracts.txt" listing contained in the |
27 |
|
|
Internet-Drafts Shadow Directories on ftp.is.co.za |
28 |
|
|
(Africa), nic.nordu.net (Europe), munnari.oz.au (Pacific |
29 |
|
|
Rim), ds.internic.net (US East Coast), or ftp.isi.edu (US |
30 |
|
|
West Coast). |
31 |
|
|
|
32 |
|
|
Distribution of this document is unlimited. Please send |
33 |
|
|
comments to the HTTP working group at |
34 |
|
|
<http-wg@cuckoo.hpl.hp.com>. Discussions of the working |
35 |
|
|
group are archived at |
36 |
|
|
<URL:http://www.ics.uci.edu/pub/ietf/http/>. General |
37 |
|
|
discussions about HTTP and the applications which use HTTP |
38 |
|
|
should take place on the <www-talk@w3.org> mailing list. |
39 |
|
|
|
40 |
|
|
|
41 |
|
|
ABSTRACT |
42 |
|
|
|
43 |
|
|
HTTP allows one to put multiple versions of the same |
44 |
|
|
information under a single URL. Transparent content |
45 |
|
|
negotiation is a mechanism, layered on top of HTTP, for |
46 |
|
|
automatically selecting the best version when the URL is |
47 |
|
|
accessed. This enables the smooth deployment of new web data |
48 |
|
|
formats and markup tags. |
49 |
|
|
|
50 |
|
|
Design goals for transparent content negotiation include low |
51 |
|
|
overhead on the request message size, downwards compatibility, |
52 |
|
|
extensibility, enabling the rapid introduction of new areas of |
53 |
|
|
negotiation, scalability, low cost of minimal support, end |
54 |
|
|
user control, and good cachability. |
55 |
|
|
|
56 |
|
|
|
57 |
|
|
TABLE OF CONTENTS |
58 |
|
|
|
59 |
|
|
1 Introduction |
60 |
|
|
1.1 Background |
61 |
|
|
1.2 Note for readers |
62 |
|
|
|
63 |
|
|
2 Terminology |
64 |
|
|
2.1 Terms from HTTP/1.1 |
65 |
|
|
2.2 New terms |
66 |
|
|
|
67 |
|
|
3 Notation |
68 |
|
|
|
69 |
|
|
4 Overview |
70 |
|
|
4.1 Content negotiation |
71 |
|
|
4.2 HTTP/1.0 style negotiation scheme |
72 |
|
|
4.3 Transparent content negotiation scheme |
73 |
|
|
4.4 Optimizing the negotiation process |
74 |
|
|
4.5 Retrieving a variant by hand |
75 |
|
|
4.6 Dimensions of negotiation |
76 |
|
|
4.7 Feature negotiation |
77 |
|
|
|
78 |
|
|
5 Variant descriptions |
79 |
|
|
5.1 Syntax |
80 |
|
|
5.2 URI |
81 |
|
|
5.3 Source-quality |
82 |
|
|
5.4 Type, language, length, and charset. |
83 |
|
|
5.5 Features |
84 |
|
|
5.6 Description |
85 |
|
|
5.7 Extension-attribute |
86 |
|
|
|
87 |
|
|
6 Feature negotiation |
88 |
|
|
6.1 Feature tags |
89 |
|
|
6.2 Accept-Features header |
90 |
|
|
6.3 Feature predicates |
91 |
|
|
6.4 Features attribute |
92 |
|
|
|
93 |
|
|
7 Feature negotiation examples |
94 |
|
|
7.1 Use of feature tags |
95 |
|
|
7.2 Use of numeric feature tags |
96 |
|
|
|
97 |
|
|
8 Feature tag registration |
98 |
|
|
8.1 Evolution of feature tags |
99 |
|
|
8.2 Core set of feature tags |
100 |
|
|
8.3 Feature tag design |
101 |
|
|
|
102 |
|
|
9 Content negotiation response codes and headers |
103 |
|
|
9.1 506 Variant Also Negotiates |
104 |
|
|
9.2 Accept-Features |
105 |
|
|
9.3 Content-Features |
106 |
|
|
9.4 Alternates |
107 |
|
|
9.5 Alternates-Older |
108 |
|
|
9.6 Negotiate |
109 |
|
|
9.7 Variant-Vary |
110 |
|
|
|
111 |
|
|
10 Content negotiation responses |
112 |
|
|
10.1 List response |
113 |
|
|
10.2 Choice response |
114 |
|
|
10.2.1 Construction by origin servers |
115 |
|
|
10.2.2 Construction by proxies |
116 |
|
|
10.3 Reusing the Alternates header |
117 |
|
|
10.4 Extracting a normal response from a choice response |
118 |
|
|
10.5 Elaborate Vary headers |
119 |
|
|
10.5.1 Construction of an elaborate Vary header |
120 |
|
|
10.5.2 Caching of an elaborate Vary header |
121 |
|
|
|
122 |
|
|
11 The network negotiation algorithm |
123 |
|
|
11.1 Input |
124 |
|
|
11.2 Output |
125 |
|
|
11.2.1 Output for proxies |
126 |
|
|
11.2.2 Output for origin servers |
127 |
|
|
11.2.3 Output for user agents |
128 |
|
|
11.3 Computing the overall quality values |
129 |
|
|
11.4 Definite and speculative quality values |
130 |
|
|
11.5 Determining the result |
131 |
|
|
11.5.1 Result for proxies and origin servers |
132 |
|
|
11.5.2 Result for user agents |
133 |
|
|
11.6 Construction of short requests |
134 |
|
|
|
135 |
|
|
12 User agent support for transparent negotiation |
136 |
|
|
12.1 Handling of responses |
137 |
|
|
12.2 Presentation of a transparently negotiated resource |
138 |
|
|
|
139 |
|
|
13 Origin server support for transparent negotiation |
140 |
|
|
13.1 Requirements |
141 |
|
|
13.2 Negotiation on transactions other than GET and HEAD |
142 |
|
|
|
143 |
|
|
14 Proxy support for transparent negotiation |
144 |
|
|
|
145 |
|
|
15 Security and privacy considerations |
146 |
|
|
15.1 Accept headers revealing information of a private nature |
147 |
|
|
15.2 Spoofing of responses from variant resources |
148 |
|
|
|
149 |
|
|
16 Acknowledgments |
150 |
|
|
|
151 |
|
|
17 References |
152 |
|
|
|
153 |
|
|
18 Author's address |
154 |
|
|
|
155 |
|
|
19 Appendices |
156 |
|
|
19.1 Adding an Expires header to ensure HTTP/1.0 compatibility |
157 |
|
|
19.2 Origin server implementation considerations |
158 |
|
|
19.2.1 Implementation with a CGI script |
159 |
|
|
19.2.2 Direct support by the HTTP server |
160 |
|
|
19.2.3 Negotiable content authoring |
161 |
|
|
19.3 Open issues in transparent content negotiation |
162 |
|
|
19.4 Other negotiation specifications |
163 |
|
|
19.4.1 User-Agent Display Attributes Headers |
164 |
|
|
19.4.2 PEP: An Extension Mechanism for HTTP/1.1 |
165 |
|
|
19.5 Related issues |
166 |
|
|
19.5.1 Current negotiation practice |
167 |
|
|
19.5.2 Bandwidth negotiation |
168 |
|
|
19.5.3 Content transformation by proxies |
169 |
|
|
|
170 |
|
|
|
171 |
|
|
1 Introduction |
172 |
|
|
|
173 |
|
|
HTTP allows one to put multiple versions of the same |
174 |
|
|
information under a single URI. Each of these versions is called a |
175 |
|
|
`variant'. Transparent content negotiation is a mechanism, layered |
176 |
|
|
on top of the HTTP/1.1 protocol [1], for automatically and |
177 |
|
|
efficiently retrieving the best variant when a GET or HEAD request |
178 |
|
|
is made. This enables the smooth deployment of new web data |
179 |
|
|
formats and markup tags. |
180 |
|
|
|
181 |
|
|
Transparent negotiation is called `transparent' because it makes |
182 |
|
|
all variants inside the origin server visible to outside parties. |
183 |
|
|
|
184 |
|
|
|
185 |
|
|
1.1 Background |
186 |
|
|
|
187 |
|
|
The addition of content negotiation to the web infrastructure has |
188 |
|
|
been considered important since the early days of the web. Among |
189 |
|
|
the expected benefits of a sufficiently powerful system for content |
190 |
|
|
negotiation are |
191 |
|
|
|
192 |
|
|
* smooth deployment of new data formats and markup tags, |
193 |
|
|
allowing graceful evolution of the web |
194 |
|
|
|
195 |
|
|
* elimination of the need to choose between a `state of the art |
196 |
|
|
multimedia homepage' and one which can be viewed by all web |
197 |
|
|
users |
198 |
|
|
|
199 |
|
|
* ability to offer good service to a wider range of browsing |
200 |
|
|
platforms (from low-end PDA's to high-end VR setups) |
201 |
|
|
|
202 |
|
|
* elimination of the need for error-prone and cache-unfriendly |
203 |
|
|
User-Agent based negotiation |
204 |
|
|
|
205 |
|
|
* ability to construct sites without `click here for the X |
206 |
|
|
version' links |
207 |
|
|
|
208 |
|
|
* internationalization, and the ability to offer multi-lingual |
209 |
|
|
content without a bias towards one language. |
210 |
|
|
|
211 |
|
|
Nevertheless, the development of content negotiation has been a |
212 |
|
|
slow process, maybe because the expected benefits are mostly |
213 |
|
|
long-term benefits. Also, all immediately obvious content |
214 |
|
|
negotiation solutions involve the sending of larger HTTP request |
215 |
|
|
messages. Larger request messages are unacceptable to many people: |
216 |
|
|
a small overhead on the request size is often cited as the main |
217 |
|
|
technical requirement for any scheme which offers the above |
218 |
|
|
benefits. |
219 |
|
|
|
220 |
|
|
Therefore, a low overhead on the request message size is one of the |
221 |
|
|
main design goals of this specification; a large fraction of the |
222 |
|
|
text below is devoted to the definition of mechanisms for meeting |
223 |
|
|
this design goal. The desire to provide for good cachability in |
224 |
|
|
all cases accounts for another considerable part of the size of |
225 |
|
|
this document. |
226 |
|
|
|
227 |
|
|
Other design goals include downwards compatibility, extensibility, |
228 |
|
|
enabling the rapid introduction of new areas of negotiation, |
229 |
|
|
scalability, low cost of minimal support, and end user control. |
230 |
|
|
End user control, the option to manually retrieve other variants if |
231 |
|
|
desired, is the one redeeming quality of the `click here for the X |
232 |
|
|
version' type of negotiation, and it is considered important that |
233 |
|
|
this option is preserved. |
234 |
|
|
|
235 |
|
|
|
236 |
|
|
1.2 Note for readers |
237 |
|
|
|
238 |
|
|
Some sections in this document discuss requirements for proxy |
239 |
|
|
caches only. Implementers of origin servers and user agents (but |
240 |
|
|
not implementers of user agent caches) can skip these sections. |
241 |
|
|
The sections which can be skipped are: |
242 |
|
|
|
243 |
|
|
9.5 Alternates-Older |
244 |
|
|
9.7 Variant-Vary |
245 |
|
|
10.2.2 Choice response construction by proxies |
246 |
|
|
10.3 Reusing the Alternates header |
247 |
|
|
10.4 Extracting a normal response from a choice response |
248 |
|
|
10.5.2 Caching of an elaborate Vary header |
249 |
|
|
14 Proxy support for transparent negotiation |
250 |
|
|
|
251 |
|
|
The skipping of these sections is also recommended on first |
252 |
|
|
reading. |
253 |
|
|
|
254 |
|
|
|
255 |
|
|
2 Terminology |
256 |
|
|
|
257 |
|
|
2.1 Terms from HTTP/1.1 |
258 |
|
|
|
259 |
|
|
This specification mostly uses the terminology of the HTTP/1.1 |
260 |
|
|
specification [1]. The definitions below were reproduced from [1]. |
261 |
|
|
|
262 |
|
|
request |
263 |
|
|
An HTTP request message. |
264 |
|
|
|
265 |
|
|
response |
266 |
|
|
An HTTP response message. |
267 |
|
|
|
268 |
|
|
resource |
269 |
|
|
A network data object or service that can be identified by a URI. |
270 |
|
|
Resources may be available in multiple representations |
271 |
|
|
(e.g. multiple languages, data formats, size, resolutions) or |
272 |
|
|
vary in other ways. |
273 |
|
|
|
274 |
|
|
content negotiation |
275 |
|
|
The mechanism for selecting the appropriate representation when |
276 |
|
|
servicing a request. |
277 |
|
|
|
278 |
|
|
variant |
279 |
|
|
A resource may have one, or more than one, representation(s) |
280 |
|
|
associated with it at any given instant. Each of these |
281 |
|
|
representations is termed a `variant.' Use of the term `variant' |
282 |
|
|
does not necessarily imply that the resource is subject to |
283 |
|
|
content negotiation. |
284 |
|
|
|
285 |
|
|
client |
286 |
|
|
A program that establishes connections for the purpose of sending |
287 |
|
|
requests. |
288 |
|
|
|
289 |
|
|
user agent |
290 |
|
|
The client which initiates a request. These are often browsers, |
291 |
|
|
editors, spiders (web-traversing robots), or other end user |
292 |
|
|
tools. |
293 |
|
|
|
294 |
|
|
server |
295 |
|
|
An application program that accepts connections in order to |
296 |
|
|
service requests by sending back responses. Any given program may |
297 |
|
|
be capable of being both a client and a server; our use of these |
298 |
|
|
terms refers only to the role being performed by the program for |
299 |
|
|
a particular connection, rather than to the program's |
300 |
|
|
capabilities in general. Likewise, any server may act as an |
301 |
|
|
origin server, proxy, gateway, or tunnel, switching behavior |
302 |
|
|
based on the nature of each request. |
303 |
|
|
|
304 |
|
|
origin server |
305 |
|
|
The server on which a given resource resides or is to be created. |
306 |
|
|
|
307 |
|
|
proxy |
308 |
|
|
An intermediary program which acts as both a server and a client |
309 |
|
|
for the purpose of making requests on behalf of other |
310 |
|
|
clients. Requests are serviced internally or by passing them on, |
311 |
|
|
with possible translation, to other servers. A proxy must |
312 |
|
|
implement both the client and server requirements of this |
313 |
|
|
specification. |
314 |
|
|
|
315 |
|
|
first-hand |
316 |
|
|
A response is first-hand if it comes directly and without |
317 |
|
|
unnecessary delay from the origin server, perhaps via one or more |
318 |
|
|
proxies. A response is also first-hand if its validity has just |
319 |
|
|
been checked directly with the origin server. |
320 |
|
|
|
321 |
|
|
age |
322 |
|
|
The age of a response is the time since it was sent by, or |
323 |
|
|
successfully validated with, the origin server. |
324 |
|
|
|
325 |
|
|
fresh |
326 |
|
|
A response is fresh if its age has not yet exceeded its freshness |
327 |
|
|
lifetime. |
328 |
|
|
|
329 |
|
|
2.2 New terms |
330 |
|
|
|
331 |
|
|
transparently negotiable resource |
332 |
|
|
A resource which supports transparent content negotiation. A |
333 |
|
|
transparently negotiable resource always has a variant list bound |
334 |
|
|
to it, usually represented as an Alternates header. |
335 |
|
|
|
336 |
|
|
variant list |
337 |
|
|
The list of variants bound to a transparently negotiable |
338 |
|
|
resource. |
339 |
|
|
|
340 |
|
|
variant description |
341 |
|
|
A machine-readable description of a variant, usually found in a |
342 |
|
|
variant list. A variant description contains the variant |
343 |
|
|
resource URI and various attributes which describe properties of |
344 |
|
|
the variant. Variant descriptions are defined in Section 5. |
345 |
|
|
|
346 |
|
|
variant resource |
347 |
|
|
A resource from which a variant of a negotiable resource can be |
348 |
|
|
retrieved with a simple GET request. |
349 |
|
|
|
350 |
|
|
list response |
351 |
|
|
A list response contains the variant list of the negotiable |
352 |
|
|
resource, but no variant data. It is generated if the sever |
353 |
|
|
cannot or does not want to choose a particular best variant for |
354 |
|
|
the request. List responses are defined in Section 10.1. |
355 |
|
|
|
356 |
|
|
choice response |
357 |
|
|
A choice response contains both the variant list of the |
358 |
|
|
negotiable resource, and a representation of the best variant for |
359 |
|
|
the request. Choice responses are defined in Section 10.2. |
360 |
|
|
|
361 |
|
|
normal response |
362 |
|
|
A HTTP response which is not a list response or a choice |
363 |
|
|
response. Normal responses are never generated by transparently |
364 |
|
|
negotiable resources, and are always generated by variant |
365 |
|
|
resources. |
366 |
|
|
|
367 |
|
|
Accept headers |
368 |
|
|
The request headers Accept, Accept-Charset, Accept-Language, and |
369 |
|
|
Accept-Features. |
370 |
|
|
|
371 |
|
|
network negotiation algorithm |
372 |
|
|
A standardized algorithm by which a party in the negotiation |
373 |
|
|
process can choose a best variant on behalf of another party. |
374 |
|
|
The algorithm computes if the Accept headers in the request |
375 |
|
|
contain sufficient information to allow a choice, and, if so, |
376 |
|
|
which variant must be chosen. The network negotiation algorithm |
377 |
|
|
is defined in Section 11. |
378 |
|
|
|
379 |
|
|
neighbor |
380 |
|
|
Two resources are called neighbors if the absolute URI of the |
381 |
|
|
first resource up to its last slash equals the absolute URI of |
382 |
|
|
the second resource up to its last slash. The neighboring |
383 |
|
|
relation is important because of security considerations, see |
384 |
|
|
Section 15.2. |
385 |
|
|
|
386 |
|
|
[##Historical note: In the context of old versions of the HTTP/1.1 |
387 |
|
|
specification like [2], list responses can be called `pre-emptive |
388 |
|
|
negotiation responses', and choice responses can be called |
389 |
|
|
`reactive negotiation responses'.##] |
390 |
|
|
|
391 |
|
|
[##Note: In the context of the HTTP/1.1 specification [1], both |
392 |
|
|
list and choice responses are the result of server-driven |
393 |
|
|
negotiation, though a list response is a server-driven negotiation |
394 |
|
|
response meant to initiate agent-driven negotiation.##] |
395 |
|
|
|
396 |
|
|
|
397 |
|
|
3 Notation |
398 |
|
|
|
399 |
|
|
The notation [## ... ##] in this document encloses an editorial |
400 |
|
|
comment. Such a comment will be either removed or replaced by real |
401 |
|
|
text in the final version of this document. |
402 |
|
|
|
403 |
|
|
The version of BNF used in this document is taken from [1], and |
404 |
|
|
many of the nonterminals used are defined in [1]. |
405 |
|
|
|
406 |
|
|
One new BNF construct is added: |
407 |
|
|
|
408 |
|
|
1%rule |
409 |
|
|
|
410 |
|
|
stands for one or more instances of "rule", separated by |
411 |
|
|
whitespace: |
412 |
|
|
|
413 |
|
|
1%rule = rule *( 1*LWS rule ) |
414 |
|
|
|
415 |
|
|
|
416 |
|
|
4 Overview |
417 |
|
|
|
418 |
|
|
This section gives an overview of transparent content negotiation. |
419 |
|
|
It starts with a more general discussion of negotiation as provided |
420 |
|
|
by HTTP. |
421 |
|
|
|
422 |
|
|
|
423 |
|
|
4.1 Content negotiation |
424 |
|
|
|
425 |
|
|
HTTP/1.1 allows one to put multiple versions of the same |
426 |
|
|
information under a single resource URI. Each of these versions is |
427 |
|
|
called a `variant'. For example, a resource http://x.org/paper |
428 |
|
|
could bind to three different variants of a paper: |
429 |
|
|
|
430 |
|
|
1. HTML, English |
431 |
|
|
2. HTML, French |
432 |
|
|
3. Postscript, English |
433 |
|
|
|
434 |
|
|
Content negotiation is the process by which the best variant is |
435 |
|
|
selected if the resource is accessed. The selection is done by |
436 |
|
|
matching the properties of the available variants to the |
437 |
|
|
capabilities of the user agent and the preferences of the user. |
438 |
|
|
|
439 |
|
|
It has always been possible under HTTP to have multiple |
440 |
|
|
representations available for one resource, and to return the most |
441 |
|
|
appropriate representation for each subsequent request. However, |
442 |
|
|
HTTP/1.1 is the first version of HTTP which has provisions for |
443 |
|
|
doing this in a cache-friendly way. These provisions include the |
444 |
|
|
Vary response header, entity tags, and the If-None-Match request |
445 |
|
|
header. |
446 |
|
|
|
447 |
|
|
|
448 |
|
|
4.2 HTTP/1.0 style negotiation scheme |
449 |
|
|
|
450 |
|
|
The HTTP/1.0 protocol elements allow for a negotiation scheme as |
451 |
|
|
follows: |
452 |
|
|
|
453 |
|
|
Server _____ proxy _____ proxy _____ user |
454 |
|
|
x.org cache cache agent |
455 |
|
|
|
456 |
|
|
< ---------------------------------- |
457 |
|
|
| GET http://x.org/paper |
458 |
|
|
| Accept headers |
459 |
|
|
choose |
460 |
|
|
| |
461 |
|
|
---------------------------------- > |
462 |
|
|
Best variant |
463 |
|
|
|
464 |
|
|
When the resource is accessed, the user agent sends, along with its |
465 |
|
|
request, various Accept headers which express the user agent |
466 |
|
|
capabilities and the user preferences. Then, the origin server |
467 |
|
|
uses these Accept headers to choose the best variant, which is |
468 |
|
|
returned in the response. |
469 |
|
|
|
470 |
|
|
The biggest problem with this scheme is that it does not scale |
471 |
|
|
well. For all but the most minimal user agents, Accept headers |
472 |
|
|
expressing all capabilities and preferences would be very large, |
473 |
|
|
and sending them in every request would be hugely inefficient, in |
474 |
|
|
particular because only a small fraction of the resources on the |
475 |
|
|
web will have multiple variants. |
476 |
|
|
|
477 |
|
|
|
478 |
|
|
4.3 Transparent content negotiation scheme |
479 |
|
|
|
480 |
|
|
The transparent negotiation scheme eliminates the need to send huge |
481 |
|
|
Accept headers, and nevertheless allows for a selection process |
482 |
|
|
that always yields either the best variant, or an error message |
483 |
|
|
indicating that user agent is not capable of displaying any of the |
484 |
|
|
available variants. |
485 |
|
|
|
486 |
|
|
Under the transparent content negotiation scheme, the server sends |
487 |
|
|
a list with the available variants and their properties to the user |
488 |
|
|
agent. An example of a list with three variants is |
489 |
|
|
|
490 |
|
|
{"paper.html.en" 0.9 {type text/html} {language en}}, |
491 |
|
|
{"paper.html.fr" 0.7 {type text/html} {language fr}}, |
492 |
|
|
{"paper.ps.en" 1.0 {type application/postscript} {language en}} |
493 |
|
|
|
494 |
|
|
The syntax and semantics of the variant descriptions in this list |
495 |
|
|
are covered in depth in Section 5. When the list is received, the |
496 |
|
|
user agent can choose the best variant and retrieve it. |
497 |
|
|
Graphically, the communication can be represented as follows: |
498 |
|
|
|
499 |
|
|
Server _____ proxy _____ proxy _____ user |
500 |
|
|
x.org cache cache agent |
501 |
|
|
|
502 |
|
|
< ---------------------------------- |
503 |
|
|
| GET http://x.org/paper |
504 |
|
|
| |
505 |
|
|
----------------------------------- > [list response] |
506 |
|
|
return of list | |
507 |
|
|
choose |
508 |
|
|
| |
509 |
|
|
< ---------------------------------- |
510 |
|
|
| GET http://x.org/paper.html.en |
511 |
|
|
| |
512 |
|
|
---------------------------------- > [normal response] |
513 |
|
|
return of html.en |
514 |
|
|
|
515 |
|
|
The first response returning the list of variants is called a `list |
516 |
|
|
response'. The second response is a normal HTTP response: it does |
517 |
|
|
not contain special content negotiation related information. Only |
518 |
|
|
the user agent needs to know that the second request actually |
519 |
|
|
retrieves a variant, for the other parties in the communication, |
520 |
|
|
the second transaction is indistinguishable from a normal HTTP |
521 |
|
|
transaction. |
522 |
|
|
|
523 |
|
|
With this scheme, the information about capabilities and |
524 |
|
|
preferences is only used by the user agent itself. Therefore, the |
525 |
|
|
sending of such information in large Accept headers is unnecessary. |
526 |
|
|
Accept headers do have a limited use in transparent content |
527 |
|
|
negotiation however: the sending of small Accept headers can often |
528 |
|
|
speed up the negotiation process, this is covered in Section 4.4. |
529 |
|
|
|
530 |
|
|
List responses are covered in depth in Section 10.1. As an |
531 |
|
|
example, the list response in the above picture could be: |
532 |
|
|
|
533 |
|
|
HTTP/1.1 300 Multiple Choices |
534 |
|
|
Date: Tue, 11 Jun 1996 19:39:48 GMT |
535 |
|
|
Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, |
536 |
|
|
{"paper.html.fr" 0.7 {type text/html} {language fr}}, |
537 |
|
|
{"paper.ps.en" 1.0 {type application/postscript} |
538 |
|
|
{language en}} |
539 |
|
|
Vary: * |
540 |
|
|
Content-Type: text/html |
541 |
|
|
Content-Length: 227 |
542 |
|
|
|
543 |
|
|
<h2>Multiple Choices:</h2> |
544 |
|
|
<ul> |
545 |
|
|
<li><a href=paper.html.en>HTML, English version</a> |
546 |
|
|
<li><a href=paper.html.fr>HTML, French version</a> |
547 |
|
|
<li><a href=paper.ps.en>Postscript, English version</a> |
548 |
|
|
</ul> |
549 |
|
|
|
550 |
|
|
The HTML entity included in the response ensures compatibility with |
551 |
|
|
(existing) user agents which do not support transparent content |
552 |
|
|
negotiation. Such user agents will ignore the computer-readable |
553 |
|
|
list in the Alternates header and just display the HTML entity, |
554 |
|
|
allowing the user to select the best variant by hand. |
555 |
|
|
|
556 |
|
|
|
557 |
|
|
4.4 Optimizing the negotiation process |
558 |
|
|
|
559 |
|
|
The basic transparent negotiation scheme involves two HTTP |
560 |
|
|
transactions: one to retrieve the list, and a second one to retrieve |
561 |
|
|
the chosen variant. There are however several ways to `cut corners' |
562 |
|
|
in the data flow path of the basic scheme. |
563 |
|
|
|
564 |
|
|
First, caching proxies can cache both variant lists and complete |
565 |
|
|
responses. Such caching can reduce the communication overhead, as |
566 |
|
|
shown in the following example: |
567 |
|
|
|
568 |
|
|
Server _____ proxy _____ proxy __________ user |
569 |
|
|
x.org cache cache agent |
570 |
|
|
|
571 |
|
|
< -------------- |
572 |
|
|
| GET ../paper |
573 |
|
|
| |
574 |
|
|
has the list |
575 |
|
|
in cache |
576 |
|
|
| |
577 |
|
|
------------- > [list response] |
578 |
|
|
list | |
579 |
|
|
| |
580 |
|
|
choose |
581 |
|
|
| |
582 |
|
|
< -------------------------- |
583 |
|
|
| GET ../paper.html.en |
584 |
|
|
| |
585 |
|
|
has the variant |
586 |
|
|
in cache |
587 |
|
|
| |
588 |
|
|
-------------------------- > [normal response] |
589 |
|
|
return of html.en |
590 |
|
|
|
591 |
|
|
Second, the user agent can send small Accept headers which could |
592 |
|
|
allow a server to determine the choice the user agent would make on |
593 |
|
|
receiving the list. If the Accept headers contain enough |
594 |
|
|
information, the origin server can send back the variant directly: |
595 |
|
|
|
596 |
|
|
Server _____ proxy _____ proxy _____ user |
597 |
|
|
x.org cache cache agent |
598 |
|
|
|
599 |
|
|
< ---------------------------------- |
600 |
|
|
| GET http://x.org/paper |
601 |
|
|
| small Accept headers |
602 |
|
|
| |
603 |
|
|
able to choose on |
604 |
|
|
behalf of user agent |
605 |
|
|
| |
606 |
|
|
---------------------------------- > [choice response] |
607 |
|
|
return of html.en and list |
608 |
|
|
|
609 |
|
|
This choosing based on small accept headers can be done with the |
610 |
|
|
network negotiation algorithm (Section 11). This algorithm takes |
611 |
|
|
the variant list and the Accept headers as input. It computes if |
612 |
|
|
the Accept headers contain sufficient information to allow a choice |
613 |
|
|
on behalf of the user agent, and, if so, which variant must be |
614 |
|
|
chosen. |
615 |
|
|
|
616 |
|
|
The response in the above diagram is called a choice response: it |
617 |
|
|
transmits both the chosen variant and the list of all variants |
618 |
|
|
bound to the negotiable resource. Choice responses are covered in |
619 |
|
|
depth in Section 10.2. As an example, the choice response in the |
620 |
|
|
above picture could be: |
621 |
|
|
|
622 |
|
|
HTTP/1.1 200 OK |
623 |
|
|
Date: Tue, 11 Jun 1996 19:39:54 GMT |
624 |
|
|
Content-Type: text/html |
625 |
|
|
Content-Length: 5327 |
626 |
|
|
Content-Location: paper.html.en |
627 |
|
|
Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, |
628 |
|
|
{"paper.html.fr" 0.7 {type text/html} {language fr}}, |
629 |
|
|
{"paper.ps.en" 1.0 {type application/postscript} |
630 |
|
|
{language en}} |
631 |
|
|
Vary: * |
632 |
|
|
|
633 |
|
|
<title>A paper about .... |
634 |
|
|
|
635 |
|
|
Finally, the above two kinds of optimization can be combined: a |
636 |
|
|
caching proxy which has the list will sometimes be able to choose on |
637 |
|
|
behalf of the user agent. This could lead to the following |
638 |
|
|
communication pattern: |
639 |
|
|
|
640 |
|
|
Server _____ proxy _____ proxy __________ user |
641 |
|
|
x.org cache cache agent |
642 |
|
|
|
643 |
|
|
< --------------- |
644 |
|
|
| GET ../paper |
645 |
|
|
| small Accept |
646 |
|
|
| |
647 |
|
|
able to choose |
648 |
|
|
on behalf |
649 |
|
|
| |
650 |
|
|
< ---------- |
651 |
|
|
| GET ../paper.html.en |
652 |
|
|
| |
653 |
|
|
---------- > [normal response] |
654 |
|
|
html.en | |
655 |
|
|
---------------- > [choice response] |
656 |
|
|
html.en and list |
657 |
|
|
|
658 |
|
|
Here, the proxy cache nearest to the user agent was able to use a |
659 |
|
|
cached variant list to choose on behalf of the user agent. |
660 |
|
|
|
661 |
|
|
|
662 |
|
|
4.5 Retrieving a variant by hand |
663 |
|
|
|
664 |
|
|
If a transparently negotiated resource is accessed, the user agent |
665 |
|
|
will always at some point receive the list of available variants. |
666 |
|
|
The user agent can use this list to make available a menu (in HTML or |
667 |
|
|
not) which lists all variants and their characteristics to the user. |
668 |
|
|
Such a menu will allow the user to randomly browse other variants, |
669 |
|
|
and will also make it possible to manually correct any sub-optimal |
670 |
|
|
choice made by the automatic negotiation process. |
671 |
|
|
|
672 |
|
|
|
673 |
|
|
4.6 Dimensions of negotiation |
674 |
|
|
|
675 |
|
|
Transparent content negotiation defines four dimensions of |
676 |
|
|
negotiation: |
677 |
|
|
|
678 |
|
|
1. Media type (MIME type) |
679 |
|
|
2. Charset |
680 |
|
|
3. Language |
681 |
|
|
4. Features |
682 |
|
|
|
683 |
|
|
The first three dimensions have traditionally been present in HTTP. |
684 |
|
|
The fourth dimension is added by this specification. Additional |
685 |
|
|
dimensions, beyond the four mentioned above, could be added by |
686 |
|
|
future specifications. |
687 |
|
|
|
688 |
|
|
Negotiation on the content encoding of a response (gzipped, |
689 |
|
|
compressed, etc.) is left outside of the realm of transparent |
690 |
|
|
negotiation. Transparent negotiation does not prohibit proxies to |
691 |
|
|
encode or decode a relayed or cached response on the fly: the |
692 |
|
|
response still contains the same variant as far as transparent |
693 |
|
|
content negotiation is concerned. |
694 |
|
|
|
695 |
|
|
|
696 |
|
|
4.7 Feature negotiation |
697 |
|
|
|
698 |
|
|
Feature negotiation intends to provide for all areas of negotiation |
699 |
|
|
not covered by the type, charset, and language dimensions. |
700 |
|
|
Examples are negotiation on |
701 |
|
|
|
702 |
|
|
* HTML extensions |
703 |
|
|
* Extensions of other media types |
704 |
|
|
* Color capabilities of the user agent |
705 |
|
|
* Screen size |
706 |
|
|
* Output medium (screen, paper, ...) |
707 |
|
|
* Preference for speed vs. preference for graphical detail |
708 |
|
|
|
709 |
|
|
The feature negotiation framework is the main means by which |
710 |
|
|
transparent negotiation offers extensibility: a new dimension of |
711 |
|
|
negotiation (really a sub-dimension of the feature dimension) can be |
712 |
|
|
added without the need for a new standards effort, by the simple |
713 |
|
|
registration of a `feature tag'. |
714 |
|
|
|
715 |
|
|
|
716 |
|
|
5 Variant descriptions |
717 |
|
|
|
718 |
|
|
5.1 Syntax |
719 |
|
|
|
720 |
|
|
A variant can be described in a machine-readable way with a variant |
721 |
|
|
description. |
722 |
|
|
|
723 |
|
|
variant-descr = |
724 |
|
|
"{" <"> URI <"> |
725 |
|
|
source-quality |
726 |
|
|
[ "{" "type" media-type "}" ] |
727 |
|
|
[ "{" "charset" charset "}" ] |
728 |
|
|
[ "{" "language" 1#language-tag "}" ] |
729 |
|
|
[ "{" "length" 1*DIGIT "}" ] |
730 |
|
|
[ "{" "features" feature-list "}" ] |
731 |
|
|
[ "{" "description" quoted-string "}" ] |
732 |
|
|
[ extension-attribute ] |
733 |
|
|
"}" |
734 |
|
|
|
735 |
|
|
source-quality = qvalue |
736 |
|
|
|
737 |
|
|
extension-attribute = "{" extension-name extension-value "}" |
738 |
|
|
extension-name = token |
739 |
|
|
extension-value = *( token | quoted-string | LWS |
740 |
|
|
| extension-specials ) |
741 |
|
|
|
742 |
|
|
extension-specials = <any element of tspecials except <"> and "}"> |
743 |
|
|
|
744 |
|
|
Examples are |
745 |
|
|
|
746 |
|
|
{"paper.html.fr" 0.7 {type text/html} {language fr}} |
747 |
|
|
|
748 |
|
|
{"paper.html.tables" 0.9 {type text/html} {features tables}} |
749 |
|
|
|
750 |
|
|
The various attributes which can be present in a variant |
751 |
|
|
description are covered in the subsections below. |
752 |
|
|
|
753 |
|
|
|
754 |
|
|
5.2 URI |
755 |
|
|
|
756 |
|
|
The URI attribute gives the URI of the resource from which the |
757 |
|
|
variant can be retrieved with a GET request. It can be absolute or |
758 |
|
|
relative to the Request-URI. The variant resource may vary (on the |
759 |
|
|
Cookie request header, for example), but must not engage in |
760 |
|
|
transparent content negotiation itself. |
761 |
|
|
|
762 |
|
|
|
763 |
|
|
5.3 Source-quality |
764 |
|
|
|
765 |
|
|
The source-quality attribute gives the quality of the variant, as a |
766 |
|
|
representation of the negotiable resource, when this variant is |
767 |
|
|
rendered with a perfect rendering engine on the best possible |
768 |
|
|
output medium. |
769 |
|
|
|
770 |
|
|
If the source-quality is less than 1, it often expresses a quality |
771 |
|
|
degradation caused by a lossy conversion to a particular data |
772 |
|
|
format. For example, a picture originally in JPEG form would have |
773 |
|
|
a lower source quality when translated to the XBM format, and a |
774 |
|
|
much lower source quality when translated to an ASCII-art variant. |
775 |
|
|
Note, however, that degradation is a function of the source -- an |
776 |
|
|
original piece of ASCII-art may degrade in quality if it is |
777 |
|
|
captured in JPEG form. |
778 |
|
|
|
779 |
|
|
It is important that content providers do not assign very low |
780 |
|
|
source quality values without good reason, as this would limit the |
781 |
|
|
ability of users to influence the negotiation process with their |
782 |
|
|
own preference settings. The following table should be used as a |
783 |
|
|
guide when assigning source quality values: |
784 |
|
|
|
785 |
|
|
1.000 no degradation |
786 |
|
|
0.999-0.900 no noticeable degradation |
787 |
|
|
0.899-0.700 noticeable, but acceptable degradation |
788 |
|
|
0.699-0.500 barely acceptable degradation |
789 |
|
|
0.499-0.000 unacceptable degradation |
790 |
|
|
|
791 |
|
|
[##Issue to be resolved: can we come up with a word other than |
792 |
|
|
`degradation' that covers better the case of variants not converted |
793 |
|
|
from one source?##] |
794 |
|
|
|
795 |
|
|
When assigning source-quality values, content providers must not |
796 |
|
|
account for the size of the variant and its impact on transmission |
797 |
|
|
and rendering delays. Source-quality values are assigned assuming |
798 |
|
|
instantaneous transmission and rendering. This rule ensures that a |
799 |
|
|
future mechanism for bandwidth negotiation (see Appendix 19.5.2) |
800 |
|
|
can be cleanly added. |
801 |
|
|
|
802 |
|
|
|
803 |
|
|
5.4 Type, language, length, and charset. |
804 |
|
|
|
805 |
|
|
The type, language, and length attributes of a variant description |
806 |
|
|
can carry the same information as their Content-* response header |
807 |
|
|
counterparts as defined in [1]. The counterpart of the charset |
808 |
|
|
attribute is the charset parameter which can be present in the |
809 |
|
|
Content-Type response header, for example |
810 |
|
|
|
811 |
|
|
Content-Type: text/html; charset=ISO-8859-4 |
812 |
|
|
|
813 |
|
|
Though all of these attributes are optional, it is often desirable |
814 |
|
|
to include as many attributes as possible as this will increase the |
815 |
|
|
quality of the negotiation process. |
816 |
|
|
|
817 |
|
|
The length attribute, if present, must reflect the length of the |
818 |
|
|
variant only, not the length of the variant plus the length of any |
819 |
|
|
objects inlined or embedded by the variant. |
820 |
|
|
|
821 |
|
|
Note: A server need not necessarily maintain a one-to-one |
822 |
|
|
correspondence between attributes in the description of a |
823 |
|
|
variant and the Content-* headers in responses containing that |
824 |
|
|
variant. For example, if the variant description contains a |
825 |
|
|
language attribute, the response does not necessarily have to |
826 |
|
|
contain a Content-Language header, and if a Content-Language |
827 |
|
|
header is present, it does not have to contain an exact copy of |
828 |
|
|
the information in the language attribute. |
829 |
|
|
|
830 |
|
|
|
831 |
|
|
5.5 Features |
832 |
|
|
|
833 |
|
|
The features attribute specifies how the presence or absence of |
834 |
|
|
particular features in the user agent affects the overall quality of |
835 |
|
|
the variant. This attribute is covered in Section 6.4. |
836 |
|
|
|
837 |
|
|
|
838 |
|
|
5.6 Description |
839 |
|
|
|
840 |
|
|
The description attribute is meant to provide a textual description |
841 |
|
|
of the variant, to be displayed by a user agent when showing a menu |
842 |
|
|
of available variants (Section 12.2). This attribute can be |
843 |
|
|
included if the URI and normal attributes of a variant are |
844 |
|
|
considered too opaque to allow interpretation by the user. |
845 |
|
|
|
846 |
|
|
|
847 |
|
|
5.7 Extension-attribute |
848 |
|
|
|
849 |
|
|
The extension-attribute allows future specifications to |
850 |
|
|
incrementally define new dimensions of negotiation, and eases |
851 |
|
|
content negotiation experiments under HTTP/1.1. In experimental |
852 |
|
|
situations, servers must only generate extension-attributes whose |
853 |
|
|
names start with "x-". User agents should ignore all extension |
854 |
|
|
attributes they do not recognize. Proxies must not run the network |
855 |
|
|
negotiation algorithm if an unknown extension attribute is present |
856 |
|
|
in the variant list. |
857 |
|
|
|
858 |
|
|
|
859 |
|
|
6 Feature negotiation |
860 |
|
|
|
861 |
|
|
Feature negotiation has been introduced in Section 4.7. This |
862 |
|
|
section defines the feature negotiation mechanism, Section 7 |
863 |
|
|
contains examples of its use. |
864 |
|
|
|
865 |
|
|
|
866 |
|
|
6.1 Feature tags |
867 |
|
|
|
868 |
|
|
A feature tag (ftag) identifies a capability of a user agent or a |
869 |
|
|
preference of a user. A feature is said to be `present' in a user |
870 |
|
|
agent if the corresponding capability is implemented, or if the |
871 |
|
|
user has expressed corresponding preference. |
872 |
|
|
|
873 |
|
|
ftag = 1*<any CHAR except CTLs or tspecials or "!"> |
874 |
|
|
|
875 |
|
|
tspecials = "(" | ")" | "<" | ">" | "@" |
876 |
|
|
| "," | ";" | ":" | "\" | <"> |
877 |
|
|
| "/" | "[" | "]" | "?" | "=" |
878 |
|
|
| "{" | "}" | SP | HT |
879 |
|
|
|
880 |
|
|
(tspecials definition reproduced from [1]) |
881 |
|
|
|
882 |
|
|
Examples are |
883 |
|
|
|
884 |
|
|
ns_tables, fonts, blebber, wolx, screenwidth, colordepth |
885 |
|
|
|
886 |
|
|
An example of the use of feature tags in a variant description is |
887 |
|
|
|
888 |
|
|
{"index.html" 1.0 {type text/html} {features ns_tables ns_frames}} |
889 |
|
|
|
890 |
|
|
Feature-tags are case-insensitive. The definition of a feature tag |
891 |
|
|
may state that a feature tag, if present, must have associated with |
892 |
|
|
it a numeric value which reflects a particular capability or |
893 |
|
|
preference. For example, a feature tag `screenwidth' could be |
894 |
|
|
present with a value of 640. |
895 |
|
|
|
896 |
|
|
Note that it sometimes depends on context whether a feature tag |
897 |
|
|
expresses a capability or a preference. For a text-only browser, |
898 |
|
|
the `textonly' tag is naturally present, but the user of a |
899 |
|
|
graphical browser could set the tag to be present if text-only |
900 |
|
|
content is preferred to graphical content. |
901 |
|
|
|
902 |
|
|
As feature registration will be an ongoing process, it is generally |
903 |
|
|
not possible for a user agent to know the meaning of all feature |
904 |
|
|
tags it can possibly encounter in a variant description. A user |
905 |
|
|
agent should treat all features with tags unknown to it as absent. |
906 |
|
|
|
907 |
|
|
|
908 |
|
|
6.2 Accept-Features header |
909 |
|
|
|
910 |
|
|
The Accept-Features request header can be used by a client to give |
911 |
|
|
information about the presence or absence of certain features. |
912 |
|
|
|
913 |
|
|
Accept-Features = "Accept-Features" : #( ftag |
914 |
|
|
| "!" ftag |
915 |
|
|
| ftag "=" number |
916 |
|
|
| "*" |
917 |
|
|
) |
918 |
|
|
|
919 |
|
|
number = 1*DIGIT |
920 |
|
|
|
921 |
|
|
An example is: |
922 |
|
|
|
923 |
|
|
Accept-Features: blex, !blebber, colordepth=5, * |
924 |
|
|
|
925 |
|
|
A feature tag must never occur twice in an Accept-Features header. |
926 |
|
|
In the Accept-Features header, an ftag without a "!" indicates that |
927 |
|
|
the corresponding feature is present, but that is has no numeric |
928 |
|
|
value associated with it. An ftag with a "!" indicates that the |
929 |
|
|
corresponding feature is absent. An ftag with a number indicates |
930 |
|
|
that the corresponding feature is present with the given numeric |
931 |
|
|
value. |
932 |
|
|
|
933 |
|
|
The special construct "*", if present, makes all true feature |
934 |
|
|
predicates (Section 6.3) on feature tags not present in the header. |
935 |
|
|
Absence of the Accept-Features header in a request is equivalent to |
936 |
|
|
the inclusion of |
937 |
|
|
|
938 |
|
|
Accept-Features: * |
939 |
|
|
|
940 |
|
|
|
941 |
|
|
6.3 Feature predicates |
942 |
|
|
|
943 |
|
|
Feature predicates are used in the features attribute of a variant |
944 |
|
|
description. |
945 |
|
|
|
946 |
|
|
fpred = ( ftag ) |
947 |
|
|
| ( "!" ftag ) |
948 |
|
|
| ( ftag ">=" number ) |
949 |
|
|
| ( ftag "<" number ) |
950 |
|
|
|
951 |
|
|
Examples feature predicates are |
952 |
|
|
|
953 |
|
|
blebber, !blebber, colordepth>=5, blex<54 |
954 |
|
|
|
955 |
|
|
The network negotiation algorithm can compute the truth value of a |
956 |
|
|
feature predicate by using the contents of the Accept-Features |
957 |
|
|
header of the current request. |
958 |
|
|
|
959 |
|
|
If the ftag in a feature predicate appears in the Accept-Features |
960 |
|
|
header, the truth value of the predicate is defined as follows, |
961 |
|
|
depending on its form: |
962 |
|
|
|
963 |
|
|
ftag true if the feature is present according to the |
964 |
|
|
Accept-Features header, false otherwise. |
965 |
|
|
|
966 |
|
|
!ftag true if the feature is absent according to the |
967 |
|
|
Accept-Features header, false otherwise. |
968 |
|
|
|
969 |
|
|
ftag>=N true if the feature is present with a value greater than |
970 |
|
|
or equal to N according to the Accept-Features header, |
971 |
|
|
false otherwise. |
972 |
|
|
|
973 |
|
|
ftag<N true if the feature is present with a value less than N |
974 |
|
|
according to the Accept-Features header, false otherwise. |
975 |
|
|
|
976 |
|
|
[##Issues to be resolved: Add ftag<=N and ftag>N for symmetry? |
977 |
|
|
Add ftag=N? Add ftag=N as a synonym for ftag>=N?##] |
978 |
|
|
|
979 |
|
|
If the ftag in a feature predicate does not appear in the |
980 |
|
|
Accept-Features header, the value of the predicate is true if there |
981 |
|
|
is a "*" in the Accept-Features header, false otherwise. |
982 |
|
|
|
983 |
|
|
As an example, the header |
984 |
|
|
|
985 |
|
|
Accept-Features: blex, !blebber, colordepth=5, !screenwidth, * |
986 |
|
|
|
987 |
|
|
makes the following predicates true: |
988 |
|
|
|
989 |
|
|
blex, colordepth>=4, colordepth<6, colordepth, !screenwidth, |
990 |
|
|
frtnbf, !frtnbf, frtnbf>=4, frtnbf<4 |
991 |
|
|
|
992 |
|
|
and makes the following predicates false: |
993 |
|
|
|
994 |
|
|
!blex, blex>=0, blebber, colordepth>=6, !colordepth, |
995 |
|
|
screenwidth, screenwidth>=640, screenwidth<640 |
996 |
|
|
|
997 |
|
|
|
998 |
|
|
6.4 Features attribute |
999 |
|
|
|
1000 |
|
|
The features attribute |
1001 |
|
|
|
1002 |
|
|
"{" "features" feature-list "}" |
1003 |
|
|
|
1004 |
|
|
is used in a variant description to specify how the presence or |
1005 |
|
|
absence of particular features in the user agent affects the overall |
1006 |
|
|
quality of the variant. |
1007 |
|
|
|
1008 |
|
|
feature-list = 1%feature-list-element |
1009 |
|
|
|
1010 |
|
|
feature-list-element = ( fpred | fpred-bag ) |
1011 |
|
|
[ ":" true-improvement ] |
1012 |
|
|
[ "/" false-degradation ] |
1013 |
|
|
|
1014 |
|
|
fpred-bag = "[" 1%fpred "]" |
1015 |
|
|
|
1016 |
|
|
true-improvement = 1*3DIGIT [ "." 0*3DIGIT ] |
1017 |
|
|
false-degradation = 1*3DIGIT [ "." 0*3DIGIT ] |
1018 |
|
|
|
1019 |
|
|
Examples are: |
1020 |
|
|
|
1021 |
|
|
{features !textonly [blebber !wolx] colordepth>=3:0.7 } |
1022 |
|
|
|
1023 |
|
|
{features !blink/0.5 background:1.5 [blebber !wolx]:1.4/0.8 } |
1024 |
|
|
|
1025 |
|
|
The default value for the true-improvement is 1. The default value |
1026 |
|
|
for the false-degradation is 0, or 1 if a true-improvement value is |
1027 |
|
|
given. |
1028 |
|
|
|
1029 |
|
|
The network negotiation algorithm can compute the quality |
1030 |
|
|
degradation factor associated with the features attribute by |
1031 |
|
|
multiplying all quality degradation factors of the elements of the |
1032 |
|
|
feature-list. Note that the result can be a factor greater than 1. |
1033 |
|
|
|
1034 |
|
|
A feature list element yields its true-improvement factor if the |
1035 |
|
|
corresponding feature predicate is true, or if at least one element |
1036 |
|
|
of the corresponding fpred-bag is true. The element yields its |
1037 |
|
|
false-degradation factor otherwise. |
1038 |
|
|
|
1039 |
|
|
[##Issue to be resolved: It is unknown yet whether this features |
1040 |
|
|
attribute definition makes the right tradeoff between complexity |
1041 |
|
|
and (ease of) expressive power. The attribute grammar above is |
1042 |
|
|
designed to be parsable with simple non-recursive parsers. The |
1043 |
|
|
true-improvement construct does not add expressive power in a |
1044 |
|
|
theoretical sense, but does make the (automatic) construction of |
1045 |
|
|
variant lists more straightforward in many cases.##] |
1046 |
|
|
|
1047 |
|
|
[##Aside for mathematicians: note the similarity between the |
1048 |
|
|
feature-list |
1049 |
|
|
|
1050 |
|
|
[f1 !f2] [!f1 f3] |
1051 |
|
|
|
1052 |
|
|
and the conjunctive normal form of a boolean expression. This |
1053 |
|
|
similarity implies good things about the expressive power of the |
1054 |
|
|
features attribute. I have not yet explored how far this power |
1055 |
|
|
extends into the non-boolean domain.##] |
1056 |
|
|
|
1057 |
|
|
|
1058 |
|
|
7 Feature negotiation examples |
1059 |
|
|
|
1060 |
|
|
This section contains examples of the use of feature tags in |
1061 |
|
|
variant descriptions. |
1062 |
|
|
|
1063 |
|
|
[##Note: A future version of this document will probably revise and |
1064 |
|
|
extend this section.##] |
1065 |
|
|
|
1066 |
|
|
|
1067 |
|
|
7.1 Use of feature tags |
1068 |
|
|
|
1069 |
|
|
Feature tags can be used in variant lists to express the quality |
1070 |
|
|
degradation associated with the presence or absence of certain |
1071 |
|
|
features. One example is |
1072 |
|
|
|
1073 |
|
|
{"index.html.plain" 0.7 }, |
1074 |
|
|
{"index.html" 1.0 {features ns_tables ns_frames}} |
1075 |
|
|
|
1076 |
|
|
Here, the "{features ns_tables ns_frames}" part expresses that |
1077 |
|
|
index.html uses the features tagged as ns_tables and ns_frames. If |
1078 |
|
|
these features are absent, the overall quality of index.html degrades |
1079 |
|
|
to 0. Another example is |
1080 |
|
|
|
1081 |
|
|
{"home.graphics" 1.0 {features !textonly}}, |
1082 |
|
|
{"home.textonly" 0.7 } |
1083 |
|
|
|
1084 |
|
|
where the "{features !textonly}" part expresses that home.graphics |
1085 |
|
|
requires the absence of the textonly feature. If the feature is |
1086 |
|
|
present, the overall quality of home.graphics degrades to 0. |
1087 |
|
|
|
1088 |
|
|
The absence of a feature need not always degrade the overall quality |
1089 |
|
|
to 0. In the example |
1090 |
|
|
|
1091 |
|
|
{"x.html.1" 1.0 {features fonts/0.7}} |
1092 |
|
|
|
1093 |
|
|
the absence of the fonts feature degrades the quality with a factor |
1094 |
|
|
of 0.7. "fonts/0.7" can be pronounced as "fonts, or a degradation of |
1095 |
|
|
0.7". In the example |
1096 |
|
|
|
1097 |
|
|
{"x.html.2" 0.5 {features fonts:1.5}} |
1098 |
|
|
|
1099 |
|
|
the presence of the fonts feature improves the overall quality with a |
1100 |
|
|
factor of 1.5. If the fonts feature is absent, the overall quality is |
1101 |
|
|
not affected. "fonts:1.5" can be pronounced as "fonts improves with |
1102 |
|
|
1.5". Finally, in the example |
1103 |
|
|
|
1104 |
|
|
{"y.html" 1.0 {features [blebber wolx] }} |
1105 |
|
|
|
1106 |
|
|
The "[blebber wolx]" expresses that y.html requires the presence of |
1107 |
|
|
the blebber feature or the wolx feature. This construct can be |
1108 |
|
|
used in a number of cases: |
1109 |
|
|
|
1110 |
|
|
1. blebber and wolx actually tag the same feature, but they |
1111 |
|
|
were registered by different people, and some browsers say |
1112 |
|
|
they support blebber while others say they support wolx. |
1113 |
|
|
|
1114 |
|
|
2. blebber and wolx are HTML tags of different vendors which |
1115 |
|
|
implement the same functionality, and which were used |
1116 |
|
|
together in y.html without interference. |
1117 |
|
|
|
1118 |
|
|
3. blebber and wolx are HTML tags of different vendors which |
1119 |
|
|
implement the same functionality, and y.html uses conditional |
1120 |
|
|
HTML to provide versions using both tags [##Note: conditional |
1121 |
|
|
HTML does not yet exist, but it is something people are thinking |
1122 |
|
|
about.##] |
1123 |
|
|
|
1124 |
|
|
4. blebber is a complicated HTML tag with only a sketchy |
1125 |
|
|
definition, implemented by one browser vendor, and wolx |
1126 |
|
|
indicates implementation of a well-defined subset of the blebber |
1127 |
|
|
tag by some other vendor(s). y.html uses only this well-defined |
1128 |
|
|
subset. |
1129 |
|
|
|
1130 |
|
|
|
1131 |
|
|
7.2 Use of numeric feature tags |
1132 |
|
|
|
1133 |
|
|
As an example of negotiation in a numeric area, the following variant |
1134 |
|
|
list describes four variants with title graphics designed for |
1135 |
|
|
increasing screen widths: |
1136 |
|
|
|
1137 |
|
|
{"home.pda" 1.0 {features screenwidth<200}}, |
1138 |
|
|
{"home.narrow" 1.0 {features screenwidth>=200 screenwidth<600}}, |
1139 |
|
|
{"home.normal" 1.0 {features screenwidth>=600 screenwidth<1000}}, |
1140 |
|
|
{"home.wide" 1.0 {features screenwidth>=1000}} |
1141 |
|
|
|
1142 |
|
|
The above variant list has a serious problem, however: a user agent |
1143 |
|
|
not supporting screenwidth negotiation is given no guidance on |
1144 |
|
|
which variant to select. For such a user agent, the absence of the |
1145 |
|
|
screenwidth feature would degrade the overall quality of each |
1146 |
|
|
variant to 0. A variant list which solves this problem is |
1147 |
|
|
|
1148 |
|
|
{"home.pda" 1.0 {features screenwidth<200}}, |
1149 |
|
|
{"home.narrow" 1.0 {features screenwidth>=200 screenwidth<600}}, |
1150 |
|
|
{"home.normal" 0.95 }, |
1151 |
|
|
{"home.wide" 1.0 {features screenwidth>=1000}} |
1152 |
|
|
|
1153 |
|
|
With this list, a user agent which does not support the screenwidth |
1154 |
|
|
feature will always select the home.normal variant. A user agent |
1155 |
|
|
which does support the screenwidth feature will only select the |
1156 |
|
|
home.normal variant if its screen width is in the range 600..999. |
1157 |
|
|
|
1158 |
|
|
|
1159 |
|
|
8 Feature tag registration |
1160 |
|
|
|
1161 |
|
|
[##A specification of the feature tag registration process has not |
1162 |
|
|
yet been completed. This issue has yet to be discussed by the |
1163 |
|
|
http-wg.##] |
1164 |
|
|
|
1165 |
|
|
[##According to current plans, everybody will be allowed to register |
1166 |
|
|
feature tags: registration only requires that the tag follows the |
1167 |
|
|
syntax rules, and that a definition of the meaning of the tag is |
1168 |
|
|
supplied. In particular, registration will not require actual |
1169 |
|
|
implementation of a feature, and there will be no test on whether the |
1170 |
|
|
feature definition overlaps with another feature definition.##] |
1171 |
|
|
|
1172 |
|
|
[##It is unclear yet whether it is desirable for feature tags to |
1173 |
|
|
have some hierarchical structure, which would make it easier, for |
1174 |
|
|
example, to trace who registered the feature. All that is known |
1175 |
|
|
now is that it is desirable to have short feature tags. A naming |
1176 |
|
|
scheme like that for SGML-DTDs would probably yield feature tags |
1177 |
|
|
which are too long. The main advantage of having a registration |
1178 |
|
|
process at all is that it allows for short tags without running the |
1179 |
|
|
risk of `tag collision'.##] |
1180 |
|
|
|
1181 |
|
|
|
1182 |
|
|
8.1 Evolution of feature tags |
1183 |
|
|
|
1184 |
|
|
The feature negotiation mechanism is designed not to break if 1000+ |
1185 |
|
|
features, partially overlapping, are registered. This allows for |
1186 |
|
|
feature tag creation to be an evolutionary process, in which many |
1187 |
|
|
tags are created while only a few `survive' to become generally |
1188 |
|
|
used. |
1189 |
|
|
|
1190 |
|
|
As the development of new web content formats is currently in an |
1191 |
|
|
evolutionary phase, rather than a standardization phase, it is |
1192 |
|
|
thought that this evolutionary approach to feature tag creation has |
1193 |
|
|
the best chances of keeping up with new developments. |
1194 |
|
|
|
1195 |
|
|
It is expected that after the introduction of feature negotiation, |
1196 |
|
|
an explosion in feature tag registration will occur, and that only |
1197 |
|
|
some of these tags will end up being actively used to label |
1198 |
|
|
variants. Web indexing robots could, while traversing the web, |
1199 |
|
|
gather statistics about actual use of feature tags. These |
1200 |
|
|
statistics could be used by individuals to compile lists, intended |
1201 |
|
|
for content authors, of useful feature tags for particular areas of |
1202 |
|
|
negotiation. Note that this indexing activity is orthogonal to the |
1203 |
|
|
feature registration process. It is expected that, once an area of |
1204 |
|
|
negotiation is well-understood, this process will converge on a |
1205 |
|
|
commonly-used and commonly-recognized set of feature tags for that |
1206 |
|
|
area. |
1207 |
|
|
|
1208 |
|
|
|
1209 |
|
|
8.2 Core set of feature tags |
1210 |
|
|
|
1211 |
|
|
[##In order to jump-start feature negotiation, it seems useful to |
1212 |
|
|
define a `core set' of feature tags in a separate document. These |
1213 |
|
|
feature tags would cover the areas of negotiation which are |
1214 |
|
|
currently well understood, like negotiation on currently stable |
1215 |
|
|
HTML extensions. The transparent content negotiation specification |
1216 |
|
|
could then require (or strongly encourage) that user agents |
1217 |
|
|
implementing transparent content negotiation must recognize (not |
1218 |
|
|
support!) all tags in the core set. |
1219 |
|
|
|
1220 |
|
|
The core set could be defined in a non-standards track document |
1221 |
|
|
which would be completed along with this document.##] |
1222 |
|
|
|
1223 |
|
|
|
1224 |
|
|
8.3 Feature tag design |
1225 |
|
|
|
1226 |
|
|
When designing a new feature tag, it is important to take into |
1227 |
|
|
account that existing user agents, which will not recognize the new |
1228 |
|
|
tag, will treat the feature as absent. In general, a new feature |
1229 |
|
|
tag needs to be designed in such a way that absence of the tag is |
1230 |
|
|
the default case which reflects current practice. If this design |
1231 |
|
|
principle is ignored, the resulting feature tag will generally be |
1232 |
|
|
unusable. |
1233 |
|
|
|
1234 |
|
|
As an example, one could try to support negotiation between |
1235 |
|
|
monochrome and color content by introducing a `color' feature tag, |
1236 |
|
|
the presence of which would indicate the capability to display |
1237 |
|
|
color graphics. However, if this new tag is used in a variant |
1238 |
|
|
list, for example |
1239 |
|
|
|
1240 |
|
|
{"rainbow.gif" 1.0 {features color} } |
1241 |
|
|
{"rainbow.mono.gif" 0.6 {features !color}} |
1242 |
|
|
|
1243 |
|
|
then existing user agents, which would not recognize the color tag, |
1244 |
|
|
would all display the monochrome rainbow. The color tag is |
1245 |
|
|
therefore unusable in situations where optimal results for existing |
1246 |
|
|
user agents are desired. To provide for negotiation in this area, |
1247 |
|
|
one needs to introduce a `monochrome' feature tag, the presence of |
1248 |
|
|
which indicates that the user agent can only render monochrome |
1249 |
|
|
graphics. |
1250 |
|
|
|
1251 |
|
|
|
1252 |
|
|
9 Content negotiation response codes and headers |
1253 |
|
|
|
1254 |
|
|
This specification adds one new response code to those defined in |
1255 |
|
|
HTTP/1.1 [1]. This is a 5xx (Server Error) class response. It |
1256 |
|
|
also adds six new headers. |
1257 |
|
|
|
1258 |
|
|
|
1259 |
|
|
9.1 506 Variant Also Negotiates |
1260 |
|
|
|
1261 |
|
|
The server has an internal configuration error: the chosen variant |
1262 |
|
|
resource is configured to engage in transparent content negotiation |
1263 |
|
|
itself, and is therefore not a proper end point in the negotiation |
1264 |
|
|
process. |
1265 |
|
|
|
1266 |
|
|
|
1267 |
|
|
9.2 Accept-Features |
1268 |
|
|
|
1269 |
|
|
This request header was defined in Section 6.2. |
1270 |
|
|
|
1271 |
|
|
|
1272 |
|
|
9.3 Content-Features |
1273 |
|
|
|
1274 |
|
|
The Content-Features response header can be used by a server to |
1275 |
|
|
indicate how the presence or absence of particular features in the |
1276 |
|
|
user agent affects the overall quality of the response. |
1277 |
|
|
|
1278 |
|
|
Content-Features = "Content-Features" ":" feature-list |
1279 |
|
|
|
1280 |
|
|
|
1281 |
|
|
9.4 Alternates |
1282 |
|
|
|
1283 |
|
|
The Alternates response header is used to convey the list of |
1284 |
|
|
variants bound to a negotiable resource in a response, and can also |
1285 |
|
|
contain other directives for the content negotiation process. |
1286 |
|
|
|
1287 |
|
|
Alternates = "Alternates" ":" 1#( variant-descr |
1288 |
|
|
| alternates-directive ) |
1289 |
|
|
|
1290 |
|
|
alternates-directive = ( "max-age" "=" delta-seconds ) |
1291 |
|
|
| ( "min-q" "=" short-float ) |
1292 |
|
|
| "forward" |
1293 |
|
|
| extension-alternates-directive |
1294 |
|
|
|
1295 |
|
|
delta-seconds = 1*DIGIT |
1296 |
|
|
|
1297 |
|
|
short-float = 1*3DIGIT [ "." 0*3DIGIT ] |
1298 |
|
|
|
1299 |
|
|
extension-alternates-directive = |
1300 |
|
|
token [ "=" ( token | quoted-string ) ] |
1301 |
|
|
|
1302 |
|
|
An example is |
1303 |
|
|
|
1304 |
|
|
Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, |
1305 |
|
|
{"paper.html.fr" 0.7 {type text/html} {language fr}}, |
1306 |
|
|
{"paper.ps.en" 1.0 {type application/postscript} |
1307 |
|
|
{language en}}, |
1308 |
|
|
min-q=0.4 |
1309 |
|
|
|
1310 |
|
|
Any relative URI specified in a variant-descr field is relative to |
1311 |
|
|
the request-URI. The max-age directive, if present, specifies the |
1312 |
|
|
freshness lifetime of the information in the Alternates header. |
1313 |
|
|
The min-q and forward directives, if present, can influence |
1314 |
|
|
decisions made by the network negotiation algorithm on behalf of |
1315 |
|
|
the origin server. Clients should ignore all |
1316 |
|
|
extension-alternates-directives they do not understand. |
1317 |
|
|
|
1318 |
|
|
[##Question to be resolved: should this header be called |
1319 |
|
|
`Variants'? Probably not, the 1.1 spec already announced that it |
1320 |
|
|
would be called `Alternates'.##] |
1321 |
|
|
|
1322 |
|
|
|
1323 |
|
|
9.5 Alternates-Older |
1324 |
|
|
|
1325 |
|
|
The Alternates-Older response header conveys an estimate of the age |
1326 |
|
|
difference between the Alternates header contained in a choice |
1327 |
|
|
response and the variant data contained in the response. The age |
1328 |
|
|
is measured as the time since generation or revalidation at the |
1329 |
|
|
origin server, as in the HTTP/1.1 specification [1]. |
1330 |
|
|
|
1331 |
|
|
Alternates-Older = "Alternates-Older" ":" signed-delta-seconds |
1332 |
|
|
|
1333 |
|
|
signed-delta-seconds = [ "-" ] 1*DIGIT |
1334 |
|
|
|
1335 |
|
|
A positive value means that the Alternates header is older, a |
1336 |
|
|
negative value means that the Alternates header is less old. If |
1337 |
|
|
the Alternates-Older header is absent, it is known or estimated |
1338 |
|
|
that there is no age difference between the Alternates header and |
1339 |
|
|
the variant data. An example is |
1340 |
|
|
|
1341 |
|
|
Alternates-Older: 5433 |
1342 |
|
|
|
1343 |
|
|
This header is important for proxies which negotiate using cached |
1344 |
|
|
variant lists, see Section 10.3. Only negotiating proxies need to be |
1345 |
|
|
able to construct Alternates-Older headers, see Section 10.2.2. |
1346 |
|
|
|
1347 |
|
|
[##Note: The age of the Alternates header cannot be conveyed in an |
1348 |
|
|
Alternates-Age header, because plain HTTP/1.1 caching proxies would |
1349 |
|
|
only update the Age header, not the Alternates-Age header, when |
1350 |
|
|
serving a choice response from cache memory.##] |
1351 |
|
|
|
1352 |
|
|
|
1353 |
|
|
9.6 Negotiate |
1354 |
|
|
|
1355 |
|
|
The Negotiate request header can contain directives for any content |
1356 |
|
|
negotiation process initiated by the request. Presence of this |
1357 |
|
|
header indicates that the user agent supports transparent content |
1358 |
|
|
negotiation for the current request. |
1359 |
|
|
|
1360 |
|
|
Negotiate = "Negotiate" ":" #negotiate-directive |
1361 |
|
|
|
1362 |
|
|
negotiate-directive = token [ "=" ( token | quoted-string ) ] |
1363 |
|
|
|
1364 |
|
|
An example is |
1365 |
|
|
|
1366 |
|
|
Negotiate: |
1367 |
|
|
|
1368 |
|
|
This specification does not define any negotiate-directives, this |
1369 |
|
|
is left to future extensions. Servers should ignore all |
1370 |
|
|
negotiate-directives they do not understand. The presence or |
1371 |
|
|
absence of a Negotiate header in a request is significant in |
1372 |
|
|
calculations performed by the network negotiation algorithm. |
1373 |
|
|
|
1374 |
|
|
[#Question to be resolved: is it safer to put a keyword in the |
1375 |
|
|
negotiate header to signal transparent negotiation capability? |
1376 |
|
|
Some cache implementations might treat an empty Negotiate header |
1377 |
|
|
the same as an absent Negotiate header under Vary: negotiate. Is |
1378 |
|
|
the 1.1 spec clear enough on this?##] |
1379 |
|
|
|
1380 |
|
|
|
1381 |
|
|
9.7 Variant-Vary |
1382 |
|
|
|
1383 |
|
|
The Variant-Vary response header can be used in a list response to |
1384 |
|
|
record any vary information which applies to the variant data |
1385 |
|
|
contained in the response, rather than to the response as a whole. |
1386 |
|
|
|
1387 |
|
|
Variant-Vary = "Variant-Vary" ":" ( "*" | 1#field-name ) |
1388 |
|
|
|
1389 |
|
|
Use of the Variant-Vary header is discussed in Section 10.2.1. |
1390 |
|
|
|
1391 |
|
|
|
1392 |
|
|
10 Content negotiation responses |
1393 |
|
|
|
1394 |
|
|
A request on a transparently negotiated resource can yield two |
1395 |
|
|
types of non-error responses: list responses and choice responses. |
1396 |
|
|
A list response contains only the list of variants bound to the |
1397 |
|
|
negotiable resource, and is generated if the sever cannot or does |
1398 |
|
|
not want to choose a particular best variant for the request. A |
1399 |
|
|
choice response contains both the list and a representation of the |
1400 |
|
|
best variant. |
1401 |
|
|
|
1402 |
|
|
Normal responses are non-error responses generated by requests on |
1403 |
|
|
resources which are not transparently negotiated. A normal |
1404 |
|
|
response never contains an Alternates header, a list or choice |
1405 |
|
|
response always contains an Alternates header. A list response |
1406 |
|
|
always has the 300 (Multiple Choices) status code, a choice |
1407 |
|
|
response never has the 300 status code. |
1408 |
|
|
|
1409 |
|
|
|
1410 |
|
|
10.1 List response |
1411 |
|
|
|
1412 |
|
|
A list response has the 300 response status code, and must contain, |
1413 |
|
|
besides the normal headers required by HTTP, the Alternates header |
1414 |
|
|
bound to the negotiable resource, a Vary header and, unless it was |
1415 |
|
|
a HEAD request, an entity body which allows the user to manually |
1416 |
|
|
select the best variant. |
1417 |
|
|
|
1418 |
|
|
An example a list response is: |
1419 |
|
|
|
1420 |
|
|
HTTP/1.1 300 Multiple Choices |
1421 |
|
|
Date: Tue, 11 Jun 1996 20:02:21 GMT |
1422 |
|
|
Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, |
1423 |
|
|
{"paper.html.fr" 0.7 {type text/html} {language fr}}, |
1424 |
|
|
{"paper.ps.en" 1.0 {type application/postscript} |
1425 |
|
|
{language en}}, max-age=86400 |
1426 |
|
|
Vary: negotiate, accept, accept-language |
1427 |
|
|
Etag: "gonkyyyy" |
1428 |
|
|
Cache-control: max-age=86400 |
1429 |
|
|
Content-Type: text/html |
1430 |
|
|
Content-Length: 227 |
1431 |
|
|
|
1432 |
|
|
<h2>Multiple Choices:</h2> |
1433 |
|
|
<ul> |
1434 |
|
|
<li><a href=paper.html.en>HTML, English version</a> |
1435 |
|
|
<li><a href=paper.html.fr>HTML, French version</a> |
1436 |
|
|
<li><a href=paper.ps.en>Postscript, English version</a> |
1437 |
|
|
</ul> |
1438 |
|
|
|
1439 |
|
|
Note that the same max-age value appears both in the Alternates |
1440 |
|
|
header and in the Cache-Control header. |
1441 |
|
|
|
1442 |
|
|
The Vary header in the response should ensure correct handling by |
1443 |
|
|
HTTP/1.1 caching proxies not capable of transparent content |
1444 |
|
|
negotiation. This header can either be |
1445 |
|
|
|
1446 |
|
|
Vary: * |
1447 |
|
|
|
1448 |
|
|
or a more elaborate header, see Section 10.5.1. |
1449 |
|
|
|
1450 |
|
|
Only the origin server may construct list responses. List |
1451 |
|
|
responses are cachable unless indicated otherwise. A proxy may |
1452 |
|
|
reuse a list response as a whole if the response is fresh in the |
1453 |
|
|
sense of the HTTP/1.1 specification [1], even if the Alternates |
1454 |
|
|
header in the response is no longer fresh by itself. |
1455 |
|
|
|
1456 |
|
|
According to the HTTP/1.1 specification [1], a user agent not |
1457 |
|
|
capable of transparent content negotiation will, when receiving a |
1458 |
|
|
list response, display the entity body included in the response. |
1459 |
|
|
If the response contains a Location header, however, the user agent |
1460 |
|
|
may automatically redirect to this location. |
1461 |
|
|
|
1462 |
|
|
The handling of list responses by clients supporting transparent |
1463 |
|
|
content negotiation is described in Sections 12.1 and 14. |
1464 |
|
|
|
1465 |
|
|
[##Issue to be resolved: Some existing HTTP/1.0 user agents crash |
1466 |
|
|
when getting a 300 response without a Location header. This |
1467 |
|
|
problem may be big enough to warrant the allocation of an extra |
1468 |
|
|
list response code outside of the 3xx class for possible use in |
1469 |
|
|
responses to HTTP/1.0 clients.##] |
1470 |
|
|
|
1471 |
|
|
|
1472 |
|
|
10.2 Choice response |
1473 |
|
|
|
1474 |
|
|
A choice response merges a normal HTTP response from the chosen |
1475 |
|
|
variant with a Content-Location header giving the location of the |
1476 |
|
|
variant, and the Alternates and Vary headers bound to the |
1477 |
|
|
negotiable resource. |
1478 |
|
|
|
1479 |
|
|
The cachability of a choice response as a whole is defined in the |
1480 |
|
|
HTTP/1.1 specification [1]. Depending on the response code, a |
1481 |
|
|
choice response as a whole is either cachable unless indicated |
1482 |
|
|
otherwise, or uncachable. |
1483 |
|
|
|
1484 |
|
|
10.2.1 Construction by origin servers |
1485 |
|
|
|
1486 |
|
|
Origin servers must construct choice responses with the |
1487 |
|
|
following algorithm, or any other algorithm which gives equal |
1488 |
|
|
results. |
1489 |
|
|
|
1490 |
|
|
1. Construct a HTTP request message on the best variant resource |
1491 |
|
|
by rewriting the request-URI and Host header (if appropriate) |
1492 |
|
|
of the received request message on the negotiable resource. |
1493 |
|
|
|
1494 |
|
|
2. Generate a valid HTTP response message for the request message |
1495 |
|
|
constructed in step 1. |
1496 |
|
|
|
1497 |
|
|
3. Check for an internal server configuration error. If the HTTP |
1498 |
|
|
response message generated in step 2 contains an Alternates |
1499 |
|
|
header, a Content-Location header, or has the 300 status code, |
1500 |
|
|
then the best variant resource is not a proper end point in |
1501 |
|
|
the negotiation process, and a 506 (Variant Also Negotiates) |
1502 |
|
|
error response message should be generated instead of going to |
1503 |
|
|
step 4. |
1504 |
|
|
|
1505 |
|
|
4. Add a number of headers to the HTTP response message generated |
1506 |
|
|
in step 2. |
1507 |
|
|
|
1508 |
|
|
a. Add a Content-Location header giving the location of the |
1509 |
|
|
chosen variant. |
1510 |
|
|
|
1511 |
|
|
Note: According to the HTTP/1.1 specification [1], if |
1512 |
|
|
the Content-Location header contains a relative URI, |
1513 |
|
|
this URI is relative to the URI in the Content-Base |
1514 |
|
|
header, if present. |
1515 |
|
|
|
1516 |
|
|
b. If any Vary headers are present in the response message |
1517 |
|
|
from step 2, add, for every Vary header, a Variant-Vary |
1518 |
|
|
header with a copy of the contents of this Vary header. |
1519 |
|
|
|
1520 |
|
|
c. Add the Alternates header bound to the negotiable resource. |
1521 |
|
|
|
1522 |
|
|
d. Add a Vary header to ensure correct handling by HTTP/1.1 |
1523 |
|
|
caching proxies not capable of transparent content |
1524 |
|
|
negotiation. This header can either be |
1525 |
|
|
|
1526 |
|
|
Vary: * |
1527 |
|
|
|
1528 |
|
|
or a more elaborate header, see Section 10.5.1. |
1529 |
|
|
|
1530 |
|
|
e. To ensure compatibility with HTTP/1.0 caching proxies which |
1531 |
|
|
do not recognize the Vary header, an Expires header with a |
1532 |
|
|
date in the past may be added. See Appendix 19.1 for more |
1533 |
|
|
information. |
1534 |
|
|
|
1535 |
|
|
An example of a choice response generated by an origin server is: |
1536 |
|
|
|
1537 |
|
|
HTTP/1.1 200 OK |
1538 |
|
|
Date: Tue, 11 Jun 1996 20:05:31 GMT |
1539 |
|
|
Content-Type: text/html |
1540 |
|
|
Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT |
1541 |
|
|
Etag: "497542" |
1542 |
|
|
Cache-control: max-age=604800 |
1543 |
|
|
Content-Length: 5327 |
1544 |
|
|
Content-Location: paper.html.en |
1545 |
|
|
Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, |
1546 |
|
|
{"paper.html.fr" 0.7 {type text/html} {language fr}}, |
1547 |
|
|
{"paper.ps.en" 1.0 {type application/postscript} |
1548 |
|
|
{language en}}, max-age=86400 |
1549 |
|
|
Vary: negotiate, accept, accept-language |
1550 |
|
|
Expires: Thu, 01 Jan 1980 00:00:00 GMT |
1551 |
|
|
|
1552 |
|
|
<title>A paper about .... |
1553 |
|
|
|
1554 |
|
|
|
1555 |
|
|
10.2.2 Construction by proxies |
1556 |
|
|
|
1557 |
|
|
Proxies must construct choice responses with the following |
1558 |
|
|
algorithm, or any other algorithm which gives equal results. |
1559 |
|
|
|
1560 |
|
|
1. Same as in Section 10.2.1. |
1561 |
|
|
|
1562 |
|
|
2. Obtain a fresh or first-hand HTTP response message for the |
1563 |
|
|
request message constructed in step 1. The message can be |
1564 |
|
|
obtained from cache memory, or by passing the constructed HTTP |
1565 |
|
|
request message towards the origin server. |
1566 |
|
|
|
1567 |
|
|
3. Same as in Section 10.2.1. |
1568 |
|
|
|
1569 |
|
|
4. Add a number of headers to the HTTP response message generated |
1570 |
|
|
in step 2. |
1571 |
|
|
|
1572 |
|
|
a. Same as in Section 10.2.1. |
1573 |
|
|
|
1574 |
|
|
b. Same as in Section 10.2.1. |
1575 |
|
|
|
1576 |
|
|
c. Add a fresh or first-hand Alternates header bound to the |
1577 |
|
|
negotiable resource. Section 10.3 specifies how this |
1578 |
|
|
header can be obtained. |
1579 |
|
|
|
1580 |
|
|
d. Add a Vary header to ensure correct handling by HTTP/1.1 |
1581 |
|
|
caching proxies not capable of transparent content |
1582 |
|
|
negotiation. This header can either be |
1583 |
|
|
|
1584 |
|
|
Vary: * |
1585 |
|
|
|
1586 |
|
|
or a more elaborate fresh or first-hand header, |
1587 |
|
|
Section 10.5.2 specifies how this header can be obtained. |
1588 |
|
|
|
1589 |
|
|
e. Same as in Section 10.2.1. |
1590 |
|
|
|
1591 |
|
|
f. Compute the age difference between the Alternates header |
1592 |
|
|
in the response in the following way. |
1593 |
|
|
|
1594 |
|
|
- Let variant_age be the age of the response obtained in |
1595 |
|
|
step 2, calculated according to the rules in the HTTP/1.1 |
1596 |
|
|
specification [1]. If the response is known to be |
1597 |
|
|
first-hand, variant_age can be 0. |
1598 |
|
|
|
1599 |
|
|
- Let alternates_age be the age of the Alternates header |
1600 |
|
|
added in step c, calculated according to the rules in |
1601 |
|
|
Section 10.3, or 0 if the Alternates header is known to |
1602 |
|
|
be first-hand. |
1603 |
|
|
|
1604 |
|
|
- Compute the age difference: |
1605 |
|
|
|
1606 |
|
|
alternates_older = alternates_age - variant_age |
1607 |
|
|
|
1608 |
|
|
If the computed alternates_older value is greater than 0, |
1609 |
|
|
an Alternates-Older header with this value must be added to |
1610 |
|
|
the response. If the value is 0, an Alternates-Older |
1611 |
|
|
header with this value need not be added. If the value is |
1612 |
|
|
less than 0, an Alternates-Older header with this value |
1613 |
|
|
should be added. |
1614 |
|
|
|
1615 |
|
|
An example of a choice response which could be sent by a caching |
1616 |
|
|
proxy is: |
1617 |
|
|
|
1618 |
|
|
HTTP/1.1 200 OK |
1619 |
|
|
Date: Tue, 11 Jun 1996 20:05:31 GMT |
1620 |
|
|
Content-Type: text/html |
1621 |
|
|
Last-Modified: Mon, 10 Jun 1996 10:01:14 GMT |
1622 |
|
|
Etag: "497542" |
1623 |
|
|
Cache-control: max-age=604800 |
1624 |
|
|
Content-Length: 5327 |
1625 |
|
|
Age: 432000 |
1626 |
|
|
Content-Location: paper.html.en |
1627 |
|
|
Alternates: {"paper.html.en" 0.9 {type text/html} {language en}}, |
1628 |
|
|
{"paper.html.fr" 0.7 {type text/html} {language fr}}, |
1629 |
|
|
{"paper.ps.en" 1.0 {type application/postscript} |
1630 |
|
|
{language en}}, max-age=86400 |
1631 |
|
|
Vary: negotiate, accept, accept-language |
1632 |
|
|
Alternates-Older: -410400 |
1633 |
|
|
Expires: Thu, 01 Jan 1980 00:00:00 GMT |
1634 |
|
|
|
1635 |
|
|
<title>A paper about .... |
1636 |
|
|
|
1637 |
|
|
Here, the age of the variant data is 432000 seconds (5 days), while |
1638 |
|
|
the age of the Alternates header is 432000 + -410400 = 21600 |
1639 |
|
|
seconds (6 hours). |
1640 |
|
|
|
1641 |
|
|
|
1642 |
|
|
10.3 Reusing the Alternates header |
1643 |
|
|
|
1644 |
|
|
Proxy caches may extract and cache the Alternates header in any |
1645 |
|
|
cachable list or choice response. If the Alternates header is |
1646 |
|
|
fresh or first-hand, it may be reused to negotiate on behalf of the |
1647 |
|
|
user agent or origin server (Section 14) and to construct choice |
1648 |
|
|
responses (Section 10.2.2). The freshness of an Alternates header |
1649 |
|
|
is determined in the following way. |
1650 |
|
|
|
1651 |
|
|
- Let response_age be the current age of the response from which |
1652 |
|
|
the header was extracted, calculated according to the rules in |
1653 |
|
|
the HTTP/1.1 specification [1]. |
1654 |
|
|
|
1655 |
|
|
- Let alternates_older be the value in the Alternates-Older |
1656 |
|
|
header of this response, or 0 if no Alternates-Older header is |
1657 |
|
|
present. |
1658 |
|
|
|
1659 |
|
|
- Let max_age be the value of the max-age directive in the |
1660 |
|
|
Alternates header, or positive infinity if a max-age directive |
1661 |
|
|
is absent. |
1662 |
|
|
|
1663 |
|
|
The age of the alternates header is |
1664 |
|
|
|
1665 |
|
|
alternates_age = response_age + alternates_older . |
1666 |
|
|
|
1667 |
|
|
The Alternates header is fresh if |
1668 |
|
|
|
1669 |
|
|
alternates_age < max_age . |
1670 |
|
|
|
1671 |
|
|
An Alternates header is fist-hand if it is used, without unnecessary |
1672 |
|
|
delay, after being extracted from a first-hand response. |
1673 |
|
|
|
1674 |
|
|
|
1675 |
|
|
10.4 Extracting a normal response from a choice response |
1676 |
|
|
|
1677 |
|
|
If a proxy receives a choice response, it may extract and cache the |
1678 |
|
|
normal HTTP response contained therein. The normal response can be |
1679 |
|
|
extracted by taking a copy of the choice response and then deleting |
1680 |
|
|
the Content-Location, Alternates, Vary, and Alternates-Older |
1681 |
|
|
header, and renaming any Variant-Vary headers to Vary headers. |
1682 |
|
|
|
1683 |
|
|
[##Question to be resolved: A method to get rid of the Expires |
1684 |
|
|
header which could have been added in a step 4.e of Section 10.2.1 |
1685 |
|
|
and 10.2.2 could be invented. Should such a method be added to |
1686 |
|
|
this specification? Probably not.##] |
1687 |
|
|
|
1688 |
|
|
This normal response may then be cached (as a HTTP response to the |
1689 |
|
|
variant request as constructed in step 1. of Section 10.2.1) and |
1690 |
|
|
reused to answer future direct requests on the variant resource |
1691 |
|
|
according to the rules in the HTTP/1.1 specification [1]. This |
1692 |
|
|
caching of extracted responses can increase overall efficiency with |
1693 |
|
|
up to a factor 2. |
1694 |
|
|
|
1695 |
|
|
For security reasons (see Section 15.2), an extracted normal |
1696 |
|
|
response may only be cached if the negotiable resource and the |
1697 |
|
|
variant resource are neighbors. If they are not neighbors, the |
1698 |
|
|
proxy should reject the choice response as a probable spoofing |
1699 |
|
|
attempt and pass on a 502 (bad gateway) error response instead. |
1700 |
|
|
|
1701 |
|
|
|
1702 |
|
|
10.5 Elaborate Vary headers |
1703 |
|
|
|
1704 |
|
|
The Vary header added to a list or choice response should ensure |
1705 |
|
|
correct handling by HTTP/1.1 caching proxies not capable of |
1706 |
|
|
transparent content negotiation. The most simple Vary header which |
1707 |
|
|
satisfies this requirement is |
1708 |
|
|
|
1709 |
|
|
Vary: * |
1710 |
|
|
|
1711 |
|
|
A more elaborate Vary header can be used to allow for certain |
1712 |
|
|
optimizations which could be performed by some HTTP/1.1 caches |
1713 |
|
|
which are not capable of transparent content negotiation, but which |
1714 |
|
|
do cache multiple variants of one resource based on Vary header |
1715 |
|
|
contents. |
1716 |
|
|
|
1717 |
|
|
10.5.1 Construction of an elaborate Vary header |
1718 |
|
|
|
1719 |
|
|
Origin servers can construct a more elaborate Vary header in the |
1720 |
|
|
following way. First, start with the header |
1721 |
|
|
|
1722 |
|
|
Vary: negotiate |
1723 |
|
|
|
1724 |
|
|
Then, if any of the following attributes is present in any variant |
1725 |
|
|
description in the Alternates header, add the corresponding header |
1726 |
|
|
name to the Vary header |
1727 |
|
|
|
1728 |
|
|
attribute | header name to add |
1729 |
|
|
-----------+--------------------- |
1730 |
|
|
type | accept |
1731 |
|
|
charset | accept-charset |
1732 |
|
|
language | accept-language |
1733 |
|
|
features | accept-features |
1734 |
|
|
|
1735 |
|
|
The Vary header constructed in this way specifies the response |
1736 |
|
|
variation which can be caused by the use of the network negotiation |
1737 |
|
|
algorithm in proxies. If the origin server uses a custom |
1738 |
|
|
negotiation algorithm which takes additional headers (for example |
1739 |
|
|
User-Agent) into account, these should also be added to the Vary |
1740 |
|
|
header. |
1741 |
|
|
|
1742 |
|
|
10.5.2 Caching of an elaborate Vary header |
1743 |
|
|
|
1744 |
|
|
Proxy caches cannot construct elaborate Vary headers by themselves, |
1745 |
|
|
because they may not assume that the origin server uses the |
1746 |
|
|
standard network negotiation algorithm to vary its responses. |
1747 |
|
|
However, when extracting an Alternates header from a response |
1748 |
|
|
(Section 10.3) caches may also extract the Vary header in the |
1749 |
|
|
response, and reuse it along with the Alternates header. A clean |
1750 |
|
|
Vary header can however only be extracted if the variant does not |
1751 |
|
|
vary itself, i.e. if a Variant-Vary header is absent. |
1752 |
|
|
|
1753 |
|
|
|
1754 |
|
|
11 The network negotiation algorithm |
1755 |
|
|
|
1756 |
|
|
The network negotiation algorithm is a standardized algorithm by |
1757 |
|
|
which a party in the negotiation process can make a choice on |
1758 |
|
|
behalf of another party. For example, a proxy could choose a |
1759 |
|
|
particular variant on behalf of the user agent in order to speed up |
1760 |
|
|
the negotiation process by cutting corners (see Section 4.4). |
1761 |
|
|
|
1762 |
|
|
General principles underlying the network negotiation algorithm are |
1763 |
|
|
as follows. |
1764 |
|
|
|
1765 |
|
|
- When running on an origin server or proxy, the algorithm will |
1766 |
|
|
usually only have partial user agent capabilities and |
1767 |
|
|
preferences information as input. Therefore, instead of a |
1768 |
|
|
choice for a best variant, the algorithm can also yield an |
1769 |
|
|
`insufficient data, cannot choose' result. |
1770 |
|
|
|
1771 |
|
|
- Decisions are always made on either on behalf of the user agent |
1772 |
|
|
or on behalf of the origin server. They are made on behalf of |
1773 |
|
|
the user agent if the user agent indicates that it is capable of |
1774 |
|
|
transparent content negotiation, and on behalf of the origin |
1775 |
|
|
server otherwise. |
1776 |
|
|
|
1777 |
|
|
- By including an Alternates header in the response, the origin |
1778 |
|
|
server gives upstream proxies the permission to perform actions |
1779 |
|
|
prescribed by the network negotiation algorithm instead of |
1780 |
|
|
actions prescribed by the plain HTTP specification. |
1781 |
|
|
|
1782 |
|
|
- It is expected that user agents will use the network negotiation |
1783 |
|
|
algorithm by default, locally supplying their complete |
1784 |
|
|
capabilities and preferences to the algorithm, but this is not |
1785 |
|
|
required. User agents may use customized negotiation algorithms |
1786 |
|
|
to automatically choose a variant. Such algorithms could for |
1787 |
|
|
example account for cross-dependencies between dimensions of |
1788 |
|
|
negotiation. |
1789 |
|
|
|
1790 |
|
|
Note that in this specification, `use of the network negotiation |
1791 |
|
|
algorithm' means use of any algorithm which yields equal results. |
1792 |
|
|
|
1793 |
|
|
|
1794 |
|
|
11.1 Input |
1795 |
|
|
|
1796 |
|
|
The algorithm is always executed for a particular request on a |
1797 |
|
|
particular transparently negotiable resource. It takes the |
1798 |
|
|
following information as input. |
1799 |
|
|
|
1800 |
|
|
1. The list of variants of the resource, as present in the |
1801 |
|
|
Alternates header of the resource. |
1802 |
|
|
|
1803 |
|
|
2. Any "min-q" and "forward" directives pertaining to the |
1804 |
|
|
negotiation process, as specified by the Alternates header of |
1805 |
|
|
the resource. |
1806 |
|
|
|
1807 |
|
|
3. (Partial) Information about capabilities and preferences of the |
1808 |
|
|
user agent for this particular request, as given in the Accept |
1809 |
|
|
headers of the request, or, if the algorithm runs on a user |
1810 |
|
|
agent, as given by the internal capabilities and preferences |
1811 |
|
|
database. |
1812 |
|
|
|
1813 |
|
|
4. A boolean indicating whether or not the user agent is capable |
1814 |
|
|
of transparent content negotiation for this request. (True if |
1815 |
|
|
the request includes a Negotiate header, false otherwise). |
1816 |
|
|
|
1817 |
|
|
|
1818 |
|
|
11.2 Output |
1819 |
|
|
|
1820 |
|
|
As its output, the network negotiation algorithm and will yield the |
1821 |
|
|
appropriate action to be performed. Actions have labels `ACT_UA' |
1822 |
|
|
for actions performed on behalf of the user agent, and `ACT_OS' for |
1823 |
|
|
actions performed on behalf of the origin server. |
1824 |
|
|
|
1825 |
|
|
11.2.1 Output for proxies |
1826 |
|
|
|
1827 |
|
|
If the algorithm runs on a proxy, there are five different possible |
1828 |
|
|
results. The first two results can be generated if the user agent |
1829 |
|
|
is capable of transparent content negotiation: |
1830 |
|
|
|
1831 |
|
|
Choice_UA |
1832 |
|
|
|
1833 |
|
|
Choice on behalf of the user agent. The best variant may be |
1834 |
|
|
retrieved and returned in a choice response. |
1835 |
|
|
|
1836 |
|
|
List_UA |
1837 |
|
|
|
1838 |
|
|
No choice possible, return the list. The Accept headers do |
1839 |
|
|
not contain sufficient information to make a choice on behalf |
1840 |
|
|
of the user agent possible. A list response should be |
1841 |
|
|
returned, allowing the user agent to make the choice itself. |
1842 |
|
|
|
1843 |
|
|
The following results can be generated if the user agent is not |
1844 |
|
|
capable of transparent content negotiation: |
1845 |
|
|
|
1846 |
|
|
Choice_OS |
1847 |
|
|
|
1848 |
|
|
Choice on behalf of the origin server. The best variant may |
1849 |
|
|
be retrieved and returned in a choice response. |
1850 |
|
|
|
1851 |
|
|
List_OS |
1852 |
|
|
|
1853 |
|
|
No choice possible, return the list. The Accept headers do |
1854 |
|
|
not contain sufficient information to make a choice on behalf |
1855 |
|
|
of the origin server possible. A list response should be |
1856 |
|
|
returned, allowing the user to manually select the best |
1857 |
|
|
variant. |
1858 |
|
|
|
1859 |
|
|
Forward_OS |
1860 |
|
|
|
1861 |
|
|
No choice possible, forward request towards the origin |
1862 |
|
|
server. The Accept headers do not contain sufficient |
1863 |
|
|
information to make a choice on behalf of the origin server |
1864 |
|
|
possible. The request should be forwarded towards the origin |
1865 |
|
|
server so that it can choose the most appropriate action with |
1866 |
|
|
a custom negotiation algorithm. |
1867 |
|
|
|
1868 |
|
|
11.2.2 Output for origin servers |
1869 |
|
|
|
1870 |
|
|
If the algorithm runs on an origin server, all results above, |
1871 |
|
|
except Forward_OS, are possible, with the same interpretations. |
1872 |
|
|
|
1873 |
|
|
11.2.3 Output for user agents |
1874 |
|
|
|
1875 |
|
|
If the algorithm runs on a user agent, only the results List_UA and |
1876 |
|
|
Choice_UA are possible, with the following interpretations. |
1877 |
|
|
|
1878 |
|
|
Choice_UA |
1879 |
|
|
|
1880 |
|
|
Automatic choice. A particular variant X must be retrieved and |
1881 |
|
|
displayed. |
1882 |
|
|
|
1883 |
|
|
List_UA |
1884 |
|
|
|
1885 |
|
|
No automatic choice possible, none of of the variants can be |
1886 |
|
|
rendered according to the preferences and capabilities |
1887 |
|
|
database. An appropriate action like showing an error message |
1888 |
|
|
with the list of variants to the user must be performed. |
1889 |
|
|
|
1890 |
|
|
|
1891 |
|
|
11.3 Computing the overall quality values |
1892 |
|
|
|
1893 |
|
|
As a first step in the network negotiation algorithm, the overall |
1894 |
|
|
qualities of the individual variants in the list are computed. |
1895 |
|
|
|
1896 |
|
|
The overall quality Q of a variant is the value |
1897 |
|
|
|
1898 |
|
|
Q = qs * qt * qc * ql * qf |
1899 |
|
|
|
1900 |
|
|
where the factors qs, qt, qc, ql, and qf are determined as follows. |
1901 |
|
|
|
1902 |
|
|
qs Is the source quality factor in the variant description. |
1903 |
|
|
|
1904 |
|
|
qt The media type quality factor is 1 if there is no type |
1905 |
|
|
attribute in the variant description, or if there is no |
1906 |
|
|
Accept header in the request. Otherwise, it is the quality |
1907 |
|
|
assigned by the Accept header to the media type in the type |
1908 |
|
|
attribute. |
1909 |
|
|
|
1910 |
|
|
Note: If a type is matched by none of the elements of an |
1911 |
|
|
Accept header, the Accept header assigns the quality factor |
1912 |
|
|
0 to that type. |
1913 |
|
|
|
1914 |
|
|
qc The charset quality factor is 1 if there is no charset |
1915 |
|
|
attribute in the variant description, or if there is no |
1916 |
|
|
Accept-Charset header in the request. Otherwise, the charset |
1917 |
|
|
quality factor is the quality assigned by the Accept-Charset |
1918 |
|
|
header to charset in the charset attribute. |
1919 |
|
|
|
1920 |
|
|
Note: If a charset does not appear in an Accept-Charset |
1921 |
|
|
header, the Accept-Charset header assigns the quality |
1922 |
|
|
factor 0 to that charset. |
1923 |
|
|
|
1924 |
|
|
ql The language quality factor is 1 if there is no language |
1925 |
|
|
attribute in the variant description, or if there is no |
1926 |
|
|
Accept-Language header in the request. Otherwise, the |
1927 |
|
|
language quality factor is the highest quality factor |
1928 |
|
|
assigned by the Accept-Language header to any one of the |
1929 |
|
|
languages listed in the language attribute. |
1930 |
|
|
|
1931 |
|
|
qf The features quality factor is 1 if there is no features |
1932 |
|
|
attribute in the variant description, or if there is no |
1933 |
|
|
Accept-Features header in the request. Otherwise, it is |
1934 |
|
|
the feature negotiation quality degradation value for the |
1935 |
|
|
features attribute, see Section 6.4. |
1936 |
|
|
|
1937 |
|
|
As an example, if a variant list contains the variant description |
1938 |
|
|
|
1939 |
|
|
{"paper.html.en" 0.7 {type text/html} {language fr}} |
1940 |
|
|
|
1941 |
|
|
and if the request contains the Accept headers |
1942 |
|
|
|
1943 |
|
|
Accept: text/html:q=1.0, */*:q=0.8 |
1944 |
|
|
Accept-Language: en;q=1.0, fr;q=0.5 |
1945 |
|
|
|
1946 |
|
|
the network negotiation algorithm will compute an overall quality |
1947 |
|
|
for the variant as follows: |
1948 |
|
|
|
1949 |
|
|
{"paper.html.en" 0.7 {type text/html} {language fr}} |
1950 |
|
|
| | | |
1951 |
|
|
| | | |
1952 |
|
|
V V V |
1953 |
|
|
0.7 * 1.0 * 0.5 = 0.35 |
1954 |
|
|
|
1955 |
|
|
With the above Accept headers, the complete variant list |
1956 |
|
|
|
1957 |
|
|
{"paper.html.en" 0.9 {type text/html} {language en}}, |
1958 |
|
|
{"paper.html.fr" 0.7 {type text/html} {language fr}}, |
1959 |
|
|
{"paper.ps.en" 1.0 {type application/postscript} {language en}} |
1960 |
|
|
|
1961 |
|
|
would yield the following computations: |
1962 |
|
|
|
1963 |
|
|
qs * qt * qc * ql * qf = Q |
1964 |
|
|
--- --- --- --- --- ---- |
1965 |
|
|
paper.html.en: 0.9 * 1.0 * 1.0 * 1.0 * 1.0 = 0.9 |
1966 |
|
|
paper.html.fr: 0.7 * 1.0 * 1.0 * 0.5 * 1.0 = 0.35 |
1967 |
|
|
paper.ps.en: 1.0 * 0.8 * 1.0 * 1.0 * 1.0 = 0.8 |
1968 |
|
|
|
1969 |
|
|
|
1970 |
|
|
11.4 Definite and speculative quality values |
1971 |
|
|
|
1972 |
|
|
An overall quality value computed by an origin server or proxy can |
1973 |
|
|
be either definite or speculative. |
1974 |
|
|
|
1975 |
|
|
An overall quality value for a variant is definite if it was |
1976 |
|
|
computed without using any wildcard characters '*' in the Accept |
1977 |
|
|
headers, and without the need to use the absence of a particular |
1978 |
|
|
Accept header. An overall quality value is speculative otherwise. |
1979 |
|
|
|
1980 |
|
|
As an example, in the previous section, the quality values of |
1981 |
|
|
paper.html.en and paper.html.fr are definite, and the quality value |
1982 |
|
|
of paper.ps.en is speculative because the type |
1983 |
|
|
application/postscript was matched to the range */*. |
1984 |
|
|
|
1985 |
|
|
Definiteness can be defined more formally as follows. An overall |
1986 |
|
|
quality value Q is definite if the same quality value Q could be |
1987 |
|
|
computed after the request message is changed in the following way: |
1988 |
|
|
|
1989 |
|
|
1. If an Accept, Accept-Charset, Accept-Language, or |
1990 |
|
|
Accept-Features, header is missing from the request, add |
1991 |
|
|
this header with an empty field. |
1992 |
|
|
|
1993 |
|
|
2. Delete any media ranges containing a wildcard character '*' |
1994 |
|
|
from the Accept header. Delete the language-range '*', if |
1995 |
|
|
present, from the Accept-Language header. Delete the |
1996 |
|
|
wildcard '*', if present, from the Accept-Features header. |
1997 |
|
|
|
1998 |
|
|
As another example, the overall quality factor for the variant |
1999 |
|
|
|
2000 |
|
|
{"blah.html" 1 {language en-gb} {features blebber [x y]}} |
2001 |
|
|
|
2002 |
|
|
is 1 and definite with the Accept headers |
2003 |
|
|
|
2004 |
|
|
Accept-Language: en-gb, fr |
2005 |
|
|
Accept-Features: blebber, x, !y, * |
2006 |
|
|
|
2007 |
|
|
and |
2008 |
|
|
|
2009 |
|
|
Accept-Language: en, fr |
2010 |
|
|
Accept-Features: blebber, x, * |
2011 |
|
|
|
2012 |
|
|
The overall quality factor is still 1, but speculative, with the |
2013 |
|
|
Accept headers |
2014 |
|
|
|
2015 |
|
|
Accept-language: en-gb, fr |
2016 |
|
|
Accept-Features: blebber, !y, * |
2017 |
|
|
|
2018 |
|
|
and |
2019 |
|
|
|
2020 |
|
|
Accept-Language: fr, * |
2021 |
|
|
Accept-Features: blebber, x, !y, * |
2022 |
|
|
|
2023 |
|
|
|
2024 |
|
|
11.5 Determining the result |
2025 |
|
|
|
2026 |
|
|
The best variant, as determined by the network negotiation |
2027 |
|
|
algorithm, is the one variant with the highest overall quality |
2028 |
|
|
value, or, if there are multiple variants which share the highest |
2029 |
|
|
overall quality, the first variant in the list with this value. |
2030 |
|
|
|
2031 |
|
|
11.5.1 Result for proxies and origin servers |
2032 |
|
|
|
2033 |
|
|
When running on a proxy or origin server, the result of the network |
2034 |
|
|
negotiation algorithm is determined as follows. |
2035 |
|
|
|
2036 |
|
|
1. If the negotiable resource and the best variant resource are not |
2037 |
|
|
neighbors, then the result is List_UA if the user agent is |
2038 |
|
|
capable of transparent content negotiation, List_OS otherwise. |
2039 |
|
|
This rule exists for security reasons: it prevents some forms of |
2040 |
|
|
spoofing, see Section 15.2. |
2041 |
|
|
|
2042 |
|
|
2. If the above rule does not apply, then |
2043 |
|
|
|
2044 |
|
|
a. If the user agent is capable of transparent content |
2045 |
|
|
negotiation, the result is Choice_UA if the best variant has |
2046 |
|
|
a definite overall quality value greater than 0, and List_UA |
2047 |
|
|
otherwise. |
2048 |
|
|
|
2049 |
|
|
b. If the user agent is not capable of transparent content |
2050 |
|
|
negotiation, the result is Choose_OS if the best variant has |
2051 |
|
|
a (definite or speculative) overall quality value which is |
2052 |
|
|
greater than 0, or at least the value of the "min-q" |
2053 |
|
|
directive if this directive is present in the Alternates |
2054 |
|
|
header. If the result is not Choose_OS, it is Forward_OS if |
2055 |
|
|
the Alternates header contains the "forward" directive and |
2056 |
|
|
the algorithm is running on a proxy, and List_OS otherwise. |
2057 |
|
|
|
2058 |
|
|
11.5.2 Result for user agents |
2059 |
|
|
|
2060 |
|
|
When running on a user agent, the result of the network negotiation |
2061 |
|
|
algorithm is Choice_UA if the best variant has an overall quality |
2062 |
|
|
value greater than 0, and List_UA otherwise. |
2063 |
|
|
|
2064 |
|
|
|
2065 |
|
|
11.6 Construction of short requests |
2066 |
|
|
|
2067 |
|
|
Under normal HTTP semantics, the interpretation of the request |
2068 |
|
|
header `Accept: */*' is |
2069 |
|
|
|
2070 |
|
|
`I accept all media types with a quality of 1.0'. |
2071 |
|
|
|
2072 |
|
|
One of the most important properties of the network negotiation |
2073 |
|
|
algorithm is that this interpretation is different if the header is |
2074 |
|
|
sent by a user agent which supports transparent content |
2075 |
|
|
negotiation. In this case, the interpretation of the header is |
2076 |
|
|
|
2077 |
|
|
`I accept several media types, and assign quality factors from 0.0 |
2078 |
|
|
up to 1.0 to them. If this information is insufficient to make a |
2079 |
|
|
choice on my behalf, do not make a choice but send the list of |
2080 |
|
|
variants'. |
2081 |
|
|
|
2082 |
|
|
The complete absence of an Accept header from the request would be |
2083 |
|
|
interpreted in the same way. |
2084 |
|
|
|
2085 |
|
|
This means that a user agent which supports transparent content |
2086 |
|
|
negotiation can send a minimal request, without any Accept headers |
2087 |
|
|
but with a Negotiate header, by default: |
2088 |
|
|
|
2089 |
|
|
GET /paper HTTP/1.1 |
2090 |
|
|
Host: x.org |
2091 |
|
|
User-Agent: WuxtaWeb/2.4 |
2092 |
|
|
Negotiate: |
2093 |
|
|
|
2094 |
|
|
The sending of this minimal request will never have an adverse |
2095 |
|
|
effect on the quality of the transparent negotiation process: if |
2096 |
|
|
the requested resource happens to be transparently negotiated, the |
2097 |
|
|
user agent will always get a list response, so that it can choose |
2098 |
|
|
the best variant itself. Only the speed of the negotiation process |
2099 |
|
|
can be affected, because servers will no longer be able to cut |
2100 |
|
|
corners by choosing on behalf of the user agent. |
2101 |
|
|
|
2102 |
|
|
If it is found that the requests to a particular origin server |
2103 |
|
|
often return a less efficient list response, the user agent can |
2104 |
|
|
dynamically introduce short Accept headers in its future requests |
2105 |
|
|
to that server, for example |
2106 |
|
|
|
2107 |
|
|
GET /paper HTTP/1.1 |
2108 |
|
|
Host: x.org |
2109 |
|
|
User-Agent: WuxtaWeb/2.4 |
2110 |
|
|
Negotiate: |
2111 |
|
|
Accept: text/html, application/postscript:q=0.8, */* |
2112 |
|
|
Accept-language: en, fr;q=0.5 |
2113 |
|
|
|
2114 |
|
|
This will increase the chance that the network negotiation |
2115 |
|
|
algorithm will have sufficient information to choose on behalf of |
2116 |
|
|
the user agent, thereby optimizing the negotiation process. A good |
2117 |
|
|
strategy for dynamic extension would be to extend the request with |
2118 |
|
|
with those media types, languages, charsets, and feature tags |
2119 |
|
|
mentioned in the variant lists of past list responses from the |
2120 |
|
|
server. The Accept header in the extended request, if present, |
2121 |
|
|
will generally contain "*/*" to indicate that only partial |
2122 |
|
|
information is given in this header. The Accept-Features header, |
2123 |
|
|
if present, will generally contain a "*" for the same reason. |
2124 |
|
|
|
2125 |
|
|
|
2126 |
|
|
12 User agent support for transparent negotiation |
2127 |
|
|
|
2128 |
|
|
This section specifies the requirements a user agent must satisfy |
2129 |
|
|
in order to support transparent negotiation. If the user agent |
2130 |
|
|
contains an internal cache, this cache should satisfy the |
2131 |
|
|
requirements for proxy caches in Section 14. |
2132 |
|
|
|
2133 |
|
|
|
2134 |
|
|
12.1 Handling of responses |
2135 |
|
|
|
2136 |
|
|
If a list response is received when a resource is accessed, the |
2137 |
|
|
user agent must be able to automatically choose, retrieve, and |
2138 |
|
|
display the best variant, or display an error message if it is not |
2139 |
|
|
capable of displaying any of the available variants. The |
2140 |
|
|
negotiation algorithm which chooses the best variant (or chooses to |
2141 |
|
|
display an error message) need not be the network negotiation |
2142 |
|
|
algorithm. |
2143 |
|
|
|
2144 |
|
|
If a choice response is received when a resource is accessed, the |
2145 |
|
|
usual action is to automatically display the enclosed variant. A |
2146 |
|
|
user agent may however choose to apply its (custom) negotiation |
2147 |
|
|
algorithm to the received variant list, and to automatically |
2148 |
|
|
retrieve and display another variant if the algorithm indicates |
2149 |
|
|
that this other variant has a better quality. |
2150 |
|
|
|
2151 |
|
|
When receiving a choice response, a user agent should check if the |
2152 |
|
|
if the negotiable resource and the chosen variant resource are |
2153 |
|
|
neighbors. If this is not the case, the user agent should reject |
2154 |
|
|
the choice response as a probable spoofing attempt and display an |
2155 |
|
|
error message, for example by internally replacing the choice |
2156 |
|
|
response with a 502 (bad gateway) response. |
2157 |
|
|
|
2158 |
|
|
|
2159 |
|
|
12.2 Presentation of a transparently negotiated resource |
2160 |
|
|
|
2161 |
|
|
If the user agent is displaying, in a main window (i.e. not as an |
2162 |
|
|
embedded or inlined object), a variant as the end result of a |
2163 |
|
|
request on a transparently negotiated resource, the following |
2164 |
|
|
requirements must be met. |
2165 |
|
|
|
2166 |
|
|
1. The user agent should make available though its user interface |
2167 |
|
|
some indication that the resource being displayed is a |
2168 |
|
|
negotiated resource. |
2169 |
|
|
|
2170 |
|
|
2. The user agent should allow the user to review a list of all |
2171 |
|
|
variants bound to the negotiable resource, and to manually |
2172 |
|
|
retrieve another variant if desired. There are two general |
2173 |
|
|
ways of providing such a list. First, the information in the |
2174 |
|
|
Alternates header of the negotiable resource could be used to |
2175 |
|
|
make an annotated menu of variants. Second, the entity |
2176 |
|
|
included in a list response of the negotiable resource could be |
2177 |
|
|
displayed. Note that a list response can always be obtained by |
2178 |
|
|
doing a GET request on the negotiable resource with a Negotiate |
2179 |
|
|
header but without Accept headers. If only this second option |
2180 |
|
|
is provided, the user agent should also provide the user with a |
2181 |
|
|
means to review the real variant list as used by the |
2182 |
|
|
negotiation algorithm (see Section 15.1). |
2183 |
|
|
|
2184 |
|
|
3. If the user agent shows the URI of the displayed information to |
2185 |
|
|
the user, it should be the negotiable resource URI, not the |
2186 |
|
|
variant URI. |
2187 |
|
|
|
2188 |
|
|
4. Similarly, if the user agent stores a reference to the |
2189 |
|
|
displayed information for future use, for example in a hotlist, |
2190 |
|
|
it should store the negotiable resource URI, not the |
2191 |
|
|
variant URI. |
2192 |
|
|
|
2193 |
|
|
It is encouraged, but not required, that some of the above |
2194 |
|
|
functionality is also made available for inlined or embedded |
2195 |
|
|
objects, and when a variant which was selected manually is being |
2196 |
|
|
displayed. |
2197 |
|
|
|
2198 |
|
|
|
2199 |
|
|
13 Origin server support for transparent negotiation |
2200 |
|
|
|
2201 |
|
|
This section covers origin server support from a HTTP viewpoint. |
2202 |
|
|
see Appendix 19.2 for implementation considerations. |
2203 |
|
|
|
2204 |
|
|
|
2205 |
|
|
13.1 Requirements |
2206 |
|
|
|
2207 |
|
|
To implement transparent negotiation on a resource, the origin |
2208 |
|
|
server must be able to send a list response when getting a GET |
2209 |
|
|
request on the resource. It should also be able to send |
2210 |
|
|
appropriate list responses for HEAD requests. The origin server |
2211 |
|
|
must always send a list response, never a choice response, for a |
2212 |
|
|
request with a Negotiate header but without Accept headers. |
2213 |
|
|
|
2214 |
|
|
The origin server may also return choice responses, except in the |
2215 |
|
|
special case above. The negotiation algorithm used need not be the |
2216 |
|
|
network negotiation algorithm. |
2217 |
|
|
|
2218 |
|
|
Negotiability is a binary property: a resource is either |
2219 |
|
|
transparently negotiated, or it is not. Origin servers should not |
2220 |
|
|
vary the negotiability of a resource, or the variant list bound to |
2221 |
|
|
that resource, based on the request headers which are received. |
2222 |
|
|
The variant list and the property of being negotiated may however |
2223 |
|
|
change through time. The Cache-Control header and the max-age |
2224 |
|
|
directive of the Alternates header can be used to control the |
2225 |
|
|
propagation of such time-dependent changes through caches. |
2226 |
|
|
|
2227 |
|
|
It is the responsibility of the author of the negotiable resource |
2228 |
|
|
to ensure that all resources in the variant list serve the intended |
2229 |
|
|
content, and that the variant resources do not engage in |
2230 |
|
|
transparent content negotiation themselves. |
2231 |
|
|
|
2232 |
|
|
|
2233 |
|
|
13.2 Negotiation on transactions other than GET and HEAD |
2234 |
|
|
|
2235 |
|
|
If a resource is transparently negotiable, this only has an impact |
2236 |
|
|
on the GET and HEAD transactions on the resource. Other |
2237 |
|
|
transactions are not affected. If it is desired that transparent |
2238 |
|
|
content negotiation is done on, for example, the end result of a |
2239 |
|
|
POST request, then a 303 (See Other) POST response which redirects |
2240 |
|
|
to a negotiable resource could be generated. See the HTTP/1.1 |
2241 |
|
|
specification [1] for details. |
2242 |
|
|
|
2243 |
|
|
|
2244 |
|
|
14 Proxy support for transparent negotiation |
2245 |
|
|
|
2246 |
|
|
Transparent content negotiation is designed to work through proxies |
2247 |
|
|
which only implement the HTTP/1.1 specification [1]. Thus, in a |
2248 |
|
|
sense, all HTTP/1.1 proxies support transparent content |
2249 |
|
|
negotiation. |
2250 |
|
|
|
2251 |
|
|
Plain HTTP/1.1 allows proxies to cache list and choice responses, |
2252 |
|
|
and to efficiently revalidate them by using the If-None-Match |
2253 |
|
|
header. This specification defines additional optimization |
2254 |
|
|
mechanisms. |
2255 |
|
|
|
2256 |
|
|
First, a proxy may cache and reuse an Alternates header bound to a |
2257 |
|
|
negotiable resource (Section 10.3). If it is fresh or first-hand, |
2258 |
|
|
the Alternates header may be reused to negotiate on behalf of the |
2259 |
|
|
user agent or origin server and to construct choice responses |
2260 |
|
|
(Section 10.2.2). Proxies must not use custom negotiation |
2261 |
|
|
algorithms, they may only use the network negotiation algorithm. |
2262 |
|
|
|
2263 |
|
|
Second, if a proxy receives a choice response, it may extract and |
2264 |
|
|
cache the normal response embedded therein, as described in |
2265 |
|
|
Section 10.4. |
2266 |
|
|
|
2267 |
|
|
|
2268 |
|
|
15 Security and privacy considerations |
2269 |
|
|
|
2270 |
|
|
15.1 Accept headers revealing information of a private nature |
2271 |
|
|
|
2272 |
|
|
Accept headers, in particular Accept-Language headers, may reveal |
2273 |
|
|
information which the user would rather keep private unless it will |
2274 |
|
|
directly improve the quality of service. For example, a user may |
2275 |
|
|
not want to send language preferences to sites which do not offer |
2276 |
|
|
multi-lingual content. The transparent content negotiation |
2277 |
|
|
mechanism allows user agents to omit sending of the Accept-Language |
2278 |
|
|
header by default, without this affecting the outcome of the |
2279 |
|
|
negotiation process if transparently negotiated multi-lingual |
2280 |
|
|
content is accessed. |
2281 |
|
|
|
2282 |
|
|
However, even if Accept headers are never sent, the automatic |
2283 |
|
|
selection and retrieval of a variant by a user agent will reveal a |
2284 |
|
|
preference for this variant to the server. A malicious service |
2285 |
|
|
author could provide a page with `fake' negotiability on |
2286 |
|
|
(ethnicity-correlated) languages, with all variants actually being |
2287 |
|
|
the same English document, as a means of obtaining |
2288 |
|
|
privacy-sensitive information. Such a plot would however be |
2289 |
|
|
visible to an alert victim if the list of available variants and |
2290 |
|
|
their properties is reviewed. |
2291 |
|
|
|
2292 |
|
|
Some additional privacy considerations connected to Accept headers |
2293 |
|
|
are discussed in [1]. |
2294 |
|
|
|
2295 |
|
|
|
2296 |
|
|
15.2 Spoofing of responses from variant resources |
2297 |
|
|
|
2298 |
|
|
The caching optimization in Section 10.4 gives the implementer of a |
2299 |
|
|
negotiable resource control over the responses cached for all of |
2300 |
|
|
its variant resources which are neighbors. This is a security |
2301 |
|
|
problem if a neighboring variant resource belongs to another |
2302 |
|
|
author. To provide security in this case, the HTTP server will |
2303 |
|
|
have to filter the Content-Location headers in the choice responses |
2304 |
|
|
generated by the negotiable resource implementation. |
2305 |
|
|
|
2306 |
|
|
|
2307 |
|
|
16 Acknowledgments |
2308 |
|
|
|
2309 |
|
|
Work on HTTP content negotiation has been done since at least 1993. |
2310 |
|
|
The author is unable to trace the origin of many of the ideas |
2311 |
|
|
incorporated in this document. This document builds on an earlier |
2312 |
|
|
specification of content negotiation as recorded in [2]. Many |
2313 |
|
|
members of the HTTP working group have contributed to the work |
2314 |
|
|
reflected in this document. The author wishes to thank the |
2315 |
|
|
individuals who have commented on earlier versions of this |
2316 |
|
|
document, including Brian Behlendorf, Daniel DuBois, Larry |
2317 |
|
|
Masinter, and Roy T. Fielding. |
2318 |
|
|
|
2319 |
|
|
|
2320 |
|
|
17 References |
2321 |
|
|
|
2322 |
|
|
[1] Fielding et al, Hypertext Transfer Protocol -- HTTP/1.1. |
2323 |
|
|
Internet-Draft draft-ietf-http-v11-spec-06.txt, HTTP Working |
2324 |
|
|
Group, July 4, 1996 |
2325 |
|
|
|
2326 |
|
|
[2] Roy T. Fielding, Henrik Frystyk Nielsen, and Tim Berners-Lee. |
2327 |
|
|
Hypertext Transfer Protocol -- HTTP/1.1. Internet-Draft |
2328 |
|
|
draft-ietf-http-v11-spec-01.txt, HTTP Working Group, January, |
2329 |
|
|
1996. |
2330 |
|
|
|
2331 |
|
|
|
2332 |
|
|
18 Author's address |
2333 |
|
|
|
2334 |
|
|
Koen Holtman |
2335 |
|
|
Technische Universiteit Eindhoven |
2336 |
|
|
Postbus 513 |
2337 |
|
|
Kamer HG 6.57 |
2338 |
|
|
5600 MB Eindhoven (Holland) |
2339 |
|
|
|
2340 |
|
|
e-mail: koen@win.tue.nl |
2341 |
|
|
|
2342 |
|
|
|
2343 |
|
|
19 Appendices |
2344 |
|
|
|
2345 |
|
|
19.1 Adding an Expires header to ensure HTTP/1.0 compatibility |
2346 |
|
|
|
2347 |
|
|
To ensure compatibility with HTTP/1.0 caching proxies which do not |
2348 |
|
|
recognize the Vary header, an Expires header with a date in the |
2349 |
|
|
past can be be added to the response, for example |
2350 |
|
|
|
2351 |
|
|
Expires: Thu, 01 Jan 1980 00:00:00 GMT |
2352 |
|
|
|
2353 |
|
|
If this is done by an origin server, it should usually also include |
2354 |
|
|
a Cache-Control header for the benefit of HTTP/1.1 caches, for |
2355 |
|
|
example |
2356 |
|
|
|
2357 |
|
|
Cache-Control: max-age=604800 |
2358 |
|
|
|
2359 |
|
|
which overrides the freshness lifetime of zero seconds specified by |
2360 |
|
|
the included Expires header. |
2361 |
|
|
|
2362 |
|
|
|
2363 |
|
|
19.2 Origin server implementation considerations |
2364 |
|
|
|
2365 |
|
|
19.2.1 Implementation with a CGI script |
2366 |
|
|
|
2367 |
|
|
[##Has yet to be written. This section will contain a sample CGI |
2368 |
|
|
shell script.##] |
2369 |
|
|
|
2370 |
|
|
19.2.2 Direct support by the HTTP server |
2371 |
|
|
|
2372 |
|
|
[##Has yet to be written. Will discuss the interface which a |
2373 |
|
|
transparent content negotiation server module could offer to |
2374 |
|
|
content authors. Will provide references to existing |
2375 |
|
|
implementations of content negotiation modules.##] |
2376 |
|
|
|
2377 |
|
|
19.2.3 Negotiable content authoring |
2378 |
|
|
|
2379 |
|
|
[##Has yet to be written. Mainly intends to mention that authoring |
2380 |
|
|
tools could automatically produce multiple variants together with |
2381 |
|
|
an appropriate variant list.##] |
2382 |
|
|
|
2383 |
|
|
|
2384 |
|
|
19.3 Open issues in transparent content negotiation |
2385 |
|
|
|
2386 |
|
|
At the time of writing of this specification, the following issues |
2387 |
|
|
are still open. |
2388 |
|
|
|
2389 |
|
|
- The feature tag registration process has yet to be defined. |
2390 |
|
|
|
2391 |
|
|
- A core set of feature tags (Section 8.2) has not yet been |
2392 |
|
|
defined, though there has been some related work on display |
2393 |
|
|
attributes, see Appendix 19.4.1. |
2394 |
|
|
|
2395 |
|
|
- Though it is expected that the feature negotiation framework will |
2396 |
|
|
solve many current and future negotiation problems, it is also |
2397 |
|
|
expected that there will remain current and future negotiation |
2398 |
|
|
problems not solved by feature negotiation. Currently, there is |
2399 |
|
|
little experience in this area. |
2400 |
|
|
|
2401 |
|
|
|
2402 |
|
|
19.4 Other negotiation specifications |
2403 |
|
|
|
2404 |
|
|
19.4.1 User-Agent Display Attributes Headers |
2405 |
|
|
|
2406 |
|
|
(Comments based on the internet draft |
2407 |
|
|
draft-mutz-http-attributes-00.txt and on messages from Andy Mutz.) |
2408 |
|
|
|
2409 |
|
|
User-Agent Display Attributes provide a means for an HTTP client to |
2410 |
|
|
inform a server about its display capabilities. The draft |
2411 |
|
|
mentioned above defines a number of such attributes, and presents |
2412 |
|
|
them as part of a HTTP/1.0 style negotiation framework (See Section |
2413 |
|
|
4.2). However, the the author of the above draft has said that the |
2414 |
|
|
draft does not intend to specify a negotiation framework, but |
2415 |
|
|
instead intends to use the framework proposed for negotiating |
2416 |
|
|
the existing header information. PEP (Section 19.4.2) and |
2417 |
|
|
transparent content negotiation are mentioned as possible |
2418 |
|
|
frameworks. |
2419 |
|
|
|
2420 |
|
|
In the opinion of the author of this document, the feature |
2421 |
|
|
negotiation framework would be an appropriate mechanism for |
2422 |
|
|
negotiation on display attributes. It seems possible and desirable |
2423 |
|
|
to encapsulate display attributes in the feature negotiation |
2424 |
|
|
mechanism, and to make them part of the core set of feature tags |
2425 |
|
|
(Section 8.2). |
2426 |
|
|
|
2427 |
|
|
The work on feature negotiation has its historical origins in the |
2428 |
|
|
desire to negotiate on display agent attributes with a minimum of |
2429 |
|
|
overhead to the request size. The work started after a discussion |
2430 |
|
|
of color content negotiation on the http-wg mailing list showed |
2431 |
|
|
that many participants found the introduction of a header like |
2432 |
|
|
Accept-Color unacceptable. Reasons cited were the request size |
2433 |
|
|
overhead, and the potential explosion of special-case Accept-* |
2434 |
|
|
headers, all of which would require special-case implementations, |
2435 |
|
|
implied by the introduction of Accept-Color. |
2436 |
|
|
|
2437 |
|
|
|
2438 |
|
|
19.4.2 PEP: An Extension Mechanism for HTTP/1.1 |
2439 |
|
|
|
2440 |
|
|
(Comments based on the internet draft draft-khare-http-pep-01.txt.) |
2441 |
|
|
|
2442 |
|
|
PEP is a system for HTTP clients, servers, and proxies to reliably |
2443 |
|
|
reason about custom extensions to HTTP. Its purpose places PEP one |
2444 |
|
|
meta-level above transparent content negotiation, which is intended |
2445 |
|
|
as a (standardized) extension of HTTP. |
2446 |
|
|
|
2447 |
|
|
Transparent content negotiation and HTTP/1.1 were both carefully |
2448 |
|
|
designed to work together without requiring meta-negotiation. |
2449 |
|
|
Therefore, transparent content negotiation does not require or rely |
2450 |
|
|
on the use of PEP. |
2451 |
|
|
|
2452 |
|
|
Though PEP and transparent content negotiation both offer |
2453 |
|
|
extensible negotiation frameworks, they operate in different areas |
2454 |
|
|
of negotiation. PEP negotiates on the use of mutually understood |
2455 |
|
|
protocol extensions, while transparent content negotiation is a |
2456 |
|
|
method for efficiently retrieving the best representation of some |
2457 |
|
|
information. Thus, deployment and use of PEP is orthogonal to |
2458 |
|
|
deployment and use of transparent content negotiation. |
2459 |
|
|
|
2460 |
|
|
Though some elements of PEP resemble some elements of transparent |
2461 |
|
|
content negotiation, it does not seem advantageous to attempt to |
2462 |
|
|
generalize (parts of) both specifications in order to allow sharing |
2463 |
|
|
of code by implementations. The two specifications seem to have |
2464 |
|
|
more unrelated parts than similar parts. For example, the handling |
2465 |
|
|
of incomplete information in Accept headers in transparent content |
2466 |
|
|
negotiation has no counterpart in PEP. On the other hand, PEP's |
2467 |
|
|
processing of `scope' has no counterpart in transparent content |
2468 |
|
|
negotiation. |
2469 |
|
|
|
2470 |
|
|
|
2471 |
|
|
19.5 Related issues |
2472 |
|
|
|
2473 |
|
|
19.5.1 Current negotiation practice |
2474 |
|
|
|
2475 |
|
|
In current practice, most user agents send short Accept headers in |
2476 |
|
|
every request. These headers usually inadequately describe the |
2477 |
|
|
user agent capabilities and user preferences, except maybe for |
2478 |
|
|
inline image requests. Servers providing multiple representations |
2479 |
|
|
of the same information usually do so under different URIs, and |
2480 |
|
|
allow users to manually select a representation by clicking a |
2481 |
|
|
particular link. |
2482 |
|
|
|
2483 |
|
|
Some HTTP servers implement extensive negotiation capabilities |
2484 |
|
|
based on HTTP/1.0 headers. However, with current user agents, |
2485 |
|
|
these capabilities can seldom be used effectively. |
2486 |
|
|
|
2487 |
|
|
Some origin servers use the contents of the User-Agent request |
2488 |
|
|
header for negotiation purposes. These contents sometimes allow |
2489 |
|
|
the server to infer information about capabilities which cannot be |
2490 |
|
|
expressed with the existing Accept headers. |
2491 |
|
|
|
2492 |
|
|
Some sites use Netscape cookies (persistent client state http |
2493 |
|
|
cookies) to implement a user preferences mechanism. |
2494 |
|
|
|
2495 |
|
|
19.5.2 Bandwidth negotiation |
2496 |
|
|
|
2497 |
|
|
With a bandwidth negotiation mechanism, the time needed to retrieve |
2498 |
|
|
a particular variant over the network can be taken into account |
2499 |
|
|
during the negotiation process. Work on mechanisms for bandwidth |
2500 |
|
|
negotiation has been done since at least 1993, but this work has |
2501 |
|
|
not yet yielded a successful standard mechanism for bandwidth |
2502 |
|
|
negotiation. Cascaded proxy caches introduce additional complexity |
2503 |
|
|
in this area. |
2504 |
|
|
|
2505 |
|
|
This specification does not attempt to solve the problem of |
2506 |
|
|
bandwidth negotiation. There is some hope that the feature |
2507 |
|
|
negotiation framework will allow the introduction of an adequate |
2508 |
|
|
solution for bandwidth negotiation. |
2509 |
|
|
|
2510 |
|
|
19.5.3 Content transformation by proxies |
2511 |
|
|
|
2512 |
|
|
Recently, there has been some attention to content transformation by |
2513 |
|
|
proxies. An example is the transformation of an image/gif response |
2514 |
|
|
to a shorter image/jpeg response, with potential degraded quality, to |
2515 |
|
|
save bandwidth. Another example is the transformation of an |
2516 |
|
|
application/postscript response to a text/html response, with |
2517 |
|
|
definite degraded quality, to allow viewing by a user agent which |
2518 |
|
|
cannot handle postscript. |
2519 |
|
|
|
2520 |
|
|
The impact of such transformations on the quality of content on the |
2521 |
|
|
web, and the impact on the current model for the allocation of trust |
2522 |
|
|
to various parties in a HTTP transaction, has not yet been fully |
2523 |
|
|
explored. |
2524 |
|
|
|
2525 |
|
|
Content transformation could be a useful optimization for transparent |
2526 |
|
|
content negotiation. A response with a variant list |
2527 |
|
|
|
2528 |
|
|
{"map.gif" 1.0 {type image/gif} {features !monochrome}}, |
2529 |
|
|
{"map.mono.gif" 0.8 {type image/gif} {features monochrome}} |
2530 |
|
|
|
2531 |
|
|
could include an additional response header |
2532 |
|
|
|
2533 |
|
|
Allow-Transform: "map.gif" -> "map.mono.gif" with "dither-2" |
2534 |
|
|
|
2535 |
|
|
to allow a proxy which has cached "map.gif" to create "map.mono.gif" |
2536 |
|
|
on demand, by applying a particular standardized transformation to |
2537 |
|
|
the "map.gif" data. Another interesting possibility would be |
2538 |
|
|
|
2539 |
|
|
Allow-Transform: "map.gif" -> "map.mono.gif" |
2540 |
|
|
with "http://x.org/java/filters/my_dither" |
2541 |
|
|
|
2542 |
|
|
|
2543 |
|
|
|
2544 |
|
|
|
2545 |
|
|
Expires: February 14, 1997 |
2546 |
|
|
|