source: draft-ietf-httpbis/04/draft-ietf-httpbis-p4-conditional-04.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: 47.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: March 2, 2009                                          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                                                         August 29, 2008
23
24
25                 HTTP/1.1, part 4: Conditional Requests
26                  draft-ietf-httpbis-p4-conditional-04
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 March 2, 2009.
52
53
54
55Fielding, et al.          Expires March 2, 2009                 [Page 1]
56
57Internet-Draft              HTTP/1.1, Part 4                 August 2008
58
59
60Abstract
61
62   The Hypertext Transfer Protocol (HTTP) is an application-level
63   protocol for distributed, collaborative, hypermedia information
64   systems.  HTTP has been in use by the World Wide Web global
65   information initiative since 1990.  This document is Part 4 of the
66   seven-part specification that defines the protocol referred to as
67   "HTTP/1.1" and, taken together, obsoletes RFC 2616.  Part 4 defines
68   request header fields for indicating conditional requests and the
69   rules for constructing responses to those requests.
70
71Editorial Note (To be removed by RFC Editor)
72
73   Discussion of this draft should take place on the HTTPBIS working
74   group mailing list (ietf-http-wg@w3.org).  The current issues list is
75   at <http://www.tools.ietf.org/wg/httpbis/trac/report/11> and related
76   documents (including fancy diffs) can be found at
77   <http://www.tools.ietf.org/wg/httpbis/>.
78
79   The changes in this draft are summarized in Appendix B.4.
80
81
82
83
84
85
86
87
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 March 2, 2009                 [Page 2]
112
113Internet-Draft              HTTP/1.1, Part 4                 August 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     8.1.  Message Header Registration  . . . . . . . . . . . . . . . 17
136   9.  Security Considerations  . . . . . . . . . . . . . . . . . . . 17
137   10. Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . 18
138   11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 18
139     11.1. Normative References . . . . . . . . . . . . . . . . . . . 18
140     11.2. Informative References . . . . . . . . . . . . . . . . . . 18
141   Appendix A.  Compatibility with Previous Versions  . . . . . . . . 18
142     A.1.  Changes from RFC 2616  . . . . . . . . . . . . . . . . . . 18
143   Appendix B.  Change Log (to be removed by RFC Editor before
144                publication)  . . . . . . . . . . . . . . . . . . . . 19
145     B.1.  Since RFC2616  . . . . . . . . . . . . . . . . . . . . . . 19
146     B.2.  Since draft-ietf-httpbis-p4-conditional-00 . . . . . . . . 19
147     B.3.  Since draft-ietf-httpbis-p4-conditional-01 . . . . . . . . 19
148     B.4.  Since draft-ietf-httpbis-p4-conditional-02 . . . . . . . . 19
149     B.5.  Since draft-ietf-httpbis-p4-conditional-03 . . . . . . . . 19
150   Index  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
151   Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 21
152   Intellectual Property and Copyright Statements . . . . . . . . . . 24
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167Fielding, et al.          Expires March 2, 2009                 [Page 3]
168
169Internet-Draft              HTTP/1.1, Part 4                 August 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 March 2, 2009                 [Page 4]
224
225Internet-Draft              HTTP/1.1, Part 4                 August 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 March 2, 2009                 [Page 5]
280
281Internet-Draft              HTTP/1.1, Part 4                 August 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
288      (as already specified by Section 8.3 of [Part1], caches will
289      operate 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 March 2, 2009                 [Page 6]
336
337Internet-Draft              HTTP/1.1, Part 4                 August 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 MUST NOT use weak validators in range requests ([Part5]).
377
378   The only function that HTTP/1.1 defines on validators is comparison.
379   There are two validator comparison functions, depending on whether
380   the comparison context allows the use of weak validators or not:
381
382   o  The strong comparison function: in order to be considered equal,
383      both opaque-tags MUST be identical character-by-character, and
384      both MUST NOT be weak.
385
386   o  The weak comparison function: in order to be considered equal,
387      both opaque-tags MUST be identical character-by-character.
388
389
390
391Fielding, et al.          Expires March 2, 2009                 [Page 7]
392
393Internet-Draft              HTTP/1.1, Part 4                 August 2008
394
395
396   The example below shows the results for a set of entity tag pairs,
397   and both the weak and strong comparison function results:
398
399   +--------+--------+-------------------+-----------------+
400   | ETag 1 | ETag 2 | Strong Comparison | Weak Comparison |
401   +--------+--------+-------------------+-----------------+
402   | W/"1"  | W/"1"  | no match          | match           |
403   | W/"1"  | W/"2"  | no match          | no match        |
404   | W/"1"  | "1"    | no match          | match           |
405   | "1"    | "1"    | match             | match           |
406   +--------+--------+-------------------+-----------------+
407
408   An entity tag is strong unless it is explicitly tagged as weak.
409   Section 3 gives the syntax for entity tags.
410
411   A Last-Modified time, when used as a validator in a request, is
412   implicitly weak unless it is possible to deduce that it is strong,
413   using the following rules:
414
415   o  The validator is being compared by an origin server to the actual
416      current validator for the entity and,
417
418   o  That origin server reliably knows that the associated entity did
419      not change twice during the second covered by the presented
420      validator.
421
422   or
423
424   o  The validator is about to be used by a client in an If-Modified-
425      Since or If-Unmodified-Since header, because the client has a
426      cache entry for the associated entity, and
427
428   o  That cache entry includes a Date value, which gives the time when
429      the origin server sent the original response, and
430
431   o  The presented Last-Modified time is at least 60 seconds before the
432      Date value.
433
434   or
435
436   o  The validator is being compared by an intermediate cache to the
437      validator stored in its cache entry for the entity, and
438
439   o  That cache entry includes a Date value, which gives the time when
440      the origin server sent the original response, and
441
442   o  The presented Last-Modified time is at least 60 seconds before the
443      Date value.
444
445
446
447Fielding, et al.          Expires March 2, 2009                 [Page 8]
448
449Internet-Draft              HTTP/1.1, Part 4                 August 2008
450
451
452   This method relies on the fact that if two different responses were
453   sent by the origin server during the same second, but both had the
454   same Last-Modified time, then at least one of those responses would
455   have a Date value equal to its Last-Modified time.  The arbitrary 60-
456   second limit guards against the possibility that the Date and Last-
457   Modified values are generated from different clocks, or at somewhat
458   different times during the preparation of the response.  An
459   implementation MAY use a value larger than 60 seconds, if it is
460   believed that 60 seconds is too short.
461
462   If a client wishes to perform a sub-range retrieval on a value for
463   which it has only a Last-Modified time and no opaque validator, it
464   MAY do this only if the Last-Modified time is strong in the sense
465   described here.
466
467   A cache or origin server receiving a conditional range request
468   ([Part5]) MUST use the strong comparison function to evaluate the
469   condition.
470
471   These rules allow HTTP/1.1 caches and clients to safely perform sub-
472   range retrievals on values that have been obtained from HTTP/1.0
473   servers.
474
475
4766.  Rules for When to Use Entity Tags and Last-Modified Dates
477
478   We adopt a set of rules and recommendations for origin servers,
479   clients, and caches regarding when various validator types ought to
480   be used, and for what purposes.
481
482   HTTP/1.1 origin servers:
483
484   o  SHOULD send an entity tag validator unless it is not feasible to
485      generate one.
486
487   o  MAY send a weak entity tag instead of a strong entity tag, if
488      performance considerations support the use of weak entity tags, or
489      if it is unfeasible to send a strong entity tag.
490
491   o  SHOULD send a Last-Modified value if it is feasible to send one,
492      unless the risk of a breakdown in semantic transparency that could
493      result from using this date in an If-Modified-Since header would
494      lead to serious problems.
495
496   In other words, the preferred behavior for an HTTP/1.1 origin server
497   is to send both a strong entity tag and a Last-Modified value.
498
499   In order to be legal, a strong entity tag MUST change whenever the
500
501
502
503Fielding, et al.          Expires March 2, 2009                 [Page 9]
504
505Internet-Draft              HTTP/1.1, Part 4                 August 2008
506
507
508   associated entity changes in any way.  A weak entity tag SHOULD
509   change whenever the associated entity changes in a semantically
510   significant way.
511
512      Note: in order to provide semantically transparent caching, an
513      origin server must avoid reusing a specific strong entity tag
514      value for two different entities, or reusing a specific weak
515      entity tag value for two semantically different entities.  Cache
516      entries might persist for arbitrarily long periods, regardless of
517      expiration times, so it might be inappropriate to expect that a
518      cache will never again attempt to validate an entry using a
519      validator that it obtained at some point in the past.
520
521   HTTP/1.1 clients:
522
523   o  If an entity tag has been provided by the origin server, MUST use
524      that entity tag in any cache-conditional request (using If-Match
525      or If-None-Match).
526
527   o  If only a Last-Modified value has been provided by the origin
528      server, SHOULD use that value in non-subrange cache-conditional
529      requests (using If-Modified-Since).
530
531   o  If only a Last-Modified value has been provided by an HTTP/1.0
532      origin server, MAY use that value in subrange cache-conditional
533      requests (using If-Unmodified-Since:).  The user agent SHOULD
534      provide a way to disable this, in case of difficulty.
535
536   o  If both an entity tag and a Last-Modified value have been provided
537      by the origin server, SHOULD use both validators in cache-
538      conditional requests.  This allows both HTTP/1.0 and HTTP/1.1
539      caches to respond appropriately.
540
541   An HTTP/1.1 origin server, upon receiving a conditional request that
542   includes both a Last-Modified date (e.g., in an If-Modified-Since or
543   If-Unmodified-Since header field) and one or more entity tags (e.g.,
544   in an If-Match, If-None-Match, or If-Range header field) as cache
545   validators, MUST NOT return a response status of 304 (Not Modified)
546   unless doing so is consistent with all of the conditional header
547   fields in the request.
548
549   An HTTP/1.1 caching proxy, upon receiving a conditional request that
550   includes both a Last-Modified date and one or more entity tags as
551   cache validators, MUST NOT return a locally cached response to the
552   client unless that cached response is consistent with all of the
553   conditional header fields in the request.
554
555
556
557
558
559Fielding, et al.          Expires March 2, 2009                [Page 10]
560
561Internet-Draft              HTTP/1.1, Part 4                 August 2008
562
563
564      Note: The general principle behind these rules is that HTTP/1.1
565      servers and clients should transmit as much non-redundant
566      information as is available in their responses and requests.
567      HTTP/1.1 systems receiving this information will make the most
568      conservative assumptions about the validators they receive.
569
570      HTTP/1.0 clients and caches will ignore entity tags.  Generally,
571      last-modified values received or used by these systems will
572      support transparent and efficient caching, and so HTTP/1.1 origin
573      servers should provide Last-Modified values.  In those rare cases
574      where the use of a Last-Modified value as a validator by an
575      HTTP/1.0 system could result in a serious problem, then HTTP/1.1
576      origin servers should not provide one.
577
578
5797.  Header Field Definitions
580
581   This section defines the syntax and semantics of HTTP/1.1 header
582   fields related to conditional requests.
583
584   For entity-header fields, both sender and recipient refer to either
585   the client or the server, depending on who sends and who receives the
586   entity.
587
5887.1.  ETag
589
590   The ETag response-header field provides the current value of the
591   entity tag for the requested variant.  The headers used with entity
592   tags are described in Sections 7.2 and 7.4 of this document, and in
593   Section 6.3 of [Part5].  The entity tag MAY be used for comparison
594   with other entities from the same resource (see Section 5).
595
596     ETag = "ETag" ":" entity-tag
597
598   Examples:
599
600      ETag: "xyzzy"
601      ETag: W/"xyzzy"
602      ETag: ""
603
604   The ETag response-header field value, an entity tag, provides for an
605   "opaque" cache validator.  This might allow more reliable validation
606   in situations where it is inconvenient to store modification dates,
607   where the one-second resolution of HTTP date values is not
608   sufficient, or where the origin server wishes to avoid certain
609   paradoxes that might arise from the use of modification dates.
610
611   The principle behind entity tags is that only the service author
612
613
614
615Fielding, et al.          Expires March 2, 2009                [Page 11]
616
617Internet-Draft              HTTP/1.1, Part 4                 August 2008
618
619
620   knows the semantics of a resource well enough to select an
621   appropriate cache validation mechanism, and the specification of any
622   validator comparison function more complex than byte-equality would
623   open up a can of worms.  Thus, comparisons of any other headers
624   (except Last-Modified, for compatibility with HTTP/1.0) are never
625   used for purposes of validating a cache entry.
626
6277.2.  If-Match
628
629   The If-Match request-header field is used with a method to make it
630   conditional.  A client that has one or more entities previously
631   obtained from the resource can verify that one of those entities is
632   current by including a list of their associated entity tags in the
633   If-Match header field.  Entity tags are defined in Section 3.  The
634   purpose of this feature is to allow efficient updates of cached
635   information with a minimum amount of transaction overhead.  It is
636   also used, on updating requests, to prevent inadvertent modification
637   of the wrong version of a resource.  As a special case, the value "*"
638   matches any current entity of the resource.
639
640     If-Match = "If-Match" ":" ( "*" | 1#entity-tag )
641
642   If any of the entity tags match the entity tag of the entity that
643   would have been returned in the response to a similar GET request
644   (without the If-Match header) on that resource, or if "*" is given
645   and any current entity exists for that resource, then the server MAY
646   perform the requested method as if the If-Match header field did not
647   exist.
648
649   A server MUST use the strong comparison function (see Section 5) to
650   compare the entity tags in If-Match.
651
652   If none of the entity tags match, or if "*" is given and no current
653   entity exists, the server MUST NOT perform the requested method, and
654   MUST return a 412 (Precondition Failed) response.  This behavior is
655   most useful when the client wants to prevent an updating method, such
656   as PUT, from modifying a resource that has changed since the client
657   last retrieved it.
658
659   If the request would, without the If-Match header field, result in
660   anything other than a 2xx or 412 status, then the If-Match header
661   MUST be ignored.
662
663   The meaning of "If-Match: *" is that the method SHOULD be performed
664   if the representation selected by the origin server (or by a cache,
665   possibly using the Vary mechanism, see Section 16.5 of [Part6])
666   exists, and MUST NOT be performed if the representation does not
667   exist.
668
669
670
671Fielding, et al.          Expires March 2, 2009                [Page 12]
672
673Internet-Draft              HTTP/1.1, Part 4                 August 2008
674
675
676   A request intended to update a resource (e.g., a PUT) MAY include an
677   If-Match header field to signal that the request method MUST NOT be
678   applied if the entity corresponding to the If-Match value (a single
679   entity tag) is no longer a representation of that resource.  This
680   allows the user to indicate that they do not wish the request to be
681   successful if the resource has been changed without their knowledge.
682   Examples:
683
684       If-Match: "xyzzy"
685       If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
686       If-Match: *
687
688   The result of a request having both an If-Match header field and
689   either an If-None-Match or an If-Modified-Since header fields is
690   undefined by this specification.
691
6927.3.  If-Modified-Since
693
694   The If-Modified-Since request-header field is used with a method to
695   make it conditional: if the requested variant has not been modified
696   since the time specified in this field, an entity will not be
697   returned from the server; instead, a 304 (Not Modified) response will
698   be returned without any message-body.
699
700     If-Modified-Since = "If-Modified-Since" ":" HTTP-date
701
702   An example of the field is:
703
704       If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
705
706   A GET method with an If-Modified-Since header and no Range header
707   requests that the identified entity be transferred only if it has
708   been modified since the date given by the If-Modified-Since header.
709   The algorithm for determining this includes the following cases:
710
711   1.  If the request would normally result in anything other than a 200
712       (OK) status, or if the passed If-Modified-Since date is invalid,
713       the response is exactly the same as for a normal GET.  A date
714       which is later than the server's current time is invalid.
715
716   2.  If the variant has been modified since the If-Modified-Since
717       date, the response is exactly the same as for a normal GET.
718
719   3.  If the variant has not been modified since a valid If-Modified-
720       Since date, the server SHOULD return a 304 (Not Modified)
721       response.
722
723   The purpose of this feature is to allow efficient updates of cached
724
725
726
727Fielding, et al.          Expires March 2, 2009                [Page 13]
728
729Internet-Draft              HTTP/1.1, Part 4                 August 2008
730
731
732   information with a minimum amount of transaction overhead.
733
734      Note: The Range request-header field modifies the meaning of If-
735      Modified-Since; see Section 6.4 of [Part5] for full details.
736
737      Note: If-Modified-Since times are interpreted by the server, whose
738      clock might not be synchronized with the client.
739
740      Note: When handling an If-Modified-Since header field, some
741      servers will use an exact date comparison function, rather than a
742      less-than function, for deciding whether to send a 304 (Not
743      Modified) response.  To get best results when sending an If-
744      Modified-Since header field for cache validation, clients are
745      advised to use the exact date string received in a previous Last-
746      Modified header field whenever possible.
747
748      Note: If a client uses an arbitrary date in the If-Modified-Since
749      header instead of a date taken from the Last-Modified header for
750      the same request, the client should be aware of the fact that this
751      date is interpreted in the server's understanding of time.  The
752      client should consider unsynchronized clocks and rounding problems
753      due to the different encodings of time between the client and
754      server.  This includes the possibility of race conditions if the
755      document has changed between the time it was first requested and
756      the If-Modified-Since date of a subsequent request, and the
757      possibility of clock-skew-related problems if the If-Modified-
758      Since date is derived from the client's clock without correction
759      to the server's clock.  Corrections for different time bases
760      between client and server are at best approximate due to network
761      latency.
762
763   The result of a request having both an If-Modified-Since header field
764   and either an If-Match or an If-Unmodified-Since header fields is
765   undefined by this specification.
766
7677.4.  If-None-Match
768
769   The If-None-Match request-header field is used with a method to make
770   it conditional.  A client that has one or more entities previously
771   obtained from the resource can verify that none of those entities is
772   current by including a list of their associated entity tags in the
773   If-None-Match header field.  The purpose of this feature is to allow
774   efficient updates of cached information with a minimum amount of
775   transaction overhead.  It is also used to prevent a method (e.g.
776   PUT) from inadvertently modifying an existing resource when the
777   client believes that the resource does not exist.
778
779   As a special case, the value "*" matches any current entity of the
780
781
782
783Fielding, et al.          Expires March 2, 2009                [Page 14]
784
785Internet-Draft              HTTP/1.1, Part 4                 August 2008
786
787
788   resource.
789
790     If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )
791
792   If any of the entity tags match the entity tag of the entity that
793   would have been returned in the response to a similar GET request
794   (without the If-None-Match header) on that resource, or if "*" is
795   given and any current entity exists for that resource, then the
796   server MUST NOT perform the requested method, unless required to do
797   so because the resource's modification date fails to match that
798   supplied in an If-Modified-Since header field in the request.
799   Instead, if the request method was GET or HEAD, the server SHOULD
800   respond with a 304 (Not Modified) response, including the cache-
801   related header fields (particularly ETag) of one of the entities that
802   matched.  For all other request methods, the server MUST respond with
803   a status of 412 (Precondition Failed).
804
805   See Section 5 for rules on how to determine if two entity tags match.
806
807   If none of the entity tags match, then the server MAY perform the
808   requested method as if the If-None-Match header field did not exist,
809   but MUST also ignore any If-Modified-Since header field(s) in the
810   request.  That is, if no entity tags match, then the server MUST NOT
811   return a 304 (Not Modified) response.
812
813   If the request would, without the If-None-Match header field, result
814   in anything other than a 2xx or 304 status, then the If-None-Match
815   header MUST be ignored.  (See Section 6 for a discussion of server
816   behavior when both If-Modified-Since and If-None-Match appear in the
817   same request.)
818
819   The meaning of "If-None-Match: *" is that the method MUST NOT be
820   performed if the representation selected by the origin server (or by
821   a cache, possibly using the Vary mechanism, see Section 16.5 of
822   [Part6]) exists, and SHOULD be performed if the representation does
823   not exist.  This feature is intended to be useful in preventing races
824   between PUT operations.
825
826   Examples:
827
828       If-None-Match: "xyzzy"
829       If-None-Match: W/"xyzzy"
830       If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
831       If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
832       If-None-Match: *
833
834   The result of a request having both an If-None-Match header field and
835   either an If-Match or an If-Unmodified-Since header fields is
836
837
838
839Fielding, et al.          Expires March 2, 2009                [Page 15]
840
841Internet-Draft              HTTP/1.1, Part 4                 August 2008
842
843
844   undefined by this specification.
845
8467.5.  If-Unmodified-Since
847
848   The If-Unmodified-Since request-header field is used with a method to
849   make it conditional.  If the requested resource has not been modified
850   since the time specified in this field, the server SHOULD perform the
851   requested operation as if the If-Unmodified-Since header were not
852   present.
853
854   If the requested variant has been modified since the specified time,
855   the server MUST NOT perform the requested operation, and MUST return
856   a 412 (Precondition Failed).
857
858     If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
859
860   An example of the field is:
861
862       If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
863
864   If the request normally (i.e., without the If-Unmodified-Since
865   header) would result in anything other than a 2xx or 412 status, the
866   If-Unmodified-Since header SHOULD be ignored.
867
868   If the specified date is invalid, the header is ignored.
869
870   The result of a request having both an If-Unmodified-Since header
871   field and either an If-None-Match or an If-Modified-Since header
872   fields is undefined by this specification.
873
8747.6.  Last-Modified
875
876   The Last-Modified entity-header field indicates the date and time at
877   which the origin server believes the variant was last modified.
878
879     Last-Modified  = "Last-Modified" ":" HTTP-date
880
881   An example of its use is
882
883       Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
884
885   The exact meaning of this header field depends on the implementation
886   of the origin server and the nature of the original resource.  For
887   files, it may be just the file system last-modified time.  For
888   entities with dynamically included parts, it may be the most recent
889   of the set of last-modify times for its component parts.  For
890   database gateways, it may be the last-update time stamp of the
891   record.  For virtual objects, it may be the last time the internal
892
893
894
895Fielding, et al.          Expires March 2, 2009                [Page 16]
896
897Internet-Draft              HTTP/1.1, Part 4                 August 2008
898
899
900   state changed.
901
902   An origin server MUST NOT send a Last-Modified date which is later
903   than the server's time of message origination.  In such cases, where
904   the resource's last modification would indicate some time in the
905   future, the server MUST replace that date with the message
906   origination date.
907
908   An origin server SHOULD obtain the Last-Modified value of the entity
909   as close as possible to the time that it generates the Date value of
910   its response.  This allows a recipient to make an accurate assessment
911   of the entity's modification time, especially if the entity changes
912   near the time that the response is generated.
913
914   HTTP/1.1 servers SHOULD send Last-Modified whenever feasible.
915
916   The Last-Modified entity-header field value is often used as a cache
917   validator.  In simple terms, a cache entry is considered to be valid
918   if the entity has not been modified since the Last-Modified value.
919
920
9218.  IANA Considerations
922
9238.1.  Message Header Registration
924
925   The Message Header Registry located at <http://www.iana.org/
926   assignments/message-headers/message-header-index.html> should be
927   updated with the permanent registrations below (see [RFC3864]):
928
929   +---------------------+----------+----------+-------------+
930   | Header Field Name   | Protocol | Status   | Reference   |
931   +---------------------+----------+----------+-------------+
932   | ETag                | http     | standard | Section 7.1 |
933   | If-Match            | http     | standard | Section 7.2 |
934   | If-Modified-Since   | http     | standard | Section 7.3 |
935   | If-None-Match       | http     | standard | Section 7.4 |
936   | If-Unmodified-Since | http     | standard | Section 7.5 |
937   | Last-Modified       | http     | standard | Section 7.6 |
938   +---------------------+----------+----------+-------------+
939
940   The change controller is: "IETF (iesg@ietf.org) - Internet
941   Engineering Task Force".
942
943
9449.  Security Considerations
945
946   No additional security considerations have been identified beyond
947   those applicable to HTTP in general [Part1].
948
949
950
951Fielding, et al.          Expires March 2, 2009                [Page 17]
952
953Internet-Draft              HTTP/1.1, Part 4                 August 2008
954
955
95610.  Acknowledgments
957
958
95911.  References
960
96111.1.  Normative References
962
963   [Part1]    Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
964              Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
965              and J. Reschke, Ed., "HTTP/1.1, part 1: URIs, Connections,
966              and Message Parsing", draft-ietf-httpbis-p1-messaging-04
967              (work in progress), August 2008.
968
969   [Part5]    Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
970              Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
971              and J. Reschke, Ed., "HTTP/1.1, part 5: Range Requests and
972              Partial Responses", draft-ietf-httpbis-p5-range-04 (work
973              in progress), August 2008.
974
975   [Part6]    Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
976              Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
977              and J. Reschke, Ed., "HTTP/1.1, part 6: Caching",
978              draft-ietf-httpbis-p6-cache-04 (work in progress),
979              August 2008.
980
981   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
982              Requirement Levels", BCP 14, RFC 2119, March 1997.
983
98411.2.  Informative References
985
986   [RFC2616]  Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
987              Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
988              Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
989
990   [RFC3864]  Klyne, G., Nottingham, M., and J. Mogul, "Registration
991              Procedures for Message Header Fields", BCP 90, RFC 3864,
992              September 2004.
993
994
995Appendix A.  Compatibility with Previous Versions
996
997A.1.  Changes from RFC 2616
998
999   Allow weak entity tags in all requests except range requests
1000   (Sections 5 and 7.4).
1001
1002
1003
1004
1005
1006
1007Fielding, et al.          Expires March 2, 2009                [Page 18]
1008
1009Internet-Draft              HTTP/1.1, Part 4                 August 2008
1010
1011
1012Appendix B.  Change Log (to be removed by RFC Editor before publication)
1013
1014B.1.  Since RFC2616
1015
1016   Extracted relevant partitions from [RFC2616].
1017
1018B.2.  Since draft-ietf-httpbis-p4-conditional-00
1019
1020   Closed issues:
1021
1022   o  <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/35>: "Normative
1023      and Informative references"
1024
1025   Other changes:
1026
1027   o  Move definitions of 304 and 412 condition codes from Part2.
1028
1029B.3.  Since draft-ietf-httpbis-p4-conditional-01
1030
1031   Ongoing work on ABNF conversion
1032   (<http://www3.tools.ietf.org/wg/httpbis/trac/ticket/36>):
1033
1034   o  Add explicit references to BNF syntax and rules imported from
1035      other parts of the specification.
1036
1037B.4.  Since draft-ietf-httpbis-p4-conditional-02
1038
1039   Closed issues:
1040
1041   o  <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/116>: "Weak
1042      ETags on non-GET requests"
1043
1044   Ongoing work on IANA Message Header Registration
1045   (<http://www3.tools.ietf.org/wg/httpbis/trac/ticket/40>):
1046
1047   o  Reference RFC 3984, and update header registrations for headers
1048      defined in this document.
1049
1050B.5.  Since draft-ietf-httpbis-p4-conditional-03
1051
1052   Closed issues:
1053
1054   o  <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/71>: "Examples
1055      for ETag matching"
1056
1057   o  <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/124>: "'entity
1058      value' undefined"
1059
1060
1061
1062
1063Fielding, et al.          Expires March 2, 2009                [Page 19]
1064
1065Internet-Draft              HTTP/1.1, Part 4                 August 2008
1066
1067
1068   o  <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/126>: "bogus
1069      2068 Date header reference"
1070
1071
1072Index
1073
1074   3
1075      304 Not Modified (status code)  5
1076
1077   4
1078      412 Precondition Failed (status code)  6
1079
1080   E
1081      ETag header  11
1082
1083   G
1084      Grammar
1085         entity-tag  5
1086         ETag  11
1087         If-Match  12
1088         If-Modified-Since  13
1089         If-None-Match  15
1090         If-Unmodified-Since  16
1091         Last-Modified  16
1092         opaque-tag  5
1093         weak  5
1094
1095   H
1096      Headers
1097         ETag  11
1098         If-Match  12
1099         If-Modified-Since  13
1100         If-None-Match  14
1101         If-Unmodified-Since  16
1102         Last-Modified  16
1103
1104   I
1105      If-Match header  12
1106      If-Modified-Since header  13
1107      If-None-Match header  14
1108      If-Unmodified-Since header  16
1109
1110   L
1111      Last-Modified header  16
1112
1113   S
1114      Status Codes
1115         304 Not Modified  5
1116
1117
1118
1119Fielding, et al.          Expires March 2, 2009                [Page 20]
1120
1121Internet-Draft              HTTP/1.1, Part 4                 August 2008
1122
1123
1124         412 Precondition Failed  6
1125
1126
1127Authors' Addresses
1128
1129   Roy T. Fielding (editor)
1130   Day Software
1131   23 Corporate Plaza DR, Suite 280
1132   Newport Beach, CA  92660
1133   USA
1134
1135   Phone: +1-949-706-5300
1136   Fax:   +1-949-706-5305
1137   Email: fielding@gbiv.com
1138   URI:   http://roy.gbiv.com/
1139
1140
1141   Jim Gettys
1142   One Laptop per Child
1143   21 Oak Knoll Road
1144   Carlisle, MA  01741
1145   USA
1146
1147   Email: jg@laptop.org
1148   URI:   http://www.laptop.org/
1149
1150
1151   Jeffrey C. Mogul
1152   Hewlett-Packard Company
1153   HP Labs, Large Scale Systems Group
1154   1501 Page Mill Road, MS 1177
1155   Palo Alto, CA  94304
1156   USA
1157
1158   Email: JeffMogul@acm.org
1159
1160
1161   Henrik Frystyk Nielsen
1162   Microsoft Corporation
1163   1 Microsoft Way
1164   Redmond, WA  98052
1165   USA
1166
1167   Email: henrikn@microsoft.com
1168
1169
1170
1171
1172
1173
1174
1175Fielding, et al.          Expires March 2, 2009                [Page 21]
1176
1177Internet-Draft              HTTP/1.1, Part 4                 August 2008
1178
1179
1180   Larry Masinter
1181   Adobe Systems, Incorporated
1182   345 Park Ave
1183   San Jose, CA  95110
1184   USA
1185
1186   Email: LMM@acm.org
1187   URI:   http://larry.masinter.net/
1188
1189
1190   Paul J. Leach
1191   Microsoft Corporation
1192   1 Microsoft Way
1193   Redmond, WA  98052
1194
1195   Email: paulle@microsoft.com
1196
1197
1198   Tim Berners-Lee
1199   World Wide Web Consortium
1200   MIT Computer Science and Artificial Intelligence Laboratory
1201   The Stata Center, Building 32
1202   32 Vassar Street
1203   Cambridge, MA  02139
1204   USA
1205
1206   Email: timbl@w3.org
1207   URI:   http://www.w3.org/People/Berners-Lee/
1208
1209
1210   Yves Lafon (editor)
1211   World Wide Web Consortium
1212   W3C / ERCIM
1213   2004, rte des Lucioles
1214   Sophia-Antipolis, AM  06902
1215   France
1216
1217   Email: ylafon@w3.org
1218   URI:   http://www.raubacapeu.net/people/yves/
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231Fielding, et al.          Expires March 2, 2009                [Page 22]
1232
1233Internet-Draft              HTTP/1.1, Part 4                 August 2008
1234
1235
1236   Julian F. Reschke (editor)
1237   greenbytes GmbH
1238   Hafenweg 16
1239   Muenster, NW  48155
1240   Germany
1241
1242   Phone: +49 251 2807760
1243   Fax:   +49 251 2807761
1244   Email: julian.reschke@greenbytes.de
1245   URI:   http://greenbytes.de/tech/webdav/
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287Fielding, et al.          Expires March 2, 2009                [Page 23]
1288
1289Internet-Draft              HTTP/1.1, Part 4                 August 2008
1290
1291
1292Full Copyright Statement
1293
1294   Copyright (C) The IETF Trust (2008).
1295
1296   This document is subject to the rights, licenses and restrictions
1297   contained in BCP 78, and except as set forth therein, the authors
1298   retain all their rights.
1299
1300   This document and the information contained herein are provided on an
1301   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
1302   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
1303   THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
1304   OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
1305   THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
1306   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
1307
1308
1309Intellectual Property
1310
1311   The IETF takes no position regarding the validity or scope of any
1312   Intellectual Property Rights or other rights that might be claimed to
1313   pertain to the implementation or use of the technology described in
1314   this document or the extent to which any license under such rights
1315   might or might not be available; nor does it represent that it has
1316   made any independent effort to identify any such rights.  Information
1317   on the procedures with respect to rights in RFC documents can be
1318   found in BCP 78 and BCP 79.
1319
1320   Copies of IPR disclosures made to the IETF Secretariat and any
1321   assurances of licenses to be made available, or the result of an
1322   attempt made to obtain a general license or permission for the use of
1323   such proprietary rights by implementers or users of this
1324   specification can be obtained from the IETF on-line IPR repository at
1325   http://www.ietf.org/ipr.
1326
1327   The IETF invites any interested party to bring to its attention any
1328   copyrights, patents or patent applications, or other proprietary
1329   rights that may cover technology that may be required to implement
1330   this standard.  Please address the information to the IETF at
1331   ietf-ipr@ietf.org.
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343Fielding, et al.          Expires March 2, 2009                [Page 24]
1344
Note: See TracBrowser for help on using the repository browser.