source: draft-ietf-httpbis/03/draft-ietf-httpbis-p4-conditional-03.txt @ 301

Last change on this file since 301 was 264, checked in by julian.reschke@…, 15 years ago

Prepare for release of draft 03 on Tuesday, 2008-06-17.

  • Property svn:executable set to *
File size: 47.7 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: December 19, 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                                                           June 17, 2008
23
24
25                 HTTP/1.1, part 4: Conditional Requests
26                  draft-ietf-httpbis-p4-conditional-03
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 December 19, 2008.
52
53
54
55Fielding, et al.        Expires December 19, 2008               [Page 1]
56
57Internet-Draft              HTTP/1.1, Part 4                   June 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 December 19, 2008               [Page 2]
112
113Internet-Draft              HTTP/1.1, Part 4                   June 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 . . . . . . . . . . . . . . . . . . . . . . . . . 11
130     7.3.  If-Modified-Since  . . . . . . . . . . . . . . . . . . . . 13
131     7.4.  If-None-Match  . . . . . . . . . . . . . . . . . . . . . . 14
132     7.5.  If-Unmodified-Since  . . . . . . . . . . . . . . . . . . . 15
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  . . . . . . . . . . . . . . . . . . . . . . . 17
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   Index  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
150   Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 20
151   Intellectual Property and Copyright Statements . . . . . . . . . . 24
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167Fielding, et al.        Expires December 19, 2008               [Page 3]
168
169Internet-Draft              HTTP/1.1, Part 4                   June 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 December 19, 2008               [Page 4]
224
225Internet-Draft              HTTP/1.1, Part 4                   June 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 December 19, 2008               [Page 5]
280
281Internet-Draft              HTTP/1.1, Part 4                   June 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 December 19, 2008               [Page 6]
336
337Internet-Draft              HTTP/1.1, Part 4                   June 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 validators MUST be identical in every way, and both MUST NOT
384      be weak.
385
386   o  The weak comparison function: in order to be considered equal,
387      both validators MUST be identical in every way, but either or both
388
389
390
391Fielding, et al.        Expires December 19, 2008               [Page 7]
392
393Internet-Draft              HTTP/1.1, Part 4                   June 2008
394
395
396      of them MAY be tagged as "weak" without affecting the result.
397
398   An entity tag is strong unless it is explicitly tagged as weak.
399   Section 3 gives the syntax for entity tags.
400
401   A Last-Modified time, when used as a validator in a request, is
402   implicitly weak unless it is possible to deduce that it is strong,
403   using the following rules:
404
405   o  The validator is being compared by an origin server to the actual
406      current validator for the entity and,
407
408   o  That origin server reliably knows that the associated entity did
409      not change twice during the second covered by the presented
410      validator.
411
412   or
413
414   o  The validator is about to be used by a client in an If-Modified-
415      Since or If-Unmodified-Since header, because the client has a
416      cache entry for the associated entity, and
417
418   o  That cache entry includes a Date value, which gives the time when
419      the origin server sent the original response, and
420
421   o  The presented Last-Modified time is at least 60 seconds before the
422      Date value.
423
424   or
425
426   o  The validator is being compared by an intermediate cache to the
427      validator stored in its cache entry for the entity, and
428
429   o  That cache entry includes a Date value, which gives the time when
430      the origin server sent the original response, and
431
432   o  The presented Last-Modified time is at least 60 seconds before the
433      Date value.
434
435   This method relies on the fact that if two different responses were
436   sent by the origin server during the same second, but both had the
437   same Last-Modified time, then at least one of those responses would
438   have a Date value equal to its Last-Modified time.  The arbitrary 60-
439   second limit guards against the possibility that the Date and Last-
440   Modified values are generated from different clocks, or at somewhat
441   different times during the preparation of the response.  An
442   implementation MAY use a value larger than 60 seconds, if it is
443   believed that 60 seconds is too short.
444
445
446
447Fielding, et al.        Expires December 19, 2008               [Page 8]
448
449Internet-Draft              HTTP/1.1, Part 4                   June 2008
450
451
452   If a client wishes to perform a sub-range retrieval on a value for
453   which it has only a Last-Modified time and no opaque validator, it
454   MAY do this only if the Last-Modified time is strong in the sense
455   described here.
456
457   A cache or origin server receiving a conditional range request
458   ([Part5]) MUST use the strong comparison function to evaluate the
459   condition.
460
461   These rules allow HTTP/1.1 caches and clients to safely perform sub-
462   range retrievals on values that have been obtained from HTTP/1.0
463   servers.
464
465
4666.  Rules for When to Use Entity Tags and Last-Modified Dates
467
468   We adopt a set of rules and recommendations for origin servers,
469   clients, and caches regarding when various validator types ought to
470   be used, and for what purposes.
471
472   HTTP/1.1 origin servers:
473
474   o  SHOULD send an entity tag validator unless it is not feasible to
475      generate one.
476
477   o  MAY send a weak entity tag instead of a strong entity tag, if
478      performance considerations support the use of weak entity tags, or
479      if it is unfeasible to send a strong entity tag.
480
481   o  SHOULD send a Last-Modified value if it is feasible to send one,
482      unless the risk of a breakdown in semantic transparency that could
483      result from using this date in an If-Modified-Since header would
484      lead to serious problems.
485
486   In other words, the preferred behavior for an HTTP/1.1 origin server
487   is to send both a strong entity tag and a Last-Modified value.
488
489   In order to be legal, a strong entity tag MUST change whenever the
490   associated entity value changes in any way.  A weak entity tag SHOULD
491   change whenever the associated entity changes in a semantically
492   significant way.
493
494      Note: in order to provide semantically transparent caching, an
495      origin server must avoid reusing a specific strong entity tag
496      value for two different entities, or reusing a specific weak
497      entity tag value for two semantically different entities.  Cache
498      entries might persist for arbitrarily long periods, regardless of
499      expiration times, so it might be inappropriate to expect that a
500
501
502
503Fielding, et al.        Expires December 19, 2008               [Page 9]
504
505Internet-Draft              HTTP/1.1, Part 4                   June 2008
506
507
508      cache will never again attempt to validate an entry using a
509      validator that it obtained at some point in the past.
510
511   HTTP/1.1 clients:
512
513   o  If an entity tag has been provided by the origin server, MUST use
514      that entity tag in any cache-conditional request (using If-Match
515      or If-None-Match).
516
517   o  If only a Last-Modified value has been provided by the origin
518      server, SHOULD use that value in non-subrange cache-conditional
519      requests (using If-Modified-Since).
520
521   o  If only a Last-Modified value has been provided by an HTTP/1.0
522      origin server, MAY use that value in subrange cache-conditional
523      requests (using If-Unmodified-Since:).  The user agent SHOULD
524      provide a way to disable this, in case of difficulty.
525
526   o  If both an entity tag and a Last-Modified value have been provided
527      by the origin server, SHOULD use both validators in cache-
528      conditional requests.  This allows both HTTP/1.0 and HTTP/1.1
529      caches to respond appropriately.
530
531   An HTTP/1.1 origin server, upon receiving a conditional request that
532   includes both a Last-Modified date (e.g., in an If-Modified-Since or
533   If-Unmodified-Since header field) and one or more entity tags (e.g.,
534   in an If-Match, If-None-Match, or If-Range header field) as cache
535   validators, MUST NOT return a response status of 304 (Not Modified)
536   unless doing so is consistent with all of the conditional header
537   fields in the request.
538
539   An HTTP/1.1 caching proxy, upon receiving a conditional request that
540   includes both a Last-Modified date and one or more entity tags as
541   cache validators, MUST NOT return a locally cached response to the
542   client unless that cached response is consistent with all of the
543   conditional header fields in the request.
544
545      Note: The general principle behind these rules is that HTTP/1.1
546      servers and clients should transmit as much non-redundant
547      information as is available in their responses and requests.
548      HTTP/1.1 systems receiving this information will make the most
549      conservative assumptions about the validators they receive.
550
551      HTTP/1.0 clients and caches will ignore entity tags.  Generally,
552      last-modified values received or used by these systems will
553      support transparent and efficient caching, and so HTTP/1.1 origin
554      servers should provide Last-Modified values.  In those rare cases
555      where the use of a Last-Modified value as a validator by an
556
557
558
559Fielding, et al.        Expires December 19, 2008              [Page 10]
560
561Internet-Draft              HTTP/1.1, Part 4                   June 2008
562
563
564      HTTP/1.0 system could result in a serious problem, then HTTP/1.1
565      origin servers should not provide one.
566
567
5687.  Header Field Definitions
569
570   This section defines the syntax and semantics of HTTP/1.1 header
571   fields related to conditional requests.
572
573   For entity-header fields, both sender and recipient refer to either
574   the client or the server, depending on who sends and who receives the
575   entity.
576
5777.1.  ETag
578
579   The ETag response-header field provides the current value of the
580   entity tag for the requested variant.  The headers used with entity
581   tags are described in Sections 7.2 and 7.4 of this document, and in
582   Section 6.3 of [Part5].  The entity tag MAY be used for comparison
583   with other entities from the same resource (see Section 5).
584
585     ETag = "ETag" ":" entity-tag
586
587   Examples:
588
589      ETag: "xyzzy"
590      ETag: W/"xyzzy"
591      ETag: ""
592
593   The ETag response-header field value, an entity tag, provides for an
594   "opaque" cache validator.  This might allow more reliable validation
595   in situations where it is inconvenient to store modification dates,
596   where the one-second resolution of HTTP date values is not
597   sufficient, or where the origin server wishes to avoid certain
598   paradoxes that might arise from the use of modification dates.
599
600   The principle behind entity tags is that only the service author
601   knows the semantics of a resource well enough to select an
602   appropriate cache validation mechanism, and the specification of any
603   validator comparison function more complex than byte-equality would
604   open up a can of worms.  Thus, comparisons of any other headers
605   (except Last-Modified, for compatibility with HTTP/1.0) are never
606   used for purposes of validating a cache entry.
607
6087.2.  If-Match
609
610   The If-Match request-header field is used with a method to make it
611   conditional.  A client that has one or more entities previously
612
613
614
615Fielding, et al.        Expires December 19, 2008              [Page 11]
616
617Internet-Draft              HTTP/1.1, Part 4                   June 2008
618
619
620   obtained from the resource can verify that one of those entities is
621   current by including a list of their associated entity tags in the
622   If-Match header field.  Entity tags are defined in Section 3.  The
623   purpose of this feature is to allow efficient updates of cached
624   information with a minimum amount of transaction overhead.  It is
625   also used, on updating requests, to prevent inadvertent modification
626   of the wrong version of a resource.  As a special case, the value "*"
627   matches any current entity of the resource.
628
629     If-Match = "If-Match" ":" ( "*" | 1#entity-tag )
630
631   If any of the entity tags match the entity tag of the entity that
632   would have been returned in the response to a similar GET request
633   (without the If-Match header) on that resource, or if "*" is given
634   and any current entity exists for that resource, then the server MAY
635   perform the requested method as if the If-Match header field did not
636   exist.
637
638   A server MUST use the strong comparison function (see Section 5) to
639   compare the entity tags in If-Match.
640
641   If none of the entity tags match, or if "*" is given and no current
642   entity exists, the server MUST NOT perform the requested method, and
643   MUST return a 412 (Precondition Failed) response.  This behavior is
644   most useful when the client wants to prevent an updating method, such
645   as PUT, from modifying a resource that has changed since the client
646   last retrieved it.
647
648   If the request would, without the If-Match header field, result in
649   anything other than a 2xx or 412 status, then the If-Match header
650   MUST be ignored.
651
652   The meaning of "If-Match: *" is that the method SHOULD be performed
653   if the representation selected by the origin server (or by a cache,
654   possibly using the Vary mechanism, see Section 16.5 of [Part6])
655   exists, and MUST NOT be performed if the representation does not
656   exist.
657
658   A request intended to update a resource (e.g., a PUT) MAY include an
659   If-Match header field to signal that the request method MUST NOT be
660   applied if the entity corresponding to the If-Match value (a single
661   entity tag) is no longer a representation of that resource.  This
662   allows the user to indicate that they do not wish the request to be
663   successful if the resource has been changed without their knowledge.
664   Examples:
665
666       If-Match: "xyzzy"
667       If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
668
669
670
671Fielding, et al.        Expires December 19, 2008              [Page 12]
672
673Internet-Draft              HTTP/1.1, Part 4                   June 2008
674
675
676       If-Match: *
677
678   The result of a request having both an If-Match header field and
679   either an If-None-Match or an If-Modified-Since header fields is
680   undefined by this specification.
681
6827.3.  If-Modified-Since
683
684   The If-Modified-Since request-header field is used with a method to
685   make it conditional: if the requested variant has not been modified
686   since the time specified in this field, an entity will not be
687   returned from the server; instead, a 304 (Not Modified) response will
688   be returned without any message-body.
689
690     If-Modified-Since = "If-Modified-Since" ":" HTTP-date
691
692   An example of the field is:
693
694       If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
695
696   A GET method with an If-Modified-Since header and no Range header
697   requests that the identified entity be transferred only if it has
698   been modified since the date given by the If-Modified-Since header.
699   The algorithm for determining this includes the following cases:
700
701   1.  If the request would normally result in anything other than a 200
702       (OK) status, or if the passed If-Modified-Since date is invalid,
703       the response is exactly the same as for a normal GET.  A date
704       which is later than the server's current time is invalid.
705
706   2.  If the variant has been modified since the If-Modified-Since
707       date, the response is exactly the same as for a normal GET.
708
709   3.  If the variant has not been modified since a valid If-Modified-
710       Since date, the server SHOULD return a 304 (Not Modified)
711       response.
712
713   The purpose of this feature is to allow efficient updates of cached
714   information with a minimum amount of transaction overhead.
715
716      Note: The Range request-header field modifies the meaning of If-
717      Modified-Since; see Section 6.4 of [Part5] for full details.
718
719      Note: If-Modified-Since times are interpreted by the server, whose
720      clock might not be synchronized with the client.
721
722      Note: When handling an If-Modified-Since header field, some
723      servers will use an exact date comparison function, rather than a
724
725
726
727Fielding, et al.        Expires December 19, 2008              [Page 13]
728
729Internet-Draft              HTTP/1.1, Part 4                   June 2008
730
731
732      less-than function, for deciding whether to send a 304 (Not
733      Modified) response.  To get best results when sending an If-
734      Modified-Since header field for cache validation, clients are
735      advised to use the exact date string received in a previous Last-
736      Modified header field whenever possible.
737
738      Note: If a client uses an arbitrary date in the If-Modified-Since
739      header instead of a date taken from the Last-Modified header for
740      the same request, the client should be aware of the fact that this
741      date is interpreted in the server's understanding of time.  The
742      client should consider unsynchronized clocks and rounding problems
743      due to the different encodings of time between the client and
744      server.  This includes the possibility of race conditions if the
745      document has changed between the time it was first requested and
746      the If-Modified-Since date of a subsequent request, and the
747      possibility of clock-skew-related problems if the If-Modified-
748      Since date is derived from the client's clock without correction
749      to the server's clock.  Corrections for different time bases
750      between client and server are at best approximate due to network
751      latency.
752
753   The result of a request having both an If-Modified-Since header field
754   and either an If-Match or an If-Unmodified-Since header fields is
755   undefined by this specification.
756
7577.4.  If-None-Match
758
759   The If-None-Match request-header field is used with a method to make
760   it conditional.  A client that has one or more entities previously
761   obtained from the resource can verify that none of those entities is
762   current by including a list of their associated entity tags in the
763   If-None-Match header field.  The purpose of this feature is to allow
764   efficient updates of cached information with a minimum amount of
765   transaction overhead.  It is also used to prevent a method (e.g.
766   PUT) from inadvertently modifying an existing resource when the
767   client believes that the resource does not exist.
768
769   As a special case, the value "*" matches any current entity of the
770   resource.
771
772     If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )
773
774   If any of the entity tags match the entity tag of the entity that
775   would have been returned in the response to a similar GET request
776   (without the If-None-Match header) on that resource, or if "*" is
777   given and any current entity exists for that resource, then the
778   server MUST NOT perform the requested method, unless required to do
779   so because the resource's modification date fails to match that
780
781
782
783Fielding, et al.        Expires December 19, 2008              [Page 14]
784
785Internet-Draft              HTTP/1.1, Part 4                   June 2008
786
787
788   supplied in an If-Modified-Since header field in the request.
789   Instead, if the request method was GET or HEAD, the server SHOULD
790   respond with a 304 (Not Modified) response, including the cache-
791   related header fields (particularly ETag) of one of the entities that
792   matched.  For all other request methods, the server MUST respond with
793   a status of 412 (Precondition Failed).
794
795   See Section 5 for rules on how to determine if two entity tags match.
796
797   If none of the entity tags match, then the server MAY perform the
798   requested method as if the If-None-Match header field did not exist,
799   but MUST also ignore any If-Modified-Since header field(s) in the
800   request.  That is, if no entity tags match, then the server MUST NOT
801   return a 304 (Not Modified) response.
802
803   If the request would, without the If-None-Match header field, result
804   in anything other than a 2xx or 304 status, then the If-None-Match
805   header MUST be ignored.  (See Section 6 for a discussion of server
806   behavior when both If-Modified-Since and If-None-Match appear in the
807   same request.)
808
809   The meaning of "If-None-Match: *" is that the method MUST NOT be
810   performed if the representation selected by the origin server (or by
811   a cache, possibly using the Vary mechanism, see Section 16.5 of
812   [Part6]) exists, and SHOULD be performed if the representation does
813   not exist.  This feature is intended to be useful in preventing races
814   between PUT operations.
815
816   Examples:
817
818       If-None-Match: "xyzzy"
819       If-None-Match: W/"xyzzy"
820       If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
821       If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
822       If-None-Match: *
823
824   The result of a request having both an If-None-Match header field and
825   either an If-Match or an If-Unmodified-Since header fields is
826   undefined by this specification.
827
8287.5.  If-Unmodified-Since
829
830   The If-Unmodified-Since request-header field is used with a method to
831   make it conditional.  If the requested resource has not been modified
832   since the time specified in this field, the server SHOULD perform the
833   requested operation as if the If-Unmodified-Since header were not
834   present.
835
836
837
838
839Fielding, et al.        Expires December 19, 2008              [Page 15]
840
841Internet-Draft              HTTP/1.1, Part 4                   June 2008
842
843
844   If the requested variant has been modified since the specified time,
845   the server MUST NOT perform the requested operation, and MUST return
846   a 412 (Precondition Failed).
847
848     If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
849
850   An example of the field is:
851
852       If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
853
854   If the request normally (i.e., without the If-Unmodified-Since
855   header) would result in anything other than a 2xx or 412 status, the
856   If-Unmodified-Since header SHOULD be ignored.
857
858   If the specified date is invalid, the header is ignored.
859
860   The result of a request having both an If-Unmodified-Since header
861   field and either an If-None-Match or an If-Modified-Since header
862   fields is undefined by this specification.
863
8647.6.  Last-Modified
865
866   The Last-Modified entity-header field indicates the date and time at
867   which the origin server believes the variant was last modified.
868
869     Last-Modified  = "Last-Modified" ":" HTTP-date
870
871   An example of its use is
872
873       Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
874
875   The exact meaning of this header field depends on the implementation
876   of the origin server and the nature of the original resource.  For
877   files, it may be just the file system last-modified time.  For
878   entities with dynamically included parts, it may be the most recent
879   of the set of last-modify times for its component parts.  For
880   database gateways, it may be the last-update time stamp of the
881   record.  For virtual objects, it may be the last time the internal
882   state changed.
883
884   An origin server MUST NOT send a Last-Modified date which is later
885   than the server's time of message origination.  In such cases, where
886   the resource's last modification would indicate some time in the
887   future, the server MUST replace that date with the message
888   origination date.
889
890   An origin server SHOULD obtain the Last-Modified value of the entity
891   as close as possible to the time that it generates the Date value of
892
893
894
895Fielding, et al.        Expires December 19, 2008              [Page 16]
896
897Internet-Draft              HTTP/1.1, Part 4                   June 2008
898
899
900   its response.  This allows a recipient to make an accurate assessment
901   of the entity's modification time, especially if the entity changes
902   near the time that the response is generated.
903
904   HTTP/1.1 servers SHOULD send Last-Modified whenever feasible.
905
906   The Last-Modified entity-header field value is often used as a cache
907   validator.  In simple terms, a cache entry is considered to be valid
908   if the entity has not been modified since the Last-Modified value.
909
910
9118.  IANA Considerations
912
9138.1.  Message Header Registration
914
915   The Message Header Registry located at <http://www.iana.org/
916   assignments/message-headers/message-header-index.html> should be
917   updated with the permanent registrations below (see [RFC3864]):
918
919        +---------------------+----------+----------+-------------+
920        | Header Field Name   | Protocol | Status   | Reference   |
921        +---------------------+----------+----------+-------------+
922        | ETag                | http     | standard | Section 7.1 |
923        | If-Match            | http     | standard | Section 7.2 |
924        | If-Modified-Since   | http     | standard | Section 7.3 |
925        | If-None-Match       | http     | standard | Section 7.4 |
926        | If-Unmodified-Since | http     | standard | Section 7.5 |
927        | Last-Modified       | http     | standard | Section 7.6 |
928        +---------------------+----------+----------+-------------+
929
930   The change controller is: "IETF (iesg@ietf.org) - Internet
931   Engineering Task Force".
932
933
9349.  Security Considerations
935
936   No additional security considerations have been identified beyond
937   those applicable to HTTP in general [Part1].
938
939
94010.  Acknowledgments
941
942
94311.  References
944
945
946
947
948
949
950
951Fielding, et al.        Expires December 19, 2008              [Page 17]
952
953Internet-Draft              HTTP/1.1, Part 4                   June 2008
954
955
95611.1.  Normative References
957
958   [Part1]    Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
959              Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
960              and J. Reschke, Ed., "HTTP/1.1, part 1: URIs, Connections,
961              and Message Parsing", draft-ietf-httpbis-p1-messaging-03
962              (work in progress), June 2008.
963
964   [Part5]    Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
965              Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
966              and J. Reschke, Ed., "HTTP/1.1, part 5: Range Requests and
967              Partial Responses", draft-ietf-httpbis-p5-range-03 (work
968              in progress), June 2008.
969
970   [Part6]    Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
971              Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
972              and J. Reschke, Ed., "HTTP/1.1, part 6: Caching",
973              draft-ietf-httpbis-p6-cache-03 (work in progress),
974              June 2008.
975
976   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
977              Requirement Levels", BCP 14, RFC 2119, March 1997.
978
97911.2.  Informative References
980
981   [RFC2068]  Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T.
982              Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1",
983              RFC 2068, January 1997.
984
985   [RFC2616]  Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
986              Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
987              Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
988
989   [RFC3864]  Klyne, G., Nottingham, M., and J. Mogul, "Registration
990              Procedures for Message Header Fields", BCP 90, RFC 3864,
991              September 2004.
992
993
994Appendix A.  Compatibility with Previous Versions
995
996A.1.  Changes from RFC 2616
997
998   Allow weak entity tags in all requests except range requests
999   (Sections 5 and 7.4).
1000
1001
1002
1003
1004
1005
1006
1007Fielding, et al.        Expires December 19, 2008              [Page 18]
1008
1009Internet-Draft              HTTP/1.1, Part 4                   June 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
1050
1051Index
1052
1053   3
1054      304 Not Modified (status code)  5
1055
1056   4
1057      412 Precondition Failed (status code)  6
1058
1059   E
1060
1061
1062
1063Fielding, et al.        Expires December 19, 2008              [Page 19]
1064
1065Internet-Draft              HTTP/1.1, Part 4                   June 2008
1066
1067
1068      ETag header  11
1069
1070   G
1071      Grammar
1072         entity-tag  5
1073         ETag  11
1074         If-Match  12
1075         If-Modified-Since  13
1076         If-None-Match  14
1077         If-Unmodified-Since  16
1078         Last-Modified  16
1079         opaque-tag  5
1080         weak  5
1081
1082   H
1083      Headers
1084         ETag  11
1085         If-Match  11
1086         If-Modified-Since  13
1087         If-None-Match  14
1088         If-Unmodified-Since  15
1089         Last-Modified  16
1090
1091   I
1092      If-Match header  11
1093      If-Modified-Since header  13
1094      If-None-Match header  14
1095      If-Unmodified-Since header  15
1096
1097   L
1098      Last-Modified header  16
1099
1100   S
1101      Status Codes
1102         304 Not Modified  5
1103         412 Precondition Failed  6
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119Fielding, et al.        Expires December 19, 2008              [Page 20]
1120
1121Internet-Draft              HTTP/1.1, Part 4                   June 2008
1122
1123
1124Authors' Addresses
1125
1126   Roy T. Fielding (editor)
1127   Day Software
1128   23 Corporate Plaza DR, Suite 280
1129   Newport Beach, CA  92660
1130   USA
1131
1132   Phone: +1-949-706-5300
1133   Fax:   +1-949-706-5305
1134   Email: fielding@gbiv.com
1135   URI:   http://roy.gbiv.com/
1136
1137
1138   Jim Gettys
1139   One Laptop per Child
1140   21 Oak Knoll Road
1141   Carlisle, MA  01741
1142   USA
1143
1144   Email: jg@laptop.org
1145   URI:   http://www.laptop.org/
1146
1147
1148   Jeffrey C. Mogul
1149   Hewlett-Packard Company
1150   HP Labs, Large Scale Systems Group
1151   1501 Page Mill Road, MS 1177
1152   Palo Alto, CA  94304
1153   USA
1154
1155   Email: JeffMogul@acm.org
1156
1157
1158   Henrik Frystyk Nielsen
1159   Microsoft Corporation
1160   1 Microsoft Way
1161   Redmond, WA  98052
1162   USA
1163
1164   Email: henrikn@microsoft.com
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175Fielding, et al.        Expires December 19, 2008              [Page 21]
1176
1177Internet-Draft              HTTP/1.1, Part 4                   June 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 December 19, 2008              [Page 22]
1232
1233Internet-Draft              HTTP/1.1, Part 4                   June 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 December 19, 2008              [Page 23]
1288
1289Internet-Draft              HTTP/1.1, Part 4                   June 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 December 19, 2008              [Page 24]
1344
Note: See TracBrowser for help on using the repository browser.