source: draft-ietf-httpbis/02/draft-ietf-httpbis-p4-conditional-02.txt @ 559

Last change on this file since 559 was 559, checked in by fielding@…, 10 years ago

remove executable and set eol-style for earlier drafts

  • Property svn:eol-style set to native
File size: 45.1 KB
Line 
1
2
3
4Network Working Group                                   R. Fielding, Ed.
5Internet-Draft                                              Day Software
6Obsoletes: 2616 (if approved)                                  J. Gettys
7Intended status: Standards Track                    One Laptop per Child
8Expires: August 27, 2008                                        J. Mogul
9                                                                      HP
10                                                              H. Frystyk
11                                                               Microsoft
12                                                             L. Masinter
13                                                           Adobe Systems
14                                                                P. Leach
15                                                               Microsoft
16                                                          T. Berners-Lee
17                                                                 W3C/MIT
18                                                           Y. Lafon, Ed.
19                                                                     W3C
20                                                         J. Reschke, Ed.
21                                                              greenbytes
22                                                       February 24, 2008
23
24
25                 HTTP/1.1, part 4: Conditional Requests
26                  draft-ietf-httpbis-p4-conditional-02
27
28Status of this Memo
29
30   By submitting this Internet-Draft, each author represents that any
31   applicable patent or other IPR claims of which he or she is aware
32   have been or will be disclosed, and any of which he or she becomes
33   aware will be disclosed, in accordance with Section 6 of BCP 79.
34
35   Internet-Drafts are working documents of the Internet Engineering
36   Task Force (IETF), its areas, and its working groups.  Note that
37   other groups may also distribute working documents as Internet-
38   Drafts.
39
40   Internet-Drafts are draft documents valid for a maximum of six months
41   and may be updated, replaced, or obsoleted by other documents at any
42   time.  It is inappropriate to use Internet-Drafts as reference
43   material or to cite them other than as "work in progress."
44
45   The list of current Internet-Drafts can be accessed at
46   http://www.ietf.org/ietf/1id-abstracts.txt.
47
48   The list of Internet-Draft Shadow Directories can be accessed at
49   http://www.ietf.org/shadow.html.
50
51   This Internet-Draft will expire on August 27, 2008.
52
53
54
55Fielding, et al.         Expires August 27, 2008                [Page 1]
56
57Internet-Draft              HTTP/1.1, Part 4               February 2008
58
59
60Copyright Notice
61
62   Copyright (C) The IETF Trust (2008).
63
64Abstract
65
66   The Hypertext Transfer Protocol (HTTP) is an application-level
67   protocol for distributed, collaborative, hypermedia information
68   systems.  HTTP has been in use by the World Wide Web global
69   information initiative since 1990.  This document is Part 4 of the
70   seven-part specification that defines the protocol referred to as
71   "HTTP/1.1" and, taken together, obsoletes RFC 2616.  Part 4 defines
72   request header fields for indicating conditional requests and the
73   rules for constructing responses to those requests.
74
75Editorial Note (To be removed by RFC Editor)
76
77   Discussion of this draft should take place on the HTTPBIS working
78   group mailing list (ietf-http-wg@w3.org).  The current issues list is
79   at <http://www.tools.ietf.org/wg/httpbis/trac/report/11> and related
80   documents (including fancy diffs) can be found at
81   <http://www.tools.ietf.org/wg/httpbis/>.
82
83   This draft incorporates those issue resolutions that were either
84   collected in the original RFC2616 errata list
85   (<http://purl.org/NET/http-errata>), or which were agreed upon on the
86   mailing list between October 2006 and November 2007 (as published in
87   "draft-lafon-rfc2616bis-03").
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111Fielding, et al.         Expires August 27, 2008                [Page 2]
112
113Internet-Draft              HTTP/1.1, Part 4               February 2008
114
115
116Table of Contents
117
118   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  4
119     1.1.  Requirements . . . . . . . . . . . . . . . . . . . . . . .  4
120   2.  Notational Conventions and Generic Grammar . . . . . . . . . .  4
121   3.  Entity Tags  . . . . . . . . . . . . . . . . . . . . . . . . .  5
122   4.  Status Code Definitions  . . . . . . . . . . . . . . . . . . .  5
123     4.1.  304 Not Modified . . . . . . . . . . . . . . . . . . . . .  5
124     4.2.  412 Precondition Failed  . . . . . . . . . . . . . . . . .  6
125   5.  Weak and Strong Validators . . . . . . . . . . . . . . . . . .  6
126   6.  Rules for When to Use Entity Tags and Last-Modified Dates  . .  9
127   7.  Header Field Definitions . . . . . . . . . . . . . . . . . . . 11
128     7.1.  ETag . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
129     7.2.  If-Match . . . . . . . . . . . . . . . . . . . . . . . . . 12
130     7.3.  If-Modified-Since  . . . . . . . . . . . . . . . . . . . . 13
131     7.4.  If-None-Match  . . . . . . . . . . . . . . . . . . . . . . 14
132     7.5.  If-Unmodified-Since  . . . . . . . . . . . . . . . . . . . 16
133     7.6.  Last-Modified  . . . . . . . . . . . . . . . . . . . . . . 16
134   8.  IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 17
135   9.  Security Considerations  . . . . . . . . . . . . . . . . . . . 17
136   10. Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . 17
137   11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 17
138     11.1. Normative References . . . . . . . . . . . . . . . . . . . 17
139     11.2. Informative References . . . . . . . . . . . . . . . . . . 18
140   Appendix A.  Compatibility with Previous Versions  . . . . . . . . 18
141     A.1.  Changes from RFC 2616  . . . . . . . . . . . . . . . . . . 18
142   Appendix B.  Change Log (to be removed by RFC Editor before
143                publication)  . . . . . . . . . . . . . . . . . . . . 18
144     B.1.  Since RFC2616  . . . . . . . . . . . . . . . . . . . . . . 18
145     B.2.  Since draft-ietf-httpbis-p4-conditional-00 . . . . . . . . 18
146     B.3.  Since draft-ietf-httpbis-p4-conditional-01 . . . . . . . . 18
147   Index  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
148   Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 20
149   Intellectual Property and Copyright Statements . . . . . . . . . . 23
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167Fielding, et al.         Expires August 27, 2008                [Page 3]
168
169Internet-Draft              HTTP/1.1, Part 4               February 2008
170
171
1721.  Introduction
173
174   This document defines HTTP/1.1 response metadata for indicating
175   potential changes to payload content, including modification time
176   stamps and opaque entity-tags, and the HTTP conditional request
177   mechanisms that allow preconditions to be placed on a request method.
178   Conditional GET requests allow for efficient cache updates.  Other
179   conditional request methods are used to protect against overwriting
180   or misunderstanding the state of a resource that has been changed
181   unbeknownst to the requesting client.
182
183   This document is currently disorganized in order to minimize the
184   changes between drafts and enable reviewers to see the smaller errata
185   changes.  The next draft will reorganize the sections to better
186   reflect the content.  In particular, the sections on resource
187   metadata will be discussed first and then followed by each
188   conditional request-header, concluding with a definition of
189   precedence and the expectation of ordering strong validator checks
190   before weak validator checks.  It is likely that more content from
191   [Part6] will migrate to this part, where appropriate.  The current
192   mess reflects how widely dispersed these topics and associated
193   requirements had become in [RFC2616].
194
1951.1.  Requirements
196
197   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
198   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
199   document are to be interpreted as described in [RFC2119].
200
201   An implementation is not compliant if it fails to satisfy one or more
202   of the MUST or REQUIRED level requirements for the protocols it
203   implements.  An implementation that satisfies all the MUST or
204   REQUIRED level and all the SHOULD level requirements for its
205   protocols is said to be "unconditionally compliant"; one that
206   satisfies all the MUST level requirements but not all the SHOULD
207   level requirements for its protocols is said to be "conditionally
208   compliant."
209
210
2112.  Notational Conventions and Generic Grammar
212
213   This specification uses the ABNF syntax defined in Section 2.1 of
214   [Part1] and the core rules defined in Section 2.2 of [Part1]:
215   [[abnf.dep: ABNF syntax and basic rules will be adopted from RFC
216   5234, see <http://tools.ietf.org/wg/httpbis/trac/ticket/36>.]]
217
218     quoted-string = <quoted-string, defined in [Part1], Section 2.2>
219
220
221
222
223Fielding, et al.         Expires August 27, 2008                [Page 4]
224
225Internet-Draft              HTTP/1.1, Part 4               February 2008
226
227
228   The ABNF rules below are defined in other parts:
229
230     HTTP-date     = <HTTP-date, defined in [Part1], Section 3.3.1>
231
232
2333.  Entity Tags
234
235   Entity tags are used for comparing two or more entities from the same
236   requested resource.  HTTP/1.1 uses entity tags in the ETag
237   (Section 7.1), If-Match (Section 7.2), If-None-Match (Section 7.4),
238   and If-Range (Section 6.3 of [Part5]) header fields.  The definition
239   of how they are used and compared as cache validators is in
240   Section 5.  An entity tag consists of an opaque quoted string,
241   possibly prefixed by a weakness indicator.
242
243     entity-tag = [ weak ] opaque-tag
244     weak       = "W/"
245     opaque-tag = quoted-string
246
247   A "strong entity tag" MAY be shared by two entities of a resource
248   only if they are equivalent by octet equality.
249
250   A "weak entity tag," indicated by the "W/" prefix, MAY be shared by
251   two entities of a resource only if the entities are equivalent and
252   could be substituted for each other with no significant change in
253   semantics.  A weak entity tag can only be used for weak comparison.
254
255   An entity tag MUST be unique across all versions of all entities
256   associated with a particular resource.  A given entity tag value MAY
257   be used for entities obtained by requests on different URIs.  The use
258   of the same entity tag value in conjunction with entities obtained by
259   requests on different URIs does not imply the equivalence of those
260   entities.
261
262
2634.  Status Code Definitions
264
2654.1.  304 Not Modified
266
267   If the client has performed a conditional GET request and access is
268   allowed, but the document has not been modified, the server SHOULD
269   respond with this status code.  The 304 response MUST NOT contain a
270   message-body, and thus is always terminated by the first empty line
271   after the header fields.
272
273   The response MUST include the following header fields:
274
275
276
277
278
279Fielding, et al.         Expires August 27, 2008                [Page 5]
280
281Internet-Draft              HTTP/1.1, Part 4               February 2008
282
283
284   o  Date, unless its omission is required by Section 8.3.1 of [Part1]
285
286   If a clockless origin server obeys these rules, and proxies and
287   clients add their own Date to any response received without one (as
288   already specified by [RFC2068], Section 14.19), caches will operate
289   correctly.
290
291   o  ETag and/or Content-Location, if the header would have been sent
292      in a 200 response to the same request
293
294   o  Expires, Cache-Control, and/or Vary, if the field-value might
295      differ from that sent in any previous response for the same
296      variant
297
298   If the conditional GET used a strong cache validator (see Section 5),
299   the response SHOULD NOT include other entity-headers.  Otherwise
300   (i.e., the conditional GET used a weak validator), the response MUST
301   NOT include other entity-headers; this prevents inconsistencies
302   between cached entity-bodies and updated headers.
303
304   If a 304 response indicates an entity not currently cached, then the
305   cache MUST disregard the response and repeat the request without the
306   conditional.
307
308   If a cache uses a received 304 response to update a cache entry, the
309   cache MUST update the entry to reflect any new field values given in
310   the response.
311
3124.2.  412 Precondition Failed
313
314   The precondition given in one or more of the request-header fields
315   evaluated to false when it was tested on the server.  This response
316   code allows the client to place preconditions on the current resource
317   metainformation (header field data) and thus prevent the requested
318   method from being applied to a resource other than the one intended.
319
320
3215.  Weak and Strong Validators
322
323   Since both origin servers and caches will compare two validators to
324   decide if they represent the same or different entities, one normally
325   would expect that if the entity (the entity-body or any entity-
326   headers) changes in any way, then the associated validator would
327   change as well.  If this is true, then we call this validator a
328   "strong validator."
329
330   However, there might be cases when a server prefers to change the
331   validator only on semantically significant changes, and not when
332
333
334
335Fielding, et al.         Expires August 27, 2008                [Page 6]
336
337Internet-Draft              HTTP/1.1, Part 4               February 2008
338
339
340   insignificant aspects of the entity change.  A validator that does
341   not always change when the resource changes is a "weak validator."
342
343   Entity tags are normally "strong validators," but the protocol
344   provides a mechanism to tag an entity tag as "weak."  One can think
345   of a strong validator as one that changes whenever the bits of an
346   entity changes, while a weak value changes whenever the meaning of an
347   entity changes.  Alternatively, one can think of a strong validator
348   as part of an identifier for a specific entity, while a weak
349   validator is part of an identifier for a set of semantically
350   equivalent entities.
351
352      Note: One example of a strong validator is an integer that is
353      incremented in stable storage every time an entity is changed.
354
355      An entity's modification time, if represented with one-second
356      resolution, could be a weak validator, since it is possible that
357      the resource might be modified twice during a single second.
358
359      Support for weak validators is optional.  However, weak validators
360      allow for more efficient caching of equivalent objects; for
361      example, a hit counter on a site is probably good enough if it is
362      updated every few days or weeks, and any value during that period
363      is likely "good enough" to be equivalent.
364
365   A "use" of a validator is either when a client generates a request
366   and includes the validator in a validating header field, or when a
367   server compares two validators.
368
369   Strong validators are usable in any context.  Weak validators are
370   only usable in contexts that do not depend on exact equality of an
371   entity.  For example, either kind is usable for a conditional GET of
372   a full entity.  However, only a strong validator is usable for a sub-
373   range retrieval, since otherwise the client might end up with an
374   internally inconsistent entity.
375
376   Clients MAY issue simple (non-subrange) GET requests with either weak
377   validators or strong validators.  Clients MUST NOT use weak
378   validators in other forms of request.
379
380   The only function that HTTP/1.1 defines on validators is comparison.
381   There are two validator comparison functions, depending on whether
382   the comparison context allows the use of weak validators or not:
383
384   o  The strong comparison function: in order to be considered equal,
385      both validators MUST be identical in every way, and both MUST NOT
386      be weak.
387
388
389
390
391Fielding, et al.         Expires August 27, 2008                [Page 7]
392
393Internet-Draft              HTTP/1.1, Part 4               February 2008
394
395
396   o  The weak comparison function: in order to be considered equal,
397      both validators MUST be identical in every way, but either or both
398      of them MAY be tagged as "weak" without affecting the result.
399
400   An entity tag is strong unless it is explicitly tagged as weak.
401   Section 3 gives the syntax for entity tags.
402
403   A Last-Modified time, when used as a validator in a request, is
404   implicitly weak unless it is possible to deduce that it is strong,
405   using the following rules:
406
407   o  The validator is being compared by an origin server to the actual
408      current validator for the entity and,
409
410   o  That origin server reliably knows that the associated entity did
411      not change twice during the second covered by the presented
412      validator.
413
414   or
415
416   o  The validator is about to be used by a client in an If-Modified-
417      Since or If-Unmodified-Since header, because the client has a
418      cache entry for the associated entity, and
419
420   o  That cache entry includes a Date value, which gives the time when
421      the origin server sent the original response, and
422
423   o  The presented Last-Modified time is at least 60 seconds before the
424      Date value.
425
426   or
427
428   o  The validator is being compared by an intermediate cache to the
429      validator stored in its cache entry for the entity, and
430
431   o  That cache entry includes a Date value, which gives the time when
432      the origin server sent the original response, and
433
434   o  The presented Last-Modified time is at least 60 seconds before the
435      Date value.
436
437   This method relies on the fact that if two different responses were
438   sent by the origin server during the same second, but both had the
439   same Last-Modified time, then at least one of those responses would
440   have a Date value equal to its Last-Modified time.  The arbitrary 60-
441   second limit guards against the possibility that the Date and Last-
442   Modified values are generated from different clocks, or at somewhat
443   different times during the preparation of the response.  An
444
445
446
447Fielding, et al.         Expires August 27, 2008                [Page 8]
448
449Internet-Draft              HTTP/1.1, Part 4               February 2008
450
451
452   implementation MAY use a value larger than 60 seconds, if it is
453   believed that 60 seconds is too short.
454
455   If a client wishes to perform a sub-range retrieval on a value for
456   which it has only a Last-Modified time and no opaque validator, it
457   MAY do this only if the Last-Modified time is strong in the sense
458   described here.
459
460   A cache or origin server receiving a conditional request, other than
461   a full-body GET request, MUST use the strong comparison function to
462   evaluate the condition.
463
464   These rules allow HTTP/1.1 caches and clients to safely perform sub-
465   range retrievals on values that have been obtained from HTTP/1.0
466   servers.
467
468
4696.  Rules for When to Use Entity Tags and Last-Modified Dates
470
471   We adopt a set of rules and recommendations for origin servers,
472   clients, and caches regarding when various validator types ought to
473   be used, and for what purposes.
474
475   HTTP/1.1 origin servers:
476
477   o  SHOULD send an entity tag validator unless it is not feasible to
478      generate one.
479
480   o  MAY send a weak entity tag instead of a strong entity tag, if
481      performance considerations support the use of weak entity tags, or
482      if it is unfeasible to send a strong entity tag.
483
484   o  SHOULD send a Last-Modified value if it is feasible to send one,
485      unless the risk of a breakdown in semantic transparency that could
486      result from using this date in an If-Modified-Since header would
487      lead to serious problems.
488
489   In other words, the preferred behavior for an HTTP/1.1 origin server
490   is to send both a strong entity tag and a Last-Modified value.
491
492   In order to be legal, a strong entity tag MUST change whenever the
493   associated entity value changes in any way.  A weak entity tag SHOULD
494   change whenever the associated entity changes in a semantically
495   significant way.
496
497      Note: in order to provide semantically transparent caching, an
498      origin server must avoid reusing a specific strong entity tag
499      value for two different entities, or reusing a specific weak
500
501
502
503Fielding, et al.         Expires August 27, 2008                [Page 9]
504
505Internet-Draft              HTTP/1.1, Part 4               February 2008
506
507
508      entity tag value for two semantically different entities.  Cache
509      entries might persist for arbitrarily long periods, regardless of
510      expiration times, so it might be inappropriate to expect that a
511      cache will never again attempt to validate an entry using a
512      validator that it obtained at some point in the past.
513
514   HTTP/1.1 clients:
515
516   o  If an entity tag has been provided by the origin server, MUST use
517      that entity tag in any cache-conditional request (using If-Match
518      or If-None-Match).
519
520   o  If only a Last-Modified value has been provided by the origin
521      server, SHOULD use that value in non-subrange cache-conditional
522      requests (using If-Modified-Since).
523
524   o  If only a Last-Modified value has been provided by an HTTP/1.0
525      origin server, MAY use that value in subrange cache-conditional
526      requests (using If-Unmodified-Since:).  The user agent SHOULD
527      provide a way to disable this, in case of difficulty.
528
529   o  If both an entity tag and a Last-Modified value have been provided
530      by the origin server, SHOULD use both validators in cache-
531      conditional requests.  This allows both HTTP/1.0 and HTTP/1.1
532      caches to respond appropriately.
533
534   An HTTP/1.1 origin server, upon receiving a conditional request that
535   includes both a Last-Modified date (e.g., in an If-Modified-Since or
536   If-Unmodified-Since header field) and one or more entity tags (e.g.,
537   in an If-Match, If-None-Match, or If-Range header field) as cache
538   validators, MUST NOT return a response status of 304 (Not Modified)
539   unless doing so is consistent with all of the conditional header
540   fields in the request.
541
542   An HTTP/1.1 caching proxy, upon receiving a conditional request that
543   includes both a Last-Modified date and one or more entity tags as
544   cache validators, MUST NOT return a locally cached response to the
545   client unless that cached response is consistent with all of the
546   conditional header fields in the request.
547
548      Note: The general principle behind these rules is that HTTP/1.1
549      servers and clients should transmit as much non-redundant
550      information as is available in their responses and requests.
551      HTTP/1.1 systems receiving this information will make the most
552      conservative assumptions about the validators they receive.
553
554      HTTP/1.0 clients and caches will ignore entity tags.  Generally,
555      last-modified values received or used by these systems will
556
557
558
559Fielding, et al.         Expires August 27, 2008               [Page 10]
560
561Internet-Draft              HTTP/1.1, Part 4               February 2008
562
563
564      support transparent and efficient caching, and so HTTP/1.1 origin
565      servers should provide Last-Modified values.  In those rare cases
566      where the use of a Last-Modified value as a validator by an
567      HTTP/1.0 system could result in a serious problem, then HTTP/1.1
568      origin servers should not provide one.
569
570
5717.  Header Field Definitions
572
573   This section defines the syntax and semantics of HTTP/1.1 header
574   fields related to conditional requests.
575
576   For entity-header fields, both sender and recipient refer to either
577   the client or the server, depending on who sends and who receives the
578   entity.
579
5807.1.  ETag
581
582   The ETag response-header field provides the current value of the
583   entity tag for the requested variant.  The headers used with entity
584   tags are described in Sections 7.2 and 7.4 of this document, and in
585   Section 6.3 of [Part5].  The entity tag MAY be used for comparison
586   with other entities from the same resource (see Section 5).
587
588     ETag = "ETag" ":" entity-tag
589
590   Examples:
591
592      ETag: "xyzzy"
593      ETag: W/"xyzzy"
594      ETag: ""
595
596   The ETag response-header field value, an entity tag, provides for an
597   "opaque" cache validator.  This might allow more reliable validation
598   in situations where it is inconvenient to store modification dates,
599   where the one-second resolution of HTTP date values is not
600   sufficient, or where the origin server wishes to avoid certain
601   paradoxes that might arise from the use of modification dates.
602
603   The principle behind entity tags is that only the service author
604   knows the semantics of a resource well enough to select an
605   appropriate cache validation mechanism, and the specification of any
606   validator comparison function more complex than byte-equality would
607   open up a can of worms.  Thus, comparisons of any other headers
608   (except Last-Modified, for compatibility with HTTP/1.0) are never
609   used for purposes of validating a cache entry.
610
611
612
613
614
615Fielding, et al.         Expires August 27, 2008               [Page 11]
616
617Internet-Draft              HTTP/1.1, Part 4               February 2008
618
619
6207.2.  If-Match
621
622   The If-Match request-header field is used with a method to make it
623   conditional.  A client that has one or more entities previously
624   obtained from the resource can verify that one of those entities is
625   current by including a list of their associated entity tags in the
626   If-Match header field.  Entity tags are defined in Section 3.  The
627   purpose of this feature is to allow efficient updates of cached
628   information with a minimum amount of transaction overhead.  It is
629   also used, on updating requests, to prevent inadvertent modification
630   of the wrong version of a resource.  As a special case, the value "*"
631   matches any current entity of the resource.
632
633     If-Match = "If-Match" ":" ( "*" | 1#entity-tag )
634
635   If any of the entity tags match the entity tag of the entity that
636   would have been returned in the response to a similar GET request
637   (without the If-Match header) on that resource, or if "*" is given
638   and any current entity exists for that resource, then the server MAY
639   perform the requested method as if the If-Match header field did not
640   exist.
641
642   A server MUST use the strong comparison function (see Section 5) to
643   compare the entity tags in If-Match.
644
645   If none of the entity tags match, or if "*" is given and no current
646   entity exists, the server MUST NOT perform the requested method, and
647   MUST return a 412 (Precondition Failed) response.  This behavior is
648   most useful when the client wants to prevent an updating method, such
649   as PUT, from modifying a resource that has changed since the client
650   last retrieved it.
651
652   If the request would, without the If-Match header field, result in
653   anything other than a 2xx or 412 status, then the If-Match header
654   MUST be ignored.
655
656   The meaning of "If-Match: *" is that the method SHOULD be performed
657   if the representation selected by the origin server (or by a cache,
658   possibly using the Vary mechanism, see Section 16.5 of [Part6])
659   exists, and MUST NOT be performed if the representation does not
660   exist.
661
662   A request intended to update a resource (e.g., a PUT) MAY include an
663   If-Match header field to signal that the request method MUST NOT be
664   applied if the entity corresponding to the If-Match value (a single
665   entity tag) is no longer a representation of that resource.  This
666   allows the user to indicate that they do not wish the request to be
667   successful if the resource has been changed without their knowledge.
668
669
670
671Fielding, et al.         Expires August 27, 2008               [Page 12]
672
673Internet-Draft              HTTP/1.1, Part 4               February 2008
674
675
676   Examples:
677
678       If-Match: "xyzzy"
679       If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
680       If-Match: *
681
682   The result of a request having both an If-Match header field and
683   either an If-None-Match or an If-Modified-Since header fields is
684   undefined by this specification.
685
6867.3.  If-Modified-Since
687
688   The If-Modified-Since request-header field is used with a method to
689   make it conditional: if the requested variant has not been modified
690   since the time specified in this field, an entity will not be
691   returned from the server; instead, a 304 (Not Modified) response will
692   be returned without any message-body.
693
694     If-Modified-Since = "If-Modified-Since" ":" HTTP-date
695
696   An example of the field is:
697
698       If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
699
700   A GET method with an If-Modified-Since header and no Range header
701   requests that the identified entity be transferred only if it has
702   been modified since the date given by the If-Modified-Since header.
703   The algorithm for determining this includes the following cases:
704
705   1.  If the request would normally result in anything other than a 200
706       (OK) status, or if the passed If-Modified-Since date is invalid,
707       the response is exactly the same as for a normal GET.  A date
708       which is later than the server's current time is invalid.
709
710   2.  If the variant has been modified since the If-Modified-Since
711       date, the response is exactly the same as for a normal GET.
712
713   3.  If the variant has not been modified since a valid If-Modified-
714       Since date, the server SHOULD return a 304 (Not Modified)
715       response.
716
717   The purpose of this feature is to allow efficient updates of cached
718   information with a minimum amount of transaction overhead.
719
720      Note: The Range request-header field modifies the meaning of If-
721      Modified-Since; see Section 6.4 of [Part5] for full details.
722
723
724
725
726
727Fielding, et al.         Expires August 27, 2008               [Page 13]
728
729Internet-Draft              HTTP/1.1, Part 4               February 2008
730
731
732      Note: If-Modified-Since times are interpreted by the server, whose
733      clock might not be synchronized with the client.
734
735      Note: When handling an If-Modified-Since header field, some
736      servers will use an exact date comparison function, rather than a
737      less-than function, for deciding whether to send a 304 (Not
738      Modified) response.  To get best results when sending an If-
739      Modified-Since header field for cache validation, clients are
740      advised to use the exact date string received in a previous Last-
741      Modified header field whenever possible.
742
743      Note: If a client uses an arbitrary date in the If-Modified-Since
744      header instead of a date taken from the Last-Modified header for
745      the same request, the client should be aware of the fact that this
746      date is interpreted in the server's understanding of time.  The
747      client should consider unsynchronized clocks and rounding problems
748      due to the different encodings of time between the client and
749      server.  This includes the possibility of race conditions if the
750      document has changed between the time it was first requested and
751      the If-Modified-Since date of a subsequent request, and the
752      possibility of clock-skew-related problems if the If-Modified-
753      Since date is derived from the client's clock without correction
754      to the server's clock.  Corrections for different time bases
755      between client and server are at best approximate due to network
756      latency.
757
758   The result of a request having both an If-Modified-Since header field
759   and either an If-Match or an If-Unmodified-Since header fields is
760   undefined by this specification.
761
7627.4.  If-None-Match
763
764   The If-None-Match request-header field is used with a method to make
765   it conditional.  A client that has one or more entities previously
766   obtained from the resource can verify that none of those entities is
767   current by including a list of their associated entity tags in the
768   If-None-Match header field.  The purpose of this feature is to allow
769   efficient updates of cached information with a minimum amount of
770   transaction overhead.  It is also used to prevent a method (e.g.
771   PUT) from inadvertently modifying an existing resource when the
772   client believes that the resource does not exist.
773
774   As a special case, the value "*" matches any current entity of the
775   resource.
776
777     If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )
778
779   If any of the entity tags match the entity tag of the entity that
780
781
782
783Fielding, et al.         Expires August 27, 2008               [Page 14]
784
785Internet-Draft              HTTP/1.1, Part 4               February 2008
786
787
788   would have been returned in the response to a similar GET request
789   (without the If-None-Match header) on that resource, or if "*" is
790   given and any current entity exists for that resource, then the
791   server MUST NOT perform the requested method, unless required to do
792   so because the resource's modification date fails to match that
793   supplied in an If-Modified-Since header field in the request.
794   Instead, if the request method was GET or HEAD, the server SHOULD
795   respond with a 304 (Not Modified) response, including the cache-
796   related header fields (particularly ETag) of one of the entities that
797   matched.  For all other request methods, the server MUST respond with
798   a status of 412 (Precondition Failed).
799
800   See Section 5 for rules on how to determine if two entities tags
801   match.  The weak comparison function can only be used with GET or
802   HEAD requests.
803
804   If none of the entity tags match, then the server MAY perform the
805   requested method as if the If-None-Match header field did not exist,
806   but MUST also ignore any If-Modified-Since header field(s) in the
807   request.  That is, if no entity tags match, then the server MUST NOT
808   return a 304 (Not Modified) response.
809
810   If the request would, without the If-None-Match header field, result
811   in anything other than a 2xx or 304 status, then the If-None-Match
812   header MUST be ignored.  (See Section 6 for a discussion of server
813   behavior when both If-Modified-Since and If-None-Match appear in the
814   same request.)
815
816   The meaning of "If-None-Match: *" is that the method MUST NOT be
817   performed if the representation selected by the origin server (or by
818   a cache, possibly using the Vary mechanism, see Section 16.5 of
819   [Part6]) exists, and SHOULD be performed if the representation does
820   not exist.  This feature is intended to be useful in preventing races
821   between PUT operations.
822
823   Examples:
824
825       If-None-Match: "xyzzy"
826       If-None-Match: W/"xyzzy"
827       If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
828       If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
829       If-None-Match: *
830
831   The result of a request having both an If-None-Match header field and
832   either an If-Match or an If-Unmodified-Since header fields is
833   undefined by this specification.
834
835
836
837
838
839Fielding, et al.         Expires August 27, 2008               [Page 15]
840
841Internet-Draft              HTTP/1.1, Part 4               February 2008
842
843
8447.5.  If-Unmodified-Since
845
846   The If-Unmodified-Since request-header field is used with a method to
847   make it conditional.  If the requested resource has not been modified
848   since the time specified in this field, the server SHOULD perform the
849   requested operation as if the If-Unmodified-Since header were not
850   present.
851
852   If the requested variant has been modified since the specified time,
853   the server MUST NOT perform the requested operation, and MUST return
854   a 412 (Precondition Failed).
855
856     If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
857
858   An example of the field is:
859
860       If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
861
862   If the request normally (i.e., without the If-Unmodified-Since
863   header) would result in anything other than a 2xx or 412 status, the
864   If-Unmodified-Since header SHOULD be ignored.
865
866   If the specified date is invalid, the header is ignored.
867
868   The result of a request having both an If-Unmodified-Since header
869   field and either an If-None-Match or an If-Modified-Since header
870   fields is undefined by this specification.
871
8727.6.  Last-Modified
873
874   The Last-Modified entity-header field indicates the date and time at
875   which the origin server believes the variant was last modified.
876
877     Last-Modified  = "Last-Modified" ":" HTTP-date
878
879   An example of its use is
880
881       Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
882
883   The exact meaning of this header field depends on the implementation
884   of the origin server and the nature of the original resource.  For
885   files, it may be just the file system last-modified time.  For
886   entities with dynamically included parts, it may be the most recent
887   of the set of last-modify times for its component parts.  For
888   database gateways, it may be the last-update time stamp of the
889   record.  For virtual objects, it may be the last time the internal
890   state changed.
891
892
893
894
895Fielding, et al.         Expires August 27, 2008               [Page 16]
896
897Internet-Draft              HTTP/1.1, Part 4               February 2008
898
899
900   An origin server MUST NOT send a Last-Modified date which is later
901   than the server's time of message origination.  In such cases, where
902   the resource's last modification would indicate some time in the
903   future, the server MUST replace that date with the message
904   origination date.
905
906   An origin server SHOULD obtain the Last-Modified value of the entity
907   as close as possible to the time that it generates the Date value of
908   its response.  This allows a recipient to make an accurate assessment
909   of the entity's modification time, especially if the entity changes
910   near the time that the response is generated.
911
912   HTTP/1.1 servers SHOULD send Last-Modified whenever feasible.
913
914   The Last-Modified entity-header field value is often used as a cache
915   validator.  In simple terms, a cache entry is considered to be valid
916   if the entity has not been modified since the Last-Modified value.
917
918
9198.  IANA Considerations
920
921   [[anchor2: TBD.]]
922
923
9249.  Security Considerations
925
926   No additional security considerations have been identified beyond
927   those applicable to HTTP in general [Part1].
928
929
93010.  Acknowledgments
931
932
93311.  References
934
93511.1.  Normative References
936
937   [Part1]    Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
938              Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
939              and J. Reschke, Ed., "HTTP/1.1, part 1: URIs, Connections,
940              and Message Parsing", draft-ietf-httpbis-p1-messaging-02
941              (work in progress), February 2008.
942
943   [Part5]    Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
944              Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
945              and J. Reschke, Ed., "HTTP/1.1, part 5: Range Requests and
946              Partial Responses", draft-ietf-httpbis-p5-range-02 (work
947              in progress), February 2008.
948
949
950
951Fielding, et al.         Expires August 27, 2008               [Page 17]
952
953Internet-Draft              HTTP/1.1, Part 4               February 2008
954
955
956   [Part6]    Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
957              Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
958              and J. Reschke, Ed., "HTTP/1.1, part 6: Caching",
959              draft-ietf-httpbis-p6-cache-02 (work in progress),
960              February 2008.
961
962   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
963              Requirement Levels", BCP 14, RFC 2119, March 1997.
964
96511.2.  Informative References
966
967   [RFC2068]  Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T.
968              Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1",
969              RFC 2068, January 1997.
970
971   [RFC2616]  Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
972              Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
973              Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
974
975
976Appendix A.  Compatibility with Previous Versions
977
978A.1.  Changes from RFC 2616
979
980
981Appendix B.  Change Log (to be removed by RFC Editor before publication)
982
983B.1.  Since RFC2616
984
985   Extracted relevant partitions from [RFC2616].
986
987B.2.  Since draft-ietf-httpbis-p4-conditional-00
988
989   Closed issues:
990
991   o  <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/35>: "Normative
992      and Informative references"
993
994   Other changes:
995
996   o  Move definitions of 304 and 412 condition codes from Part2.
997
998B.3.  Since draft-ietf-httpbis-p4-conditional-01
999
1000   Ongoing work on ABNF conversion
1001   (<http://www3.tools.ietf.org/wg/httpbis/trac/ticket/36>):
1002
1003
1004
1005
1006
1007Fielding, et al.         Expires August 27, 2008               [Page 18]
1008
1009Internet-Draft              HTTP/1.1, Part 4               February 2008
1010
1011
1012   o  Add explicit references to BNF syntax and rules imported from
1013      other parts of the specification.
1014
1015
1016Index
1017
1018   3
1019      304 Not Modified (status code)  5
1020
1021   4
1022      412 Precondition Failed (status code)  6
1023
1024   E
1025      ETag header  11
1026
1027   G
1028      Grammar
1029         entity-tag  5
1030         ETag  11
1031         If-Match  12
1032         If-Modified-Since  13
1033         If-None-Match  14
1034         If-Unmodified-Since  16
1035         Last-Modified  16
1036         opaque-tag  5
1037         weak  5
1038
1039   H
1040      Headers
1041         ETag  11
1042         If-Match  12
1043         If-Modified-Since  13
1044         If-None-Match  14
1045         If-Unmodified-Since  16
1046         Last-Modified  16
1047
1048   I
1049      If-Match header  12
1050      If-Modified-Since header  13
1051      If-None-Match header  14
1052      If-Unmodified-Since header  16
1053
1054   L
1055      Last-Modified header  16
1056
1057   S
1058      Status Codes
1059         304 Not Modified  5
1060
1061
1062
1063Fielding, et al.         Expires August 27, 2008               [Page 19]
1064
1065Internet-Draft              HTTP/1.1, Part 4               February 2008
1066
1067
1068         412 Precondition Failed  6
1069
1070
1071Authors' Addresses
1072
1073   Roy T. Fielding (editor)
1074   Day Software
1075   23 Corporate Plaza DR, Suite 280
1076   Newport Beach, CA  92660
1077   USA
1078
1079   Phone: +1-949-706-5300
1080   Fax:   +1-949-706-5305
1081   Email: fielding@gbiv.com
1082   URI:   http://roy.gbiv.com/
1083
1084
1085   Jim Gettys
1086   One Laptop per Child
1087   21 Oak Knoll Road
1088   Carlisle, MA  01741
1089   USA
1090
1091   Email: jg@laptop.org
1092   URI:   http://www.laptop.org/
1093
1094
1095   Jeffrey C. Mogul
1096   Hewlett-Packard Company
1097   HP Labs, Large Scale Systems Group
1098   1501 Page Mill Road, MS 1177
1099   Palo Alto, CA  94304
1100   USA
1101
1102   Email: JeffMogul@acm.org
1103
1104
1105   Henrik Frystyk Nielsen
1106   Microsoft Corporation
1107   1 Microsoft Way
1108   Redmond, WA  98052
1109   USA
1110
1111   Email: henrikn@microsoft.com
1112
1113
1114
1115
1116
1117
1118
1119Fielding, et al.         Expires August 27, 2008               [Page 20]
1120
1121Internet-Draft              HTTP/1.1, Part 4               February 2008
1122
1123
1124   Larry Masinter
1125   Adobe Systems, Incorporated
1126   345 Park Ave
1127   San Jose, CA  95110
1128   USA
1129
1130   Email: LMM@acm.org
1131   URI:   http://larry.masinter.net/
1132
1133
1134   Paul J. Leach
1135   Microsoft Corporation
1136   1 Microsoft Way
1137   Redmond, WA  98052
1138
1139   Email: paulle@microsoft.com
1140
1141
1142   Tim Berners-Lee
1143   World Wide Web Consortium
1144   MIT Computer Science and Artificial Intelligence Laboratory
1145   The Stata Center, Building 32
1146   32 Vassar Street
1147   Cambridge, MA  02139
1148   USA
1149
1150   Email: timbl@w3.org
1151   URI:   http://www.w3.org/People/Berners-Lee/
1152
1153
1154   Yves Lafon (editor)
1155   World Wide Web Consortium
1156   W3C / ERCIM
1157   2004, rte des Lucioles
1158   Sophia-Antipolis, AM  06902
1159   France
1160
1161   Email: ylafon@w3.org
1162   URI:   http://www.raubacapeu.net/people/yves/
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175Fielding, et al.         Expires August 27, 2008               [Page 21]
1176
1177Internet-Draft              HTTP/1.1, Part 4               February 2008
1178
1179
1180   Julian F. Reschke (editor)
1181   greenbytes GmbH
1182   Hafenweg 16
1183   Muenster, NW  48155
1184   Germany
1185
1186   Phone: +49 251 2807760
1187   Fax:   +49 251 2807761
1188   Email: julian.reschke@greenbytes.de
1189   URI:   http://greenbytes.de/tech/webdav/
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231Fielding, et al.         Expires August 27, 2008               [Page 22]
1232
1233Internet-Draft              HTTP/1.1, Part 4               February 2008
1234
1235
1236Full Copyright Statement
1237
1238   Copyright (C) The IETF Trust (2008).
1239
1240   This document is subject to the rights, licenses and restrictions
1241   contained in BCP 78, and except as set forth therein, the authors
1242   retain all their rights.
1243
1244   This document and the information contained herein are provided on an
1245   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
1246   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
1247   THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
1248   OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
1249   THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
1250   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
1251
1252
1253Intellectual Property
1254
1255   The IETF takes no position regarding the validity or scope of any
1256   Intellectual Property Rights or other rights that might be claimed to
1257   pertain to the implementation or use of the technology described in
1258   this document or the extent to which any license under such rights
1259   might or might not be available; nor does it represent that it has
1260   made any independent effort to identify any such rights.  Information
1261   on the procedures with respect to rights in RFC documents can be
1262   found in BCP 78 and BCP 79.
1263
1264   Copies of IPR disclosures made to the IETF Secretariat and any
1265   assurances of licenses to be made available, or the result of an
1266   attempt made to obtain a general license or permission for the use of
1267   such proprietary rights by implementers or users of this
1268   specification can be obtained from the IETF on-line IPR repository at
1269   http://www.ietf.org/ipr.
1270
1271   The IETF invites any interested party to bring to its attention any
1272   copyrights, patents or patent applications, or other proprietary
1273   rights that may cover technology that may be required to implement
1274   this standard.  Please address the information to the IETF at
1275   ietf-ipr@ietf.org.
1276
1277
1278Acknowledgment
1279
1280   Funding for the RFC Editor function is provided by the IETF
1281   Administrative Support Activity (IASA).
1282
1283
1284
1285
1286
1287Fielding, et al.         Expires August 27, 2008               [Page 23]
1288
Note: See TracBrowser for help on using the repository browser.