source: draft-ietf-httpbis/05/draft-ietf-httpbis-p4-conditional-05.txt @ 381

Last change on this file since 381 was 381, checked in by julian.reschke@…, 11 years ago

Prepare release of draft 05.

File size: 49.2 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: May 20, 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                                                       November 16, 2008
23
24
25                 HTTP/1.1, part 4: Conditional Requests
26                  draft-ietf-httpbis-p4-conditional-05
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 May 20, 2009.
52
53
54
55Fielding, et al.          Expires May 20, 2009                  [Page 1]
56
57Internet-Draft              HTTP/1.1, Part 4               November 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://tools.ietf.org/wg/httpbis/trac/report/11> and related
76   documents (including fancy diffs) can be found at
77   <http://tools.ietf.org/wg/httpbis/>.
78
79   The changes in this draft are summarized in Appendix B.6.
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 May 20, 2009                  [Page 2]
112
113Internet-Draft              HTTP/1.1, Part 4               November 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  . . . . . . . . . . . . . . . . . . . 18
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  . . . . . . . . . . . . . . . . . . 19
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 . . . . . . . . 20
150     B.6.  Since draft-ietf-httpbis-p4-conditional-04 . . . . . . . . 20
151   Index  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
152   Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 21
153   Intellectual Property and Copyright Statements . . . . . . . . . . 24
154
155
156
157
158
159
160
161
162
163
164
165
166
167Fielding, et al.          Expires May 20, 2009                  [Page 3]
168
169Internet-Draft              HTTP/1.1, Part 4               November 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
216     quoted-string = <quoted-string, defined in [Part1], Section 2.2>
217     OWS           = <OWS, defined in [Part1], Section 2.2>
218
219   The ABNF rules below are defined in other parts:
220
221
222
223Fielding, et al.          Expires May 20, 2009                  [Page 4]
224
225Internet-Draft              HTTP/1.1, Part 4               November 2008
226
227
228     HTTP-date     = <HTTP-date, defined in [Part1], Section 3.3.1>
229
230
2313.  Entity Tags
232
233   Entity tags are used for comparing two or more entities from the same
234   requested resource.  HTTP/1.1 uses entity tags in the ETag
235   (Section 7.1), If-Match (Section 7.2), If-None-Match (Section 7.4),
236   and If-Range (Section 6.3 of [Part5]) header fields.  The definition
237   of how they are used and compared as cache validators is in
238   Section 5.  An entity tag consists of an opaque quoted string,
239   possibly prefixed by a weakness indicator.
240
241     entity-tag = [ weak ] opaque-tag
242     weak       = "W/"
243     opaque-tag = quoted-string
244
245   A "strong entity tag" MAY be shared by two entities of a resource
246   only if they are equivalent by octet equality.
247
248   A "weak entity tag," indicated by the "W/" prefix, MAY be shared by
249   two entities of a resource only if the entities are equivalent and
250   could be substituted for each other with no significant change in
251   semantics.  A weak entity tag can only be used for weak comparison.
252
253   An entity tag MUST be unique across all versions of all entities
254   associated with a particular resource.  A given entity tag value MAY
255   be used for entities obtained by requests on different URIs.  The use
256   of the same entity tag value in conjunction with entities obtained by
257   requests on different URIs does not imply the equivalence of those
258   entities.
259
260
2614.  Status Code Definitions
262
2634.1.  304 Not Modified
264
265   If the client has performed a conditional GET request and access is
266   allowed, but the document has not been modified, the server SHOULD
267   respond with this status code.  The 304 response MUST NOT contain a
268   message-body, and thus is always terminated by the first empty line
269   after the header fields.
270
271   The response MUST include the following header fields:
272
273   o  Date, unless its omission is required by Section 8.3.1 of [Part1].
274
275      If a clockless origin server obeys these rules, and proxies and
276
277
278
279Fielding, et al.          Expires May 20, 2009                  [Page 5]
280
281Internet-Draft              HTTP/1.1, Part 4               November 2008
282
283
284      clients add their own Date to any response received without one
285      (as already specified by Section 8.3 of [Part1], caches will
286      operate correctly.
287
288   o  ETag and/or Content-Location, if the header would have been sent
289      in a 200 response to the same request.
290
291   o  Expires, Cache-Control, and/or Vary, if the field-value might
292      differ from that sent in any previous response for the same
293      variant.
294
295   If the conditional GET used a strong cache validator (see Section 5),
296   the response SHOULD NOT include other entity-headers.  Otherwise
297   (i.e., the conditional GET used a weak validator), the response MUST
298   NOT include other entity-headers; this prevents inconsistencies
299   between cached entity-bodies and updated headers.
300
301   If a 304 response indicates an entity not currently cached, then the
302   cache MUST disregard the response and repeat the request without the
303   conditional.
304
305   If a cache uses a received 304 response to update a cache entry, the
306   cache MUST update the entry to reflect any new field values given in
307   the response.
308
3094.2.  412 Precondition Failed
310
311   The precondition given in one or more of the request-header fields
312   evaluated to false when it was tested on the server.  This response
313   code allows the client to place preconditions on the current resource
314   metainformation (header field data) and thus prevent the requested
315   method from being applied to a resource other than the one intended.
316
317
3185.  Weak and Strong Validators
319
320   Since both origin servers and caches will compare two validators to
321   decide if they represent the same or different entities, one normally
322   would expect that if the entity (the entity-body or any entity-
323   headers) changes in any way, then the associated validator would
324   change as well.  If this is true, then we call this validator a
325   "strong validator."
326
327   However, there might be cases when a server prefers to change the
328   validator only on semantically significant changes, and not when
329   insignificant aspects of the entity change.  A validator that does
330   not always change when the resource changes is a "weak validator."
331
332
333
334
335Fielding, et al.          Expires May 20, 2009                  [Page 6]
336
337Internet-Draft              HTTP/1.1, Part 4               November 2008
338
339
340   Entity tags are normally "strong validators," but the protocol
341   provides a mechanism to tag an entity tag as "weak."  One can think
342   of a strong validator as one that changes whenever the bits of an
343   entity changes, while a weak value changes whenever the meaning of an
344   entity changes.  Alternatively, one can think of a strong validator
345   as part of an identifier for a specific entity, while a weak
346   validator is part of an identifier for a set of semantically
347   equivalent entities.
348
349      Note: One example of a strong validator is an integer that is
350      incremented in stable storage every time an entity is changed.
351
352      An entity's modification time, if represented with one-second
353      resolution, could be a weak validator, since it is possible that
354      the resource might be modified twice during a single second.
355
356      Support for weak validators is optional.  However, weak validators
357      allow for more efficient caching of equivalent objects; for
358      example, a hit counter on a site is probably good enough if it is
359      updated every few days or weeks, and any value during that period
360      is likely "good enough" to be equivalent.
361
362   A "use" of a validator is either when a client generates a request
363   and includes the validator in a validating header field, or when a
364   server compares two validators.
365
366   Strong validators are usable in any context.  Weak validators are
367   only usable in contexts that do not depend on exact equality of an
368   entity.  For example, either kind is usable for a conditional GET of
369   a full entity.  However, only a strong validator is usable for a sub-
370   range retrieval, since otherwise the client might end up with an
371   internally inconsistent entity.
372
373   Clients MUST NOT use weak validators in range requests ([Part5]).
374
375   The only function that HTTP/1.1 defines on validators is comparison.
376   There are two validator comparison functions, depending on whether
377   the comparison context allows the use of weak validators or not:
378
379   o  The strong comparison function: in order to be considered equal,
380      both opaque-tags MUST be identical character-by-character, and
381      both MUST NOT be weak.
382
383   o  The weak comparison function: in order to be considered equal,
384      both opaque-tags MUST be identical character-by-character.
385
386   The example below shows the results for a set of entity tag pairs,
387   and both the weak and strong comparison function results:
388
389
390
391Fielding, et al.          Expires May 20, 2009                  [Page 7]
392
393Internet-Draft              HTTP/1.1, Part 4               November 2008
394
395
396   +--------+--------+-------------------+-----------------+
397   | ETag 1 | ETag 2 | Strong Comparison | Weak Comparison |
398   +--------+--------+-------------------+-----------------+
399   | W/"1"  | W/"1"  | no match          | match           |
400   | W/"1"  | W/"2"  | no match          | no match        |
401   | W/"1"  | "1"    | no match          | match           |
402   | "1"    | "1"    | match             | match           |
403   +--------+--------+-------------------+-----------------+
404
405   An entity tag is strong unless it is explicitly tagged as weak.
406   Section 3 gives the syntax for entity tags.
407
408   A Last-Modified time, when used as a validator in a request, is
409   implicitly weak unless it is possible to deduce that it is strong,
410   using the following rules:
411
412   o  The validator is being compared by an origin server to the actual
413      current validator for the entity and,
414
415   o  That origin server reliably knows that the associated entity did
416      not change twice during the second covered by the presented
417      validator.
418
419   or
420
421   o  The validator is about to be used by a client in an If-Modified-
422      Since or If-Unmodified-Since header, because the client has a
423      cache entry for the associated entity, and
424
425   o  That cache entry includes a Date value, which gives the time when
426      the origin server sent the original response, and
427
428   o  The presented Last-Modified time is at least 60 seconds before the
429      Date value.
430
431   or
432
433   o  The validator is being compared by an intermediate cache to the
434      validator stored in its cache entry for the entity, and
435
436   o  That cache entry includes a Date value, which gives the time when
437      the origin server sent the original response, and
438
439   o  The presented Last-Modified time is at least 60 seconds before the
440      Date value.
441
442   This method relies on the fact that if two different responses were
443   sent by the origin server during the same second, but both had the
444
445
446
447Fielding, et al.          Expires May 20, 2009                  [Page 8]
448
449Internet-Draft              HTTP/1.1, Part 4               November 2008
450
451
452   same Last-Modified time, then at least one of those responses would
453   have a Date value equal to its Last-Modified time.  The arbitrary 60-
454   second limit guards against the possibility that the Date and Last-
455   Modified values are generated from different clocks, or at somewhat
456   different times during the preparation of the response.  An
457   implementation MAY use a value larger than 60 seconds, if it is
458   believed that 60 seconds is too short.
459
460   If a client wishes to perform a sub-range retrieval on a value for
461   which it has only a Last-Modified time and no opaque validator, it
462   MAY do this only if the Last-Modified time is strong in the sense
463   described here.
464
465   A cache or origin server receiving a conditional range request
466   ([Part5]) MUST use the strong comparison function to evaluate the
467   condition.
468
469   These rules allow HTTP/1.1 caches and clients to safely perform sub-
470   range retrievals on values that have been obtained from HTTP/1.0
471   servers.
472
473
4746.  Rules for When to Use Entity Tags and Last-Modified Dates
475
476   We adopt a set of rules and recommendations for origin servers,
477   clients, and caches regarding when various validator types ought to
478   be used, and for what purposes.
479
480   HTTP/1.1 origin servers:
481
482   o  SHOULD send an entity tag validator unless it is not feasible to
483      generate one.
484
485   o  MAY send a weak entity tag instead of a strong entity tag, if
486      performance considerations support the use of weak entity tags, or
487      if it is unfeasible to send a strong entity tag.
488
489   o  SHOULD send a Last-Modified value if it is feasible to send one,
490      unless the risk of a breakdown in semantic transparency that could
491      result from using this date in an If-Modified-Since header would
492      lead to serious problems.
493
494   In other words, the preferred behavior for an HTTP/1.1 origin server
495   is to send both a strong entity tag and a Last-Modified value.
496
497   In order to be legal, a strong entity tag MUST change whenever the
498   associated entity changes in any way.  A weak entity tag SHOULD
499   change whenever the associated entity changes in a semantically
500
501
502
503Fielding, et al.          Expires May 20, 2009                  [Page 9]
504
505Internet-Draft              HTTP/1.1, Part 4               November 2008
506
507
508   significant way.
509
510      Note: in order to provide semantically transparent caching, an
511      origin server must avoid reusing a specific strong entity tag
512      value for two different entities, or reusing a specific weak
513      entity tag value for two semantically different entities.  Cache
514      entries might persist for arbitrarily long periods, regardless of
515      expiration times, so it might be inappropriate to expect that a
516      cache will never again attempt to validate an entry using a
517      validator that it obtained at some point in the past.
518
519   HTTP/1.1 clients:
520
521   o  If an entity tag has been provided by the origin server, MUST use
522      that entity tag in any cache-conditional request (using If-Match
523      or If-None-Match).
524
525   o  If only a Last-Modified value has been provided by the origin
526      server, SHOULD use that value in non-subrange cache-conditional
527      requests (using If-Modified-Since).
528
529   o  If only a Last-Modified value has been provided by an HTTP/1.0
530      origin server, MAY use that value in subrange cache-conditional
531      requests (using If-Unmodified-Since:).  The user agent SHOULD
532      provide a way to disable this, in case of difficulty.
533
534   o  If both an entity tag and a Last-Modified value have been provided
535      by the origin server, SHOULD use both validators in cache-
536      conditional requests.  This allows both HTTP/1.0 and HTTP/1.1
537      caches to respond appropriately.
538
539   An HTTP/1.1 origin server, upon receiving a conditional request that
540   includes both a Last-Modified date (e.g., in an If-Modified-Since or
541   If-Unmodified-Since header field) and one or more entity tags (e.g.,
542   in an If-Match, If-None-Match, or If-Range header field) as cache
543   validators, MUST NOT return a response status of 304 (Not Modified)
544   unless doing so is consistent with all of the conditional header
545   fields in the request.
546
547   An HTTP/1.1 caching proxy, upon receiving a conditional request that
548   includes both a Last-Modified date and one or more entity tags as
549   cache validators, MUST NOT return a locally cached response to the
550   client unless that cached response is consistent with all of the
551   conditional header fields in the request.
552
553      Note: The general principle behind these rules is that HTTP/1.1
554      servers and clients should transmit as much non-redundant
555      information as is available in their responses and requests.
556
557
558
559Fielding, et al.          Expires May 20, 2009                 [Page 10]
560
561Internet-Draft              HTTP/1.1, Part 4               November 2008
562
563
564      HTTP/1.1 systems receiving this information will make the most
565      conservative assumptions about the validators they receive.
566
567      HTTP/1.0 clients and caches will ignore entity tags.  Generally,
568      last-modified values received or used by these systems will
569      support transparent and efficient caching, and so HTTP/1.1 origin
570      servers should provide Last-Modified values.  In those rare cases
571      where the use of a Last-Modified value as a validator by an
572      HTTP/1.0 system could result in a serious problem, then HTTP/1.1
573      origin servers should not provide one.
574
575
5767.  Header Field Definitions
577
578   This section defines the syntax and semantics of HTTP/1.1 header
579   fields related to conditional requests.
580
581   For entity-header fields, both sender and recipient refer to either
582   the client or the server, depending on who sends and who receives the
583   entity.
584
5857.1.  ETag
586
587   The response-header field "ETag" provides the current value of the
588   entity tag (see Section 3) for the requested variant.  The headers
589   used with entity tags are described in Sections 7.2 and 7.4 of this
590   document, and in Section 6.3 of [Part5].  The entity tag MAY be used
591   for comparison with other entities from the same resource (see
592   Section 5).
593
594     ETag   = "ETag" ":" OWS ETag-v
595     ETag-v = entity-tag
596
597   Examples:
598
599     ETag: "xyzzy"
600     ETag: W/"xyzzy"
601     ETag: ""
602
603   The ETag response-header field value, an entity tag, provides for an
604   "opaque" cache validator.  This might allow more reliable validation
605   in situations where it is inconvenient to store modification dates,
606   where the one-second resolution of HTTP date values is not
607   sufficient, or where the origin server wishes to avoid certain
608   paradoxes that might arise from the use of modification dates.
609
610   The principle behind entity tags is that only the service author
611   knows the semantics of a resource well enough to select an
612
613
614
615Fielding, et al.          Expires May 20, 2009                 [Page 11]
616
617Internet-Draft              HTTP/1.1, Part 4               November 2008
618
619
620   appropriate cache validation mechanism, and the specification of any
621   validator comparison function more complex than byte-equality would
622   open up a can of worms.  Thus, comparisons of any other headers
623   (except Last-Modified, for compatibility with HTTP/1.0) are never
624   used for purposes of validating a cache entry.
625
6267.2.  If-Match
627
628   The request-header field "If-Match" is used with a method to make it
629   conditional.  A client that has one or more entities previously
630   obtained from the resource can verify that one of those entities is
631   current by including a list of their associated entity tags in the
632   If-Match header field.  Entity tags are defined in Section 3.  The
633   purpose of this feature is to allow efficient updates of cached
634   information with a minimum amount of transaction overhead.  It is
635   also used, on updating requests, to prevent inadvertent modification
636   of the wrong version of a resource.  As a special case, the value "*"
637   matches any current entity of the resource.
638
639     If-Match   = "If-Match" ":" OWS If-Match-v
640     If-Match-v = "*" / 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 May 20, 2009                 [Page 12]
672
673Internet-Draft              HTTP/1.1, Part 4               November 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 request-header field "If-Modified-Since" 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" ":" OWS
701                           If-Modified-Since-v
702     If-Modified-Since-v = HTTP-date
703
704   An example of the field is:
705
706     If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
707
708   A GET method with an If-Modified-Since header and no Range header
709   requests that the identified entity be transferred only if it has
710   been modified since the date given by the If-Modified-Since header.
711   The algorithm for determining this includes the following cases:
712
713   1.  If the request would normally result in anything other than a 200
714       (OK) status, or if the passed If-Modified-Since date is invalid,
715       the response is exactly the same as for a normal GET.  A date
716       which is later than the server's current time is invalid.
717
718   2.  If the variant has been modified since the If-Modified-Since
719       date, the response is exactly the same as for a normal GET.
720
721   3.  If the variant has not been modified since a valid If-Modified-
722       Since date, the server SHOULD return a 304 (Not Modified)
723       response.
724
725
726
727Fielding, et al.          Expires May 20, 2009                 [Page 13]
728
729Internet-Draft              HTTP/1.1, Part 4               November 2008
730
731
732   The purpose of this feature is to allow efficient updates of cached
733   information with a minimum amount of transaction overhead.
734
735      Note: The Range request-header field modifies the meaning of If-
736      Modified-Since; see Section 6.4 of [Part5] for full details.
737
738      Note: If-Modified-Since times are interpreted by the server, whose
739      clock might not be synchronized with the client.
740
741      Note: When handling an If-Modified-Since header field, some
742      servers will use an exact date comparison function, rather than a
743      less-than function, for deciding whether to send a 304 (Not
744      Modified) response.  To get best results when sending an If-
745      Modified-Since header field for cache validation, clients are
746      advised to use the exact date string received in a previous Last-
747      Modified header field whenever possible.
748
749      Note: If a client uses an arbitrary date in the If-Modified-Since
750      header instead of a date taken from the Last-Modified header for
751      the same request, the client should be aware of the fact that this
752      date is interpreted in the server's understanding of time.  The
753      client should consider unsynchronized clocks and rounding problems
754      due to the different encodings of time between the client and
755      server.  This includes the possibility of race conditions if the
756      document has changed between the time it was first requested and
757      the If-Modified-Since date of a subsequent request, and the
758      possibility of clock-skew-related problems if the If-Modified-
759      Since date is derived from the client's clock without correction
760      to the server's clock.  Corrections for different time bases
761      between client and server are at best approximate due to network
762      latency.
763
764   The result of a request having both an If-Modified-Since header field
765   and either an If-Match or an If-Unmodified-Since header fields is
766   undefined by this specification.
767
7687.4.  If-None-Match
769
770   The request-header field "If-None-Match" is used with a method to
771   make it conditional.  A client that has one or more entities
772   previously obtained from the resource can verify that none of those
773   entities is current by including a list of their associated entity
774   tags in the If-None-Match header field.  The purpose of this feature
775   is to allow efficient updates of cached information with a minimum
776   amount of transaction overhead.  It is also used to prevent a method
777   (e.g.  PUT) from inadvertently modifying an existing resource when
778   the client believes that the resource does not exist.
779
780
781
782
783Fielding, et al.          Expires May 20, 2009                 [Page 14]
784
785Internet-Draft              HTTP/1.1, Part 4               November 2008
786
787
788   As a special case, the value "*" matches any current entity of the
789   resource.
790
791     If-None-Match   = "If-None-Match" ":" OWS If-None-Match-v
792     If-None-Match-v = "*" / 1#entity-tag
793
794   If any of the entity tags match the entity tag of the entity that
795   would have been returned in the response to a similar GET request
796   (without the If-None-Match header) on that resource, or if "*" is
797   given and any current entity exists for that resource, then the
798   server MUST NOT perform the requested method, unless required to do
799   so because the resource's modification date fails to match that
800   supplied in an If-Modified-Since header field in the request.
801   Instead, if the request method was GET or HEAD, the server SHOULD
802   respond with a 304 (Not Modified) response, including the cache-
803   related header fields (particularly ETag) of one of the entities that
804   matched.  For all other request methods, the server MUST respond with
805   a status of 412 (Precondition Failed).
806
807   See Section 5 for rules on how to determine if two entity tags match.
808
809   If none of the entity tags match, then the server MAY perform the
810   requested method as if the If-None-Match header field did not exist,
811   but MUST also ignore any If-Modified-Since header field(s) in the
812   request.  That is, if no entity tags match, then the server MUST NOT
813   return a 304 (Not Modified) response.
814
815   If the request would, without the If-None-Match header field, result
816   in anything other than a 2xx or 304 status, then the If-None-Match
817   header MUST be ignored.  (See Section 6 for a discussion of server
818   behavior when both If-Modified-Since and If-None-Match appear in the
819   same request.)
820
821   The meaning of "If-None-Match: *" is that the method MUST NOT be
822   performed if the representation selected by the origin server (or by
823   a cache, possibly using the Vary mechanism, see Section 16.5 of
824   [Part6]) exists, and SHOULD be performed if the representation does
825   not exist.  This feature is intended to be useful in preventing races
826   between PUT operations.
827
828   Examples:
829
830     If-None-Match: "xyzzy"
831     If-None-Match: W/"xyzzy"
832     If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
833     If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
834     If-None-Match: *
835
836
837
838
839Fielding, et al.          Expires May 20, 2009                 [Page 15]
840
841Internet-Draft              HTTP/1.1, Part 4               November 2008
842
843
844   The result of a request having both an If-None-Match header field and
845   either an If-Match or an If-Unmodified-Since header fields is
846   undefined by this specification.
847
8487.5.  If-Unmodified-Since
849
850   The request-header field "If-Unmodified-Since" is used with a method
851   to make it conditional.  If the requested resource has not been
852   modified since the time specified in this field, the server SHOULD
853   perform the requested operation as if the If-Unmodified-Since header
854   were not present.
855
856   If the requested variant has been modified since the specified time,
857   the server MUST NOT perform the requested operation, and MUST return
858   a 412 (Precondition Failed).
859
860     If-Unmodified-Since   = "If-Unmodified-Since" ":" OWS
861                             If-Unmodified-Since-v
862     If-Unmodified-Since-v = HTTP-date
863
864   An example of the field is:
865
866     If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
867
868   If the request normally (i.e., without the If-Unmodified-Since
869   header) would result in anything other than a 2xx or 412 status, the
870   If-Unmodified-Since header SHOULD be ignored.
871
872   If the specified date is invalid, the header is ignored.
873
874   The result of a request having both an If-Unmodified-Since header
875   field and either an If-None-Match or an If-Modified-Since header
876   fields is undefined by this specification.
877
8787.6.  Last-Modified
879
880   The entity-header field "Last-Modified" indicates the date and time
881   at which the origin server believes the variant was last modified.
882
883     Last-Modified   = "Last-Modified" ":" OWS Last-Modified-v
884     Last-Modified-v = HTTP-date
885
886   An example of its use is
887
888     Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
889
890   The exact meaning of this header field depends on the implementation
891   of the origin server and the nature of the original resource.  For
892
893
894
895Fielding, et al.          Expires May 20, 2009                 [Page 16]
896
897Internet-Draft              HTTP/1.1, Part 4               November 2008
898
899
900   files, it may be just the file system last-modified time.  For
901   entities with dynamically included parts, it may be the most recent
902   of the set of last-modify times for its component parts.  For
903   database gateways, it may be the last-update time stamp of the
904   record.  For virtual objects, it may be the last time the internal
905   state changed.
906
907   An origin server MUST NOT send a Last-Modified date which is later
908   than the server's time of message origination.  In such cases, where
909   the resource's last modification would indicate some time in the
910   future, the server MUST replace that date with the message
911   origination date.
912
913   An origin server SHOULD obtain the Last-Modified value of the entity
914   as close as possible to the time that it generates the Date value of
915   its response.  This allows a recipient to make an accurate assessment
916   of the entity's modification time, especially if the entity changes
917   near the time that the response is generated.
918
919   HTTP/1.1 servers SHOULD send Last-Modified whenever feasible.
920
921   The Last-Modified entity-header field value is often used as a cache
922   validator.  In simple terms, a cache entry is considered to be valid
923   if the entity has not been modified since the Last-Modified value.
924
925
9268.  IANA Considerations
927
9288.1.  Message Header Registration
929
930   The Message Header Registry located at <http://www.iana.org/
931   assignments/message-headers/message-header-index.html> should be
932   updated with the permanent registrations below (see [RFC3864]):
933
934   +---------------------+----------+----------+-------------+
935   | Header Field Name   | Protocol | Status   | Reference   |
936   +---------------------+----------+----------+-------------+
937   | ETag                | http     | standard | Section 7.1 |
938   | If-Match            | http     | standard | Section 7.2 |
939   | If-Modified-Since   | http     | standard | Section 7.3 |
940   | If-None-Match       | http     | standard | Section 7.4 |
941   | If-Unmodified-Since | http     | standard | Section 7.5 |
942   | Last-Modified       | http     | standard | Section 7.6 |
943   +---------------------+----------+----------+-------------+
944
945   The change controller is: "IETF (iesg@ietf.org) - Internet
946   Engineering Task Force".
947
948
949
950
951Fielding, et al.          Expires May 20, 2009                 [Page 17]
952
953Internet-Draft              HTTP/1.1, Part 4               November 2008
954
955
9569.  Security Considerations
957
958   No additional security considerations have been identified beyond
959   those applicable to HTTP in general [Part1].
960
961
96210.  Acknowledgments
963
964
96511.  References
966
96711.1.  Normative References
968
969   [Part1]    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 1: URIs, Connections,
972              and Message Parsing", draft-ietf-httpbis-p1-messaging-05
973              (work in progress), November 2008.
974
975   [Part5]    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 5: Range Requests and
978              Partial Responses", draft-ietf-httpbis-p5-range-05 (work
979              in progress), November 2008.
980
981   [Part6]    Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H.,
982              Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed.,
983              and J. Reschke, Ed., "HTTP/1.1, part 6: Caching",
984              draft-ietf-httpbis-p6-cache-05 (work in progress),
985              November 2008.
986
987   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
988              Requirement Levels", BCP 14, RFC 2119, March 1997.
989
99011.2.  Informative References
991
992   [RFC2616]  Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
993              Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
994              Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
995
996   [RFC3864]  Klyne, G., Nottingham, M., and J. Mogul, "Registration
997              Procedures for Message Header Fields", BCP 90, RFC 3864,
998              September 2004.
999
1000
1001Appendix A.  Compatibility with Previous Versions
1002
1003
1004
1005
1006
1007Fielding, et al.          Expires May 20, 2009                 [Page 18]
1008
1009Internet-Draft              HTTP/1.1, Part 4               November 2008
1010
1011
1012A.1.  Changes from RFC 2616
1013
1014   Allow weak entity tags in all requests except range requests
1015   (Sections 5 and 7.4).
1016
1017
1018Appendix B.  Change Log (to be removed by RFC Editor before publication)
1019
1020B.1.  Since RFC2616
1021
1022   Extracted relevant partitions from [RFC2616].
1023
1024B.2.  Since draft-ietf-httpbis-p4-conditional-00
1025
1026   Closed issues:
1027
1028   o  <http://tools.ietf.org/wg/httpbis/trac/ticket/35>: "Normative and
1029      Informative references"
1030
1031   Other changes:
1032
1033   o  Move definitions of 304 and 412 condition codes from Part2.
1034
1035B.3.  Since draft-ietf-httpbis-p4-conditional-01
1036
1037   Ongoing work on ABNF conversion
1038   (<http://tools.ietf.org/wg/httpbis/trac/ticket/36>):
1039
1040   o  Add explicit references to BNF syntax and rules imported from
1041      other parts of the specification.
1042
1043B.4.  Since draft-ietf-httpbis-p4-conditional-02
1044
1045   Closed issues:
1046
1047   o  <http://tools.ietf.org/wg/httpbis/trac/ticket/116>: "Weak ETags on
1048      non-GET requests"
1049
1050   Ongoing work on IANA Message Header Registration
1051   (<http://tools.ietf.org/wg/httpbis/trac/ticket/40>):
1052
1053   o  Reference RFC 3984, and update header registrations for headers
1054      defined in this document.
1055
1056
1057
1058
1059
1060
1061
1062
1063Fielding, et al.          Expires May 20, 2009                 [Page 19]
1064
1065Internet-Draft              HTTP/1.1, Part 4               November 2008
1066
1067
1068B.5.  Since draft-ietf-httpbis-p4-conditional-03
1069
1070   Closed issues:
1071
1072   o  <http://tools.ietf.org/wg/httpbis/trac/ticket/71>: "Examples for
1073      ETag matching"
1074
1075   o  <http://tools.ietf.org/wg/httpbis/trac/ticket/124>: "'entity
1076      value' undefined"
1077
1078   o  <http://tools.ietf.org/wg/httpbis/trac/ticket/126>: "bogus 2068
1079      Date header reference"
1080
1081B.6.  Since draft-ietf-httpbis-p4-conditional-04
1082
1083   Ongoing work on ABNF conversion
1084   (<http://tools.ietf.org/wg/httpbis/trac/ticket/36>):
1085
1086   o  Use "/" instead of "|" for alternatives.
1087
1088   o  Introduce new ABNF rules for "bad" whitespace ("BWS"), optional
1089      whitespace ("OWS") and required whitespace ("RWS").
1090
1091   o  Rewrite ABNFs to spell out whitespace rules, factor out header
1092      value format definitions.
1093
1094
1095Index
1096
1097   3
1098      304 Not Modified (status code)  5
1099
1100   4
1101      412 Precondition Failed (status code)  6
1102
1103   E
1104      ETag header  11
1105
1106   G
1107      Grammar
1108         entity-tag  5
1109         ETag  11
1110         ETag-v  11
1111         If-Match  12
1112         If-Match-v  12
1113         If-Modified-Since  13
1114         If-Modified-Since-v  13
1115         If-None-Match  15
1116
1117
1118
1119Fielding, et al.          Expires May 20, 2009                 [Page 20]
1120
1121Internet-Draft              HTTP/1.1, Part 4               November 2008
1122
1123
1124         If-None-Match-v  15
1125         If-Unmodified-Since  16
1126         If-Unmodified-Since-v  16
1127         Last-Modified  16
1128         Last-Modified-v  16
1129         opaque-tag  5
1130         weak  5
1131
1132   H
1133      Headers
1134         ETag  11
1135         If-Match  12
1136         If-Modified-Since  13
1137         If-None-Match  14
1138         If-Unmodified-Since  16
1139         Last-Modified  16
1140
1141   I
1142      If-Match header  12
1143      If-Modified-Since header  13
1144      If-None-Match header  14
1145      If-Unmodified-Since header  16
1146
1147   L
1148      Last-Modified header  16
1149
1150   S
1151      Status Codes
1152         304 Not Modified  5
1153         412 Precondition Failed  6
1154
1155
1156Authors' Addresses
1157
1158   Roy T. Fielding (editor)
1159   Day Software
1160   23 Corporate Plaza DR, Suite 280
1161   Newport Beach, CA  92660
1162   USA
1163
1164   Phone: +1-949-706-5300
1165   Fax:   +1-949-706-5305
1166   Email: fielding@gbiv.com
1167   URI:   http://roy.gbiv.com/
1168
1169
1170
1171
1172
1173
1174
1175Fielding, et al.          Expires May 20, 2009                 [Page 21]
1176
1177Internet-Draft              HTTP/1.1, Part 4               November 2008
1178
1179
1180   Jim Gettys
1181   One Laptop per Child
1182   21 Oak Knoll Road
1183   Carlisle, MA  01741
1184   USA
1185
1186   Email: jg@laptop.org
1187   URI:   http://www.laptop.org/
1188
1189
1190   Jeffrey C. Mogul
1191   Hewlett-Packard Company
1192   HP Labs, Large Scale Systems Group
1193   1501 Page Mill Road, MS 1177
1194   Palo Alto, CA  94304
1195   USA
1196
1197   Email: JeffMogul@acm.org
1198
1199
1200   Henrik Frystyk Nielsen
1201   Microsoft Corporation
1202   1 Microsoft Way
1203   Redmond, WA  98052
1204   USA
1205
1206   Email: henrikn@microsoft.com
1207
1208
1209   Larry Masinter
1210   Adobe Systems, Incorporated
1211   345 Park Ave
1212   San Jose, CA  95110
1213   USA
1214
1215   Email: LMM@acm.org
1216   URI:   http://larry.masinter.net/
1217
1218
1219   Paul J. Leach
1220   Microsoft Corporation
1221   1 Microsoft Way
1222   Redmond, WA  98052
1223
1224   Email: paulle@microsoft.com
1225
1226
1227
1228
1229
1230
1231Fielding, et al.          Expires May 20, 2009                 [Page 22]
1232
1233Internet-Draft              HTTP/1.1, Part 4               November 2008
1234
1235
1236   Tim Berners-Lee
1237   World Wide Web Consortium
1238   MIT Computer Science and Artificial Intelligence Laboratory
1239   The Stata Center, Building 32
1240   32 Vassar Street
1241   Cambridge, MA  02139
1242   USA
1243
1244   Email: timbl@w3.org
1245   URI:   http://www.w3.org/People/Berners-Lee/
1246
1247
1248   Yves Lafon (editor)
1249   World Wide Web Consortium
1250   W3C / ERCIM
1251   2004, rte des Lucioles
1252   Sophia-Antipolis, AM  06902
1253   France
1254
1255   Email: ylafon@w3.org
1256   URI:   http://www.raubacapeu.net/people/yves/
1257
1258
1259   Julian F. Reschke (editor)
1260   greenbytes GmbH
1261   Hafenweg 16
1262   Muenster, NW  48155
1263   Germany
1264
1265   Phone: +49 251 2807760
1266   Fax:   +49 251 2807761
1267   Email: julian.reschke@greenbytes.de
1268   URI:   http://greenbytes.de/tech/webdav/
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287Fielding, et al.          Expires May 20, 2009                 [Page 23]
1288
1289Internet-Draft              HTTP/1.1, Part 4               November 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 May 20, 2009                 [Page 24]
1344
Note: See TracBrowser for help on using the repository browser.