| 344 | |
| 345 | <section title="Example: Entity Tags varying on Content-Negotiated Resources" anchor="example.entity.tag.vs.conneg"> |
| 346 | <t> |
| 347 | Consider a resource that is subject to content negotiation (&content-negotiation;), |
| 348 | and where the representations returned upon a GET request vary based on |
| 349 | the Accept-Encoding request header field (&header-accept-encoding;): |
| 350 | </t> |
| 351 | <figure><preamble>>> Request:</preamble><artwork type="message/http; msgtype="request"" x:indent-with=" "> |
| 352 | GET /index HTTP/1.1 |
| 353 | Host: www.example.com |
| 354 | Accept-Encoding: gzip |
| 355 | |
| 356 | </artwork></figure> |
| 357 | <t> |
| 358 | In this case, the response may use the gzip Content Coding or not. |
| 359 | If it does, it might look like that: |
| 360 | </t> |
| 361 | <figure><preamble>>> Response:</preamble><artwork type="message/http; msgtype="response"" x:indent-with=" "> |
| 362 | HTTP/1.1 200 OK |
| 363 | Date: Thu, 26 Mar 2010 00:05:00 GMT |
| 364 | ETag: "123-a" |
| 365 | Content-Length: <x:length-of target="exbody"/> |
| 366 | Vary: Accept-Encoding |
| 367 | Content-Type: text/plain |
| 368 | |
| 369 | <x:span anchor="exbody">Hello World! |
| 370 | Hello World! |
| 371 | Hello World! |
| 372 | Hello World! |
| 373 | Hello World! |
| 374 | </x:span></artwork></figure> |
| 375 | <t> |
| 376 | A variant that does use gzip Content Coding would be: |
| 377 | </t> |
| 378 | <figure><preamble>>> Response:</preamble><artwork type="message/http; msgtype="response"" x:indent-with=" "> |
| 379 | HTTP/1.1 200 OK |
| 380 | Date: Thu, 26 Mar 2010 00:05:00 GMT |
| 381 | ETag: "123-b" |
| 382 | Content-Length: 43 |
| 383 | Vary: Accept-Encoding |
| 384 | Content-Type: text/plain |
| 385 | Content-Encoding: gzip |
| 386 | |
| 387 | <spanx>...binary data...</spanx></artwork></figure> |
| 388 | <x:note> |
| 389 | <t> |
| 390 | <x:h>Note:</x:h> Content Codings are a property of the response |
| 391 | entity, thus affect the Entity Tag. An alternative are Transfer |
| 392 | Codings (&transfer-codings;) which apply only the transfer of |
| 393 | the message, and thus do not require assigning distinct entity tags. |
| 394 | </t> |
| 395 | </x:note> |
| 1257 | <reference anchor="Part3"> |
| 1258 | <front> |
| 1259 | <title abbrev="HTTP/1.1">HTTP/1.1, part 3: Message Payload and Content Negotiation</title> |
| 1260 | <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor"> |
| 1261 | <organization abbrev="Day Software">Day Software</organization> |
| 1262 | <address><email>fielding@gbiv.com</email></address> |
| 1263 | </author> |
| 1264 | <author initials="J." surname="Gettys" fullname="Jim Gettys"> |
| 1265 | <organization>One Laptop per Child</organization> |
| 1266 | <address><email>jg@laptop.org</email></address> |
| 1267 | </author> |
| 1268 | <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul"> |
| 1269 | <organization abbrev="HP">Hewlett-Packard Company</organization> |
| 1270 | <address><email>JeffMogul@acm.org</email></address> |
| 1271 | </author> |
| 1272 | <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen"> |
| 1273 | <organization abbrev="Microsoft">Microsoft Corporation</organization> |
| 1274 | <address><email>henrikn@microsoft.com</email></address> |
| 1275 | </author> |
| 1276 | <author initials="L." surname="Masinter" fullname="Larry Masinter"> |
| 1277 | <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization> |
| 1278 | <address><email>LMM@acm.org</email></address> |
| 1279 | </author> |
| 1280 | <author initials="P." surname="Leach" fullname="Paul J. Leach"> |
| 1281 | <organization abbrev="Microsoft">Microsoft Corporation</organization> |
| 1282 | <address><email>paulle@microsoft.com</email></address> |
| 1283 | </author> |
| 1284 | <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee"> |
| 1285 | <organization abbrev="W3C/MIT">World Wide Web Consortium</organization> |
| 1286 | <address><email>timbl@w3.org</email></address> |
| 1287 | </author> |
| 1288 | <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor"> |
| 1289 | <organization abbrev="W3C">World Wide Web Consortium</organization> |
| 1290 | <address><email>ylafon@w3.org</email></address> |
| 1291 | </author> |
| 1292 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
| 1293 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
| 1294 | <address><email>julian.reschke@greenbytes.de</email></address> |
| 1295 | </author> |
| 1296 | <date month="&ID-MONTH;" year="&ID-YEAR;"/> |
| 1297 | </front> |
| 1298 | <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p3-payload-&ID-VERSION;"/> |
| 1299 | <x:source href="p3-payload.xml" basename="p3-payload"/> |
| 1300 | </reference> |
| 1301 | |