source: draft-ietf-httpbis/latest/p4-conditional.xml @ 2232

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

bump up document dates, update to latest version of rfc2629.xslt

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/xml
File size: 67.9 KB
[29]1<?xml version="1.0" encoding="utf-8"?>
[101]2<?xml-stylesheet type='text/xsl' href='../myxml2rfc.xslt'?>
[8]3<!DOCTYPE rfc [
4  <!ENTITY MAY "<bcp14 xmlns=''>MAY</bcp14>">
5  <!ENTITY MUST "<bcp14 xmlns=''>MUST</bcp14>">
6  <!ENTITY MUST-NOT "<bcp14 xmlns=''>MUST NOT</bcp14>">
7  <!ENTITY OPTIONAL "<bcp14 xmlns=''>OPTIONAL</bcp14>">
8  <!ENTITY RECOMMENDED "<bcp14 xmlns=''>RECOMMENDED</bcp14>">
9  <!ENTITY REQUIRED "<bcp14 xmlns=''>REQUIRED</bcp14>">
10  <!ENTITY SHALL "<bcp14 xmlns=''>SHALL</bcp14>">
11  <!ENTITY SHALL-NOT "<bcp14 xmlns=''>SHALL NOT</bcp14>">
12  <!ENTITY SHOULD "<bcp14 xmlns=''>SHOULD</bcp14>">
13  <!ENTITY SHOULD-NOT "<bcp14 xmlns=''>SHOULD NOT</bcp14>">
[29]14  <!ENTITY ID-VERSION "latest">
[2232]15  <!ENTITY ID-MONTH "May">
[2080]16  <!ENTITY ID-YEAR "2013">
[1692]17  <!ENTITY Note "<x:h xmlns:x=''>Note:</x:h>">
[1452]18  <!ENTITY architecture               "<xref target='Part1' x:rel='#architecture' xmlns:x=''/>">
[1875]19  <!ENTITY conformance                "<xref target='Part1' x:rel='#conformance' xmlns:x=''/>">
[424]20  <!ENTITY notation                   "<xref target='Part1' x:rel='#notation' xmlns:x=''/>">
[1518]21  <!ENTITY abnf-extension             "<xref target='Part1' x:rel='#abnf.extension' xmlns:x=''/>">
[1364]22  <!ENTITY acks                       "<xref target='Part1' x:rel='#acks' xmlns:x=''/>">
[1518]23  <!ENTITY whitespace                 "<xref target='Part1' x:rel='#whitespace' xmlns:x=''/>">
24  <!ENTITY field-components           "<xref target='Part1' x:rel='#field.components' xmlns:x=''/>">
[1436]25  <!ENTITY header-date                "<xref target='Part2' x:rel='' xmlns:x=''/>">
[2230]26  <!ENTITY safe-methods               "<xref target='Part2' x:rel='#safe.methods' xmlns:x=''/>">
[2161]27  <!ENTITY representation             "<xref target='Part2' x:rel='#representations' xmlns:x=''/>">
[31]28  <!ENTITY messaging                  "<xref target='Part1' xmlns:x=''/>">
[2069]29  <!ENTITY semantics                  "<xref target='Part2' xmlns:x=''/>">
[163]30  <!ENTITY caching                    "<xref target='Part6' xmlns:x=''/>">
[2093]31  <!ENTITY freshening-responses       "<xref target='Part6' x:rel='#freshening.responses' xmlns:x=''/>">
[1643]32  <!ENTITY header-accept-encoding     "<xref target='Part2' x:rel='#header.accept-encoding' xmlns:x=''/>">
[31]33  <!ENTITY header-if-range            "<xref target='Part5' x:rel='#header.if-range' xmlns:x=''/>">
34  <!ENTITY header-range               "<xref target='Part5' x:rel='#header.range' xmlns:x=''/>">
[1860]35  <!ENTITY header-vary                "<xref target='Part2' x:rel='#header.vary' xmlns:x=''/>">
[1436]36  <!ENTITY http-date                  "<xref target='Part2' x:rel='' xmlns:x=''/>">
[800]37  <!ENTITY transfer-codings           "<xref target='Part1' x:rel='#transfer.codings' xmlns:x=''/>">
[1643]38  <!ENTITY content-negotiation        "<xref target='Part2' x:rel='#content.negotiation' xmlns:x=''/>">
40<?rfc toc="yes" ?>
[29]41<?rfc symrefs="yes" ?>
42<?rfc sortrefs="yes" ?>
[8]43<?rfc compact="yes"?>
44<?rfc subcompact="no" ?>
45<?rfc linkmailto="no" ?>
46<?rfc editing="no" ?>
[203]47<?rfc comments="yes"?>
48<?rfc inline="yes"?>
[799]49<?rfc rfcedstyle="yes"?>
[8]50<?rfc-ext allow-markup-in-artwork="yes" ?>
51<?rfc-ext include-references-in-index="yes" ?>
[1477]52<rfc obsoletes="2616" category="std" x:maturity-level="proposed"
[446]53     ipr="pre5378Trust200902" docName="draft-ietf-httpbis-p4-conditional-&ID-VERSION;"
[153]54     xmlns:x=''>
[1810]55<x:link rel="prev" basename="p2-semantics"/>
[1472]56<x:link rel="next" basename="p5-range"/>
[1522]57<x:feedback template="{docname},%20%22{section}%22&amp;body=&lt;{ref}&gt;:"/>
[1864]60  <title abbrev="HTTP/1.1 Conditional Requests">Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title>
[29]62  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
[1106]63    <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
[8]64    <address>
65      <postal>
[1106]66        <street>345 Park Ave</street>
67        <city>San Jose</city>
[8]68        <region>CA</region>
[1106]69        <code>95110</code>
[29]70        <country>USA</country>
[8]71      </postal>
[29]72      <email></email>
73      <uri></uri>
[8]74    </address>
75  </author>
[95]77  <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
78    <organization abbrev="greenbytes">greenbytes GmbH</organization>
79    <address>
80      <postal>
81        <street>Hafenweg 16</street>
82        <city>Muenster</city><region>NW</region><code>48155</code>
83        <country>Germany</country>
84      </postal>
[609]85      <email></email>
86      <uri></uri>
[95]87    </address>
88  </author>
[31]90  <date month="&ID-MONTH;" year="&ID-YEAR;"/>
[440]91  <workgroup>HTTPbis Working Group</workgroup>
[1373]95   The Hypertext Transfer Protocol (HTTP) is an application-level protocol for
[1783]96   distributed, collaborative, hypertext information systems. This document
97   defines HTTP/1.1 conditional requests, including metadata header fields
98   for indicating state changes, request header fields for making
99   preconditions on such state, and rules for constructing the responses to a
100   conditional request when one or more preconditions evaluate to false.
104<note title="Editorial Note (To be removed by RFC Editor)">
105  <t>
[1764]106    Discussion of this draft takes place on the HTTPBIS working group
[1268]107    mailing list (, which is archived at
108    <eref target=""/>.
109  </t>
110  <t>
111    The current issues list is at
112    <eref target=""/> and related
113    documents (including fancy diffs) can be found at
[324]114    <eref target=""/>.
[36]115  </t>
[153]116  <t>
[2190]117    The changes in this draft are summarized in <xref target="changes.since.22"/>.
[153]118  </t>
123<section title="Introduction" anchor="introduction">
[1783]125   Conditional requests are HTTP requests <xref target="Part2"/> that include
126   one or more header fields indicating a precondition to be tested before
127   applying the method semantics to the target resource.
128   This document defines the HTTP/1.1 conditional request mechanisms in terms
129   of the architecture, syntax notation, and conformance criteria defined in
[1786]130   <xref target="Part1"/>.
[1380]133   Conditional GET requests are the most efficient mechanism for HTTP
134   cache updates &caching;.  Conditionals can also be
[1251]135   applied to state-changing methods, such as PUT and DELETE, to prevent
136   the "lost update" problem: one client accidentally overwriting
137   the work of another client that has been acting in parallel.
[2161]139<t><iref primary="true" item="selected representation"/>
[1251]140   Conditional request preconditions are based on the state of the target
141   resource as a whole (its current value set) or the state as observed
142   in a previously obtained representation (one value in that set).
143   A resource might have multiple current representations, each with its
144   own observable state.  The conditional request mechanisms assume that
[2161]145   the mapping of requests to a "selected representation" (&representation;)
146   will be consistent over time if the server intends to take advantage of
147   conditionals. Regardless, if the mapping is inconsistent and the server is
148   unable to select the appropriate representation, then no harm will result
149   when the precondition evaluates to false.
152   The conditional request preconditions defined by this specification are
153   evaluated by comparing the validators provided in the conditional request
154   header fields to the current validators for the selected representation
155   in the order defined by <xref target="precedence"/>.
[1875]158<section title="Conformance and Error Handling" anchor="conformance">
160   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
161   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
162   document are to be interpreted as described in <xref target="RFC2119"/>.
[1875]165   Conformance criteria and considerations regarding error handling
166   are defined in &conformance;.
[1796]170<section title="Syntax Notation" anchor="notation">
172   This specification uses the Augmented Backus-Naur Form (ABNF) notation
173   of <xref target="RFC5234"/> with the list rule extension defined in
[1805]174   &notation;. <xref target="imported.abnf"/> describes rules imported from
175   other documents. <xref target="collected.abnf"/> shows the collected ABNF
[1796]176   with the list rule expanded.
[1380]181<section title="Validators" anchor="validators">
[1253]182   <iref primary="true" item="metadata"/>
183   <iref primary="true" item="validator"/>
[1251]185   This specification defines two forms of metadata that are commonly used
186   to observe resource state and test for preconditions: modification dates
[1733]187   (<xref target="header.last-modified"/>) and opaque entity tags
188   (<xref target="header.etag"/>).  Additional metadata that reflects resource state
[1251]189   has been defined by various extensions of HTTP, such as WebDAV
190   <xref target="RFC4918"/>, that are beyond the scope of this specification.
[1260]191   A resource metadata value is referred to as a "<x:dfn>validator</x:dfn>"
192   when it is used within a precondition.
[1379]195<section title="Weak versus Strong" anchor="weak.and.strong.validators">
[1380]196   <iref primary="true" item="validator" subitem="weak"/>
197   <iref primary="true" item="validator" subitem="strong"/>
[1380]199   Validators come in two flavors: strong or weak.  Weak validators are easy
200   to generate but are far less useful for comparisons.  Strong validators
201   are ideal for comparisons but can be very difficult (and occasionally
202   impossible) to generate efficiently.  Rather than impose that all forms
203   of resource adhere to the same strength of validator, HTTP exposes the
204   type of validator in use and imposes restrictions on when weak validators
205   can be used as preconditions.
[2129]208   A "strong validator" is representation metadata that changes value whenever
209   a change occurs to the representation data that would be observable in the
210   payload body of a <x:ref>200 (OK)</x:ref> response to GET.
[2129]213   A strong validator might change for other reasons, such as when a
214   semantically significant part of the representation metadata is changed
215   (e.g., <x:ref>Content-Type</x:ref>), but it is in the best interests of the
216   origin server to only change the value when it is necessary to invalidate
217   the stored responses held by remote caches and authoring tools. A strong
218   validator is unique across all representations of a given resource, such
[2147]219   that no two representations of that resource can share the same validator
220   unless their representation data is identical.
223   Cache entries might persist for arbitrarily long periods, regardless
224   of expiration times.  Thus, a cache might attempt to validate an
225   entry using a validator that it obtained in the distant past.
[2128]226   A strong validator is unique across all versions of all
[1379]227   representations associated with a particular resource over time.
[1380]228   However, there is no implication of uniqueness across representations
229   of different resources (i.e., the same strong validator might be
[1379]230   in use for representations of multiple resources at the same time
231   and does not imply that those representations are equivalent).
[1380]234   There are a variety of strong validators used in practice.  The best are
235   based on strict revision control, wherein each change to a representation
236   always results in a unique node name and revision identifier being assigned
[1801]237   before the representation is made accessible to GET.  A collision-resistant hash
[1380]238   function applied to the representation data is also sufficient if the data
239   is available prior to the response header fields being sent and the digest
240   does not need to be recalculated every time a validation request is
241   received.  However, if a resource has distinct representations that differ
242   only in their metadata, such as might occur with content negotiation over
[1691]243   media types that happen to share the same data format, then the origin
244   server &SHOULD; incorporate additional information in the validator to
[2230]245   distinguish those representations and avoid confusing undesired behaviors
246   (such as in caches).
[2129]249   In contrast, a "weak validator" is representation metadata that
250   might not change for every change to the representation data.  This
[1380]251   weakness might be due to limitations in how the value is calculated, such
252   as clock resolution or an inability to ensure uniqueness for all possible
253   representations of the resource, or due to a desire by the resource owner
254   to group representations by some self-determined set of equivalency
[1691]255   rather than unique sequences of data.  An origin server &SHOULD; change a
256   weak entity-tag whenever it considers prior representations to be
257   unacceptable as a substitute for the current representation. In other words,
258   a weak entity-tag ought to change whenever the origin server wants caches to
259   invalidate old responses.
262   For example, the representation of a weather report that changes in
263   content every second, based on dynamic measurements, might be grouped
264   into sets of equivalent representations (from the origin server's
265   perspective) with the same weak validator in order to allow cached
266   representations to be valid for a reasonable period of time (perhaps
267   adjusted dynamically based on server load or weather quality).
268   Likewise, a representation's modification time, if defined with only
269   one-second resolution, might be a weak validator if it is possible
270   for the representation to be modified twice during a single second and
271   retrieved between those modifications.
[2136]274   Likewise, a validator is weak if it is shared by two or more
275   representations of a given resource at the same time, unless those
276   representations have identical representation data. For example, if the
277   origin server sends the same validator for a representation with a gzip
278   content coding applied as it does for a representation with no content
279   coding, then that validator is weak. However, two simultaneous
280   representations might share the same strong validator if they differ only
281   in the representation metadata, such as when two different media types are
282   available for the same representation data.
[1380]285   A "use" of a validator occurs when either a client generates a request
286   and includes the validator in a precondition or when a server
287   compares two validators.
288   Weak validators are only usable in contexts that do not depend on exact
[2147]289   equality of the representation data.
[1380]290   Strong validators are usable and preferred for all conditional requests,
291   including cache validation, partial content ranges, and "lost update"
292   avoidance.
[1253]296<section title="Last-Modified" anchor="header.last-modified">
297  <iref primary="true" item="Last-Modified header field" x:for-anchor=""/>
298  <x:anchor-alias value="Last-Modified"/>
[2105]300   The "Last-Modified" header field in a response provides a timestamp
301   indicating the date and time at which the origin server believes the
302   selected representation was last modified, as determined at the conclusion
303   of handling the request.
305<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Last-Modified"/>
306  <x:ref>Last-Modified</x:ref> = <x:ref>HTTP-date</x:ref>
309   An example of its use is
311<figure><artwork type="example">
312  Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
315<section title="Generation" anchor="lastmod.generation">
[1260]317   Origin servers &SHOULD; send Last-Modified for any selected
318   representation for which a last modification date can be reasonably
319   and consistently determined, since its use in conditional requests
320   and evaluating cache freshness (&caching;) results in a substantial
321   reduction of HTTP traffic on the Internet and can be a significant
322   factor in improving service scalability and reliability.
[1253]325   A representation is typically the sum of many parts behind the
326   resource interface.  The last-modified time would usually be
327   the most recent time that any of those parts were changed.
328   How that value is determined for any given resource is an
329   implementation detail beyond the scope of this specification.
330   What matters to HTTP is how recipients of the Last-Modified
331   header field can use its value to make conditional requests
332   and test the validity of locally cached responses.
[1260]335   An origin server &SHOULD; obtain the Last-Modified value of the
[1740]336   representation as close as possible to the time that it generates the
337   <x:ref>Date</x:ref> field value for its response. This allows a recipient to
[1260]338   make an accurate assessment of the representation's modification time,
339   especially if the representation changes near the time that the
340   response is generated.
[1260]343   An origin server with a clock &MUST-NOT; send a Last-Modified date
[1740]344   that is later than the server's time of message origination (<x:ref>Date</x:ref>).
[1260]345   If the last modification time is derived from implementation-specific
346   metadata that evaluates to some time in the future, according to the
347   origin server's clock, then the origin server &MUST; replace that
348   value with the message origination date. This prevents a future
349   modification date from having an adverse impact on cache validation.
352   An origin server without a clock &MUST-NOT; assign Last-Modified
353   values to a response unless these values were associated
354   with the resource by some other system or user with a reliable clock.
[1260]358<section title="Comparison" anchor="lastmod.comparison">
[1260]360   A Last-Modified time, when used as a validator in a request, is
361   implicitly weak unless it is possible to deduce that it is strong,
362   using the following rules:
363  <list style="symbols">
364     <t>The validator is being compared by an origin server to the
365        actual current validator for the representation and,</t>
366     <t>That origin server reliably knows that the associated representation did
367        not change twice during the second covered by the presented
368        validator.</t>
369  </list>
[1260]372   or
373  <list style="symbols">
[1739]374     <t>The validator is about to be used by a client in an <x:ref>If-Modified-Since</x:ref>,
375        <x:ref>If-Unmodified-Since</x:ref> header field, because the client has
376        a cache entry, or <x:ref>If-Range</x:ref> for the associated
377        representation, and</t>
[1740]378     <t>That cache entry includes a <x:ref>Date</x:ref> value, which gives the
379        time when the origin server sent the original response, and</t>
[1260]380     <t>The presented Last-Modified time is at least 60 seconds before
381        the Date value.</t>
382  </list>
[1260]385   or
386  <list style="symbols">
387     <t>The validator is being compared by an intermediate cache to the
388        validator stored in its cache entry for the representation, and</t>
[1740]389     <t>That cache entry includes a <x:ref>Date</x:ref> value, which gives the
390        time when the origin server sent the original response, and</t>
[1260]391     <t>The presented Last-Modified time is at least 60 seconds before
392        the Date value.</t>
393  </list>
[1260]396   This method relies on the fact that if two different responses were
397   sent by the origin server during the same second, but both had the
398   same Last-Modified time, then at least one of those responses would
[1740]399   have a <x:ref>Date</x:ref> value equal to its Last-Modified time. The
400   arbitrary 60-second limit guards against the possibility that the Date and
401   Last-Modified values are generated from different clocks, or at somewhat
[1260]402   different times during the preparation of the response. An
403   implementation &MAY; use a value larger than 60 seconds, if it is
404   believed that 60 seconds is too short.
[1253]409<section title="ETag" anchor="header.etag">
410  <iref primary="true" item="ETag header field" x:for-anchor=""/>
411  <x:anchor-alias value="ETag"/>
[1260]412  <x:anchor-alias value="entity-tag"/>
413  <x:anchor-alias value="opaque-tag"/>
414  <x:anchor-alias value="weak"/>
[1470]415  <x:anchor-alias value="etagc"/>
[2105]417   The "ETag" header field in a response provides the current entity-tag for
418   the selected representation, as determined at the conclusion of handling
419   the request.
[1260]420   An entity-tag is an opaque validator for differentiating between
421   multiple representations of the same resource, regardless of whether
422   those multiple representations are due to resource state changes over
423   time, content negotiation resulting in multiple representations being
424   valid at the same time, or both. An entity-tag consists of an opaque
425   quoted string, possibly prefixed by a weakness indicator.
[1470]427<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="ETag"/><iref primary="true" item="Grammar" subitem="entity-tag"/><iref primary="true" item="Grammar" subitem="weak"/><iref primary="true" item="Grammar" subitem="opaque-tag"/><iref primary="true" item="Grammar" subitem="etagc"/>
[1260]428  <x:ref>ETag</x:ref>       = <x:ref>entity-tag</x:ref>
430  <x:ref>entity-tag</x:ref> = [ <x:ref>weak</x:ref> ] <x:ref>opaque-tag</x:ref>
431  <x:ref>weak</x:ref>       = <x:abnf-char-sequence>"W/"</x:abnf-char-sequence> ; "W/", case-sensitive
[1470]432  <x:ref>opaque-tag</x:ref> = <x:ref>DQUOTE</x:ref> *<x:ref>etagc</x:ref> <x:ref>DQUOTE</x:ref>
433  <x:ref>etagc</x:ref>      = %x21 / %x23-7E / <x:ref>obs-text</x:ref>
[1482]434             ; <x:ref>VCHAR</x:ref> except double quotes, plus obs-text
437  <t>
[1692]438    &Note; Previously, opaque-tag was defined to be a quoted-string
[1470]439    (<xref target="RFC2616" x:fmt="," x:sec="3.11"/>), thus some recipients
440    might perform backslash unescaping. Servers therefore ought to avoid
441    backslash characters in entity tags.
442  </t>
445   An entity-tag can be more reliable for validation than a modification
446   date in situations where it is inconvenient to store modification
447   dates, where the one-second resolution of HTTP date values is not
448   sufficient, or where modification dates are not consistently maintained.
451  Examples:
453<artwork type="example">
454  ETag: "xyzzy"
455  ETag: W/"xyzzy"
456  ETag: ""
459   An entity-tag can be either a weak or strong validator, with
460   strong being the default.  If an origin server provides an entity-tag
461   for a representation and the generation of that entity-tag does not satisfy
[2129]462   all of the characteristics of a strong validator
[2128]463   (<xref target="weak.and.strong.validators"/>), then the origin server
464   &MUST; mark the entity-tag as weak by prefixing its opaque value
[1379]465   with "W/" (case-sensitive).
468<section title="Generation" anchor="entity.tag.generation">
470   The principle behind entity-tags is that only the service author
[1260]471   knows the implementation of a resource well enough to select the
472   most accurate and efficient validation mechanism for that resource,
473   and that any such mechanism can be mapped to a simple sequence of
474   octets for easy comparison.  Since the value is opaque, there is no
475   need for the client to be aware of how each entity-tag is constructed.
[1260]478   For example, a resource that has implementation-specific versioning
479   applied to all changes might use an internal revision number, perhaps
480   combined with a variance identifier for content negotiation, to
481   accurately differentiate between representations.
[1801]482   Other implementations might use a collision-resistant hash of
483   representation content,
[1260]484   a combination of various filesystem attributes, or a modification
485   timestamp that has sub-second resolution.
[1260]488   Origin servers &SHOULD; send ETag for any selected representation
489   for which detection of changes can be reasonably and consistently
490   determined, since the entity-tag's use in conditional requests and
491   evaluating cache freshness (&caching;) can result in a substantial
492   reduction of HTTP network traffic and can be a significant factor in
493   improving service scalability and reliability.
[1260]497<section title="Comparison" anchor="entity.tag.comparison">
498  <x:anchor-alias value="validator.comparison"/>
[2128]499  <x:anchor-alias value="strong comparison"/>
500  <x:anchor-alias value="weak comparison"/>
502   There are two entity-tag comparison functions, depending
[8]503   on whether the comparison context allows the use of weak validators
504   or not:
505  <list style="symbols">
[2128]506     <t><x:dfn>Strong comparison</x:dfn>: two entity-tags are equivalent if both
507        are not weak and their opaque-tags match character-by-character.</t>
508     <t><x:dfn>Weak comparison</x:dfn>: two entity-tags are equivalent if their opaque-tags
509        match character-by-character, regardless of either or both
510        being tagged as "weak".</t>
[8]511  </list>
[874]514   The example below shows the results for a set of entity-tag pairs,
[298]515   and both the weak and strong comparison function results:
517<texttable align="left">
518  <ttcol>ETag 1</ttcol>
519  <ttcol>ETag 2</ttcol>
520  <ttcol>Strong Comparison</ttcol>
521  <ttcol>Weak Comparison</ttcol>
523  <c>W/"1"</c>
524  <c>W/"1"</c>
525  <c>no match</c>
526  <c>match</c>
528  <c>W/"1"</c>
529  <c>W/"2"</c>
530  <c>no match</c>
531  <c>no match</c>
533  <c>W/"1"</c>
534  <c>"1"</c>
535  <c>no match</c>
536  <c>match</c>
538  <c>"1"</c>
539  <c>"1"</c>
540  <c>match</c>
541  <c>match</c>
[2129]545<section title="Example: Entity-tags Varying on Content-Negotiated Resources" anchor="example.entity.tag.vs.conneg">
[2052]547   Consider a resource that is subject to content negotiation
548   (&content-negotiation;), and where the representations sent in response to
549   a GET request vary based on the <x:ref>Accept-Encoding</x:ref> request
550   header field (&header-accept-encoding;):
[1379]552<figure><preamble>>> Request:</preamble><artwork type="message/http; msgtype=&#34;request&#34;"  x:indent-with="  ">
553GET /index HTTP/1.1
555Accept-Encoding: gzip
559   In this case, the response might or might not use the gzip content coding.
560   If it does not, the response might look like:
562<figure><preamble>>> Response:</preamble><artwork type="message/http; msgtype=&#34;response&#34;"  x:indent-with="  ">
563HTTP/1.1 200 OK
[2207]564Date: Fri, 26 Mar 2010 00:05:00 GMT
[1379]565ETag: "123-a"
566Content-Length: <x:length-of target="exbody"/>
567Vary: Accept-Encoding
568Content-Type: text/plain
570<x:span anchor="exbody">Hello World!
571Hello World!
572Hello World!
573Hello World!
574Hello World!
577   An alternative representation that does use gzip content coding would be:
579<figure><preamble>>> Response:</preamble><artwork type="message/http; msgtype=&#34;response&#34;"  x:indent-with="  ">
580HTTP/1.1 200 OK
[2207]581Date: Fri, 26 Mar 2010 00:05:00 GMT
[1379]582ETag: "123-b"
583Content-Length: 43
584Vary: Accept-Encoding
585Content-Type: text/plain
586Content-Encoding: gzip
588<spanx>...binary data...</spanx></artwork></figure>
590  <t>
[1692]591    &Note; Content codings are a property of the representation,
[1604]592    so therefore an entity-tag of an encoded representation has to be distinct
[1379]593    from an unencoded representation to prevent conflicts during cache updates
594    and range requests.  In contrast, transfer codings (&transfer-codings;)
595    apply only during message transfer and do not require distinct entity-tags.
596  </t>
[2128]601<section title="When to Use Entity-tags and Last-Modified Dates" anchor="">
603   We adopt a set of rules and recommendations for origin servers,
604   clients, and caches regarding when various validator types ought to
605   be used, and for what purposes.
[2128]608   In <x:ref>200 (OK)</x:ref> responses to GET or HEAD, an origin server:
[8]609  <list style="symbols">
[874]610     <t>&SHOULD; send an entity-tag validator unless it is not feasible to
[8]611        generate one.</t>
[874]613     <t>&MAY; send a weak entity-tag instead of a strong entity-tag, if
614        performance considerations support the use of weak entity-tags,
615        or if it is unfeasible to send a strong entity-tag.</t>
[1739]617     <t>&SHOULD; send a <x:ref>Last-Modified</x:ref> value if it is feasible to
618        send one.</t>
[8]619  </list>
[2128]622   In other words, the preferred behavior for an origin server
623   is to send both a strong entity-tag and a <x:ref>Last-Modified</x:ref>
624   value in successful responses to a retrieval request.
[2128]627   A client:
[8]628  <list style="symbols">
[874]629     <t>&MUST; use that entity-tag in any cache-conditional request (using
[1739]630        <x:ref>If-Match</x:ref> or <x:ref>If-None-Match</x:ref>) if an
631        entity-tag has been provided by the origin server.</t>
[1739]633     <t>&SHOULD; use the <x:ref>Last-Modified</x:ref> value in non-subrange
634        cache-conditional requests (using <x:ref>If-Modified-Since</x:ref>)
635        if only a Last-Modified value has been provided by the origin server.</t>
[1739]637     <t>&MAY; use the <x:ref>Last-Modified</x:ref> value in subrange
638        cache-conditional requests (using <x:ref>If-Unmodified-Since</x:ref>)
639        if only a Last-Modified value has been provided by an HTTP/1.0 origin
640        server. The user agent &SHOULD; provide a way to disable this, in case
641        of difficulty.</t>
[755]643     <t>&SHOULD; use both validators in cache-conditional requests if both an
[1739]644        entity-tag and a <x:ref>Last-Modified</x:ref> value have been provided
645        by the origin server. This allows both HTTP/1.0 and HTTP/1.1 caches to
646        respond appropriately.</t>
[8]647  </list>
[1415]652<section title="Precondition Header Fields" anchor="header.field.definitions">
[117]654   This section defines the syntax and semantics of HTTP/1.1 header fields
[1253]655   for applying preconditions on requests.
[2128]656   <xref target="precedence"/> defines when the preconditions are applied and
657   the order of evaluation when more than one precondition is present.
660<section title="If-Match" anchor="header.if-match">
[1120]661  <iref primary="true" item="If-Match header field" x:for-anchor=""/>
[229]662  <x:anchor-alias value="If-Match"/>
[1757]664   The "If-Match" header field can be used to make a request method conditional
665   on the current existence or value of an entity-tag for one or more
666   representations of the target resource.
669   If-Match is generally useful for resource update requests, such as PUT
670   requests, as a means for protecting against accidental overwrites when
671   multiple clients are acting in parallel on the same resource (i.e., the
[1223]672   "lost update" problem).  An If-Match field-value of "*" places the
673   precondition on the existence of any current representation for the
674   target resource.
[1233]676<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Match"/>
677  <x:ref>If-Match</x:ref> = "*" / 1#<x:ref>entity-tag</x:ref>
[1761]680   The If-Match condition is met if and only if any of the entity-tags listed
681   in the If-Match field value match the entity-tag of the selected
[2131]682   representation using the weak comparison function (as per <xref
[1761]683   target="entity.tag.comparison"/>), or if "*" is given and any current
684   representation exists for the target resource.
[2128]687   If the condition is met, the server &MAY; perform the request method.
[1761]690   Origin servers &MUST-NOT; perform the requested method if the condition is
691   not met; instead they &MUST; respond with the <x:ref>412 (Precondition
692   Failed)</x:ref> status code.
[1696]695   Proxy servers using a cached response as the selected representation
[1761]696   &MUST-NOT; perform the requested method if the condition is not met;
697   instead, they &MUST; forward the request towards the origin server.
[8]700   Examples:
702<figure><artwork type="example">
[362]703  If-Match: "xyzzy"
704  If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
705  If-Match: *
[1253]709<section title="If-None-Match" anchor="header.if-none-match">
710  <iref primary="true" item="If-None-Match header field" x:for-anchor=""/>
711  <x:anchor-alias value="If-None-Match"/>
[1691]713   The "If-None-Match" header field can be used to make a request method
[1253]714   conditional on not matching any of the current entity-tag values for
[1757]715   representations of the target resource.
[1757]718   If-None-Match is primarily used in conditional GET requests to enable
719   efficient updates of cached information with a minimum amount of transaction
720   overhead. A client that has one or more representations previously obtained
721   from the target resource can send If-None-Match with a list of the
722   associated entity-tags in the hope of receiving a <x:ref>304 (Not
723   Modified)</x:ref> response if at least one of those representations matches
724   the selected representation.
[1691]727   If-None-Match can also be used with a value of "*" to prevent an unsafe
[1253]728   request method (e.g., PUT) from inadvertently modifying an existing
729   representation of the target resource when the client believes that
[2230]730   the resource does not have a current representation (&safe-methods;).
731   This is a variation on the "lost update" problem that might arise if more
732   than one client attempts to create an initial representation for the target
733   resource.
735<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-None-Match"/>
736  <x:ref>If-None-Match</x:ref> = "*" / 1#<x:ref>entity-tag</x:ref>
[1761]739   The If-None-Match condition is met if and only if none of the entity-tags
740   listed in the If-None-Match field value match the entity-tag of the selected
[2131]741   representation using the weak comparison function (as per <xref
[1761]742   target="entity.tag.comparison"/>), or if "*" is given and no current
743   representation exists for that resource.
[1761]746   If the condition is not met, the server &MUST-NOT; perform the requested
747   method. Instead, if the request method was GET or HEAD, the server &SHOULD;
748   respond with a <x:ref>304 (Not Modified)</x:ref> status code, including the
749   cache-related header fields (particularly <x:ref>ETag</x:ref>) of the
750   selected representation that has a matching entity-tag. For all other
751   request methods, the server &MUST; respond with a <x:ref>412 (Precondition
[2128]752   Failed)</x:ref> status code when the condition is not met.
[2128]755   If the condition is met, the server &MAY; perform the requested method and
756   &MUST; ignore any <x:ref>If-Modified-Since</x:ref> header field(s) in the
757   request. That is, if no entity-tags match, then the server &MUST-NOT; send
758   a <x:ref>304 (Not Modified)</x:ref> response.
[1253]761   Examples:
763<figure><artwork type="example">
764  If-None-Match: "xyzzy"
765  If-None-Match: W/"xyzzy"
766  If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
767  If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
768  If-None-Match: *
[8]772<section title="If-Modified-Since" anchor="header.if-modified-since">
[1120]773  <iref primary="true" item="If-Modified-Since header field" x:for-anchor=""/>
[229]774  <x:anchor-alias value="If-Modified-Since"/>
[1799]776   The "If-Modified-Since" header field can be used with GET or HEAD to make
777   the method conditional by modification date: if the selected representation
[1223]778   has not been modified since the time specified in this field, then
779   do not perform the request method; instead, respond as detailed below.
[1233]781<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Modified-Since"/>
782  <x:ref>If-Modified-Since</x:ref> = <x:ref>HTTP-date</x:ref>
785   An example of the field is:
787<figure><artwork type="example">
[362]788  If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
[1738]791   A GET method with an If-Modified-Since header field and no <x:ref>Range</x:ref>
792   header field requests that the selected representation be transferred only if
[1223]793   it has been modified since the date given by the If-Modified-Since
794   header field.
[8]795   The algorithm for determining this includes the following cases:
796  <list style="numbers">
797      <t>If the request would normally result in anything other than a
[1715]798         <x:ref>200 (OK)</x:ref> status code, or if the passed If-Modified-Since date is
[8]799         invalid, the response is exactly the same as for a normal GET.
[2074]800         A date that is later than the server's current time is
[8]801         invalid.</t>
[1223]803      <t>If the selected representation has been modified since the
804         If-Modified-Since date, the response is exactly the same as for
805         a normal GET.</t>
[1223]807      <t>If the selected representation has not been modified since a valid
[2052]808         If-Modified-Since date, the server &SHOULD; send a
[1708]809         <x:ref>304 (Not Modified)</x:ref> response.</t>
[8]810  </list>
[2099]813   The two purposes of this feature are to allow efficient updates of cached
814   information, with a minimum amount of transaction overhead, and to limit
815   the scope of a web traversal to resources that have recently changed.
818   When used for cache updates, a cache will typically use the value of the
819   cached message's <x:ref>Last-Modified</x:ref> field to generate the field
820   value of If-Modified-Since. This behavior is most interoperable for cases
821   where clocks are poorly synchronized or when the server has chosen to only
822   honor exact timestamp matches (due to a problem with Last-Modified dates
823   that appear to go "back in time" when the origin server's clock is
824   corrected or a representation is restored from an archived backup).
825   However, caches occasionally generate the field value based on other data,
826   such as the <x:ref>Date</x:ref> header field of the cached message or the
827   local clock time that the message was received, particularly when the
828   cached message does not contain a <x:ref>Last-Modified</x:ref> field.
831   When used for limiting the scope of retrieval to a recent time window, a
832   user agent will generate an If-Modified-Since field value based on either
833   its own local clock or a <x:ref>Date</x:ref> header field received from the
834   server during a past run. Origin servers that choose an exact timestamp
835   match based on the selected representation's <x:ref>Last-Modified</x:ref>
836   field will not be able to help the user agent limit its data transfers to
837   only those changed during the specified window.
840  <t>
841     &Note; If a client uses an arbitrary date in the If-Modified-Since
842     header field instead of a date taken from a <x:ref>Last-Modified</x:ref>
843     or <x:ref>Date</x:ref> header field from the origin server, the client
844     ought to be aware that its date will be interpreted according to the
845     server's understanding of time.
846  </t>
850<section title="If-Unmodified-Since" anchor="header.if-unmodified-since">
[1120]851  <iref primary="true" item="If-Unmodified-Since header field" x:for-anchor=""/>
[229]852  <x:anchor-alias value="If-Unmodified-Since"/>
[1691]854   The "If-Unmodified-Since" header field can be used to make a request
[1223]855   method conditional by modification date: if the selected representation
856   has been modified since the time specified in this field, then the
857   server &MUST-NOT; perform the requested operation and &MUST; instead
[1708]858   respond with the <x:ref>412 (Precondition Failed)</x:ref> status code.
[1223]859   If the selected representation has not been modified since the time
[2128]860   specified in this field, the server &MAY; perform the request.
[1233]862<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="If-Unmodified-Since"/>
863  <x:ref>If-Unmodified-Since</x:ref> = <x:ref>HTTP-date</x:ref>
866   An example of the field is:
868<figure><artwork type="example">
[362]869  If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
[2128]872   A server &MUST; ignore the If-Unmodified-Since header field if the
873   received value is not a valid HTTP-date.
[1260]877<section title="If-Range" anchor="header.if-range">
[1738]879   The "If-Range" header field provides a special conditional request
[1739]880   mechanism that is similar to <x:ref>If-Match</x:ref> and
[2133]881   <x:ref>If-Unmodified-Since</x:ref> but specific to range requests.
[1739]882   If-Range is defined in &header-if-range;.
[1253]888<section title="Status Code Definitions" anchor="status.code.definitions">
889<section title="304 Not Modified" anchor="status.304">
890  <iref primary="true" item="304 Not Modified (status code)" x:for-anchor=""/>
[1734]891  <x:anchor-alias value="304"/>
[1708]892  <x:anchor-alias value="304 (Not Modified)"/>
[2216]894   The <x:dfn>304 (Not Modified)</x:dfn> status code indicates that a
895   conditional GET or HEAD request has been
[2042]896   received and would have resulted in a <x:ref>200 (OK)</x:ref> response
897   if it were not for the fact that the condition has evaluated to false.
898   In other words, there is no need for the server to transfer a
899   representation of the target resource because the request indicates that
[2074]900   the client, which made the request conditional, already has a valid
901   representation; the server is therefore redirecting the client to make
[2042]902   use of that stored representation as if it were the payload of a
903   <x:ref>200 (OK)</x:ref> response.
[2099]906   The server generating a 304 response &MUST; generate any of the following
907   header fields that would have been sent in a <x:ref>200 (OK)</x:ref>
908   response to the same request:
[2066]909   <x:ref>Cache-Control</x:ref>,
910   <x:ref>Content-Location</x:ref>,
911   <x:ref>ETag</x:ref>,
[2099]912   <x:ref>Expires</x:ref>, and
913   <x:ref>Vary</x:ref>.
[1253]916   Since the goal of a 304 response is to minimize information transfer
917   when the recipient already has one or more cached representations,
[2066]918   a sender &SHOULD-NOT; generate representation metadata other
[1253]919   than the above listed fields unless said metadata exists for the
[2093]920   purpose of guiding cache updates (e.g., <x:ref>Last-Modified</x:ref> might
921   be useful if the response does not have an <x:ref>ETag</x:ref> field).
[2093]924   Requirements on a cache that receives a 304 response are defined in
925   &freshening-responses;. If the conditional request originated with an
926   outbound client, such as a user agent with its own cache sending a
927   conditional GET to a shared proxy, then the proxy &SHOULD; forward the
928   304 response to that client.
931   A 304 response cannot contain a message-body; it is always
932   terminated by the first empty line after the header fields.
936<section title="412 Precondition Failed" anchor="status.412">
937  <iref primary="true" item="412 Precondition Failed (status code)" x:for-anchor=""/>
[1708]938  <x:anchor-alias value="412 (Precondition Failed)"/>
[2128]940   The <x:dfn>412 (Precondition Failed)</x:dfn> status code indicates that one
941   or more preconditions given in the request header fields evaluated to false
942   when tested on the server. This response code allows the client to place
943   preconditions on the current resource state (its current representations
944   and metadata) and thus prevent the request method from being applied if the
945   target resource is in an unexpected state.
[2128]950<section title="Evaluation and Precedence" anchor="precedence">
[2128]952   For each conditional request, a server &MUST; evaluate the request
953   preconditions after it has successfully performed its normal request checks
954   (i.e., just before it would perform the action associated with the request
955   method). Preconditions are ignored if the server determines that an error
[2161]956   or redirect response applies before they are evaluated. Otherwise, the
957   evaluation depends on both the method semantics and the choice of
958   conditional.
[2161]961   A conditional request header field that is designed specifically for cache
962   validation, which includes <x:ref>If-None-Match</x:ref> and
963   <x:ref>If-Modified-Since</x:ref> when used in a GET or HEAD request,
964   allows cached representations to be refreshed without repeatedly
965   transferring data already held by the client. Evaluating to false is thus
966   an indication that the client can continue to use its local copy of the
967   selected representation, as indicated by the server generating a
968   <x:ref>304 (Not Modified)</x:ref> response that includes only those header
969   fields useful for refreshing the cached representation.
972   All other conditionals are intended to signal failure when the
973   precondition evaluates to false. For example, an <x:ref>If-Match</x:ref>
974   conditional sent with a state-changing method (e.g., POST, PUT, DELETE) is
975   intended to prevent the request from taking effect on the target resource
976   if the resource state does not match the expected state. In other words,
977   evaluating the condition to false means that the resource has been changed
978   by some other client, perhaps by another user attempting to edit the same
979   resource, and thus preventing the request from being applied saves the
980   client from overwriting some other client's work. This result is indicated
981   by the server generating a <x:ref>412 (Precondition Failed)</x:ref>
982   response.
985   The conditional request header fields defined by this specification are
986   ignored for request methods that never involve the selection or
987   modification of a <x:ref>selected representation</x:ref> (e.g., CONNECT,
988   OPTIONS, and TRACE). Other conditional request header fields, defined by
989   extensions to HTTP, might place conditions on the state of the target
[2165]990   resource in general, or on a group of resources. For instance, the If header
991   field in WebDAV can make a request conditional on various aspects (such
992   as locks) of multiple resources
[2164]993   (<xref target="RFC4918" x:fmt="," x:sec="10.4"/>).
[1799]996   When more than one conditional request header field is present in a request,
997   the order in which the fields are evaluated becomes important. In practice,
998   the fields defined in this document are consistently implemented in a
999   single, logical order, due to the fact that entity tags are presumed to be
1000   more accurate than date validators. For example, the only reason to send
[2128]1001   both <x:ref>If-Modified-Since</x:ref> and <x:ref>If-None-Match</x:ref> in
1002   the same GET request is to support intermediary caches that might not have
1003   implemented <x:ref>If-None-Match</x:ref>, so it makes sense to ignore the
1004   <x:ref>If-Modified-Since</x:ref> when entity tags are understood and
1005   available for the selected representation.
1008   The general rule of conditional precedence is that exact match conditions
1009   are evaluated before cache-validating conditions and, within that order,
1010   last-modified conditions are only evaluated if the corresponding
1011   entity tag condition is not present (or not applicable because the
1012   selected representation does not have an entity tag).
1015   Specifically, the fields defined by this specification are evaluated
1016   as follows:
1017   <list style="numbers">
1018     <t>When <x:ref>If-Match</x:ref> is present, evaluate it:
1019       <list style="symbols">
1020         <t>if true, continue to step 3</t>
1021         <t>if false, respond <x:ref>412 (Precondition Failed)</x:ref></t>
1022       </list>
1023     </t>
1024     <t>When <x:ref>If-Match</x:ref> is not present and
1025        <x:ref>If-Unmodified-Since</x:ref> is present, evaluate it:
1026       <list style="symbols">
1027         <t>if true, continue to step 3</t>
1028         <t>if false, respond <x:ref>412 (Precondition Failed)</x:ref></t>
1029       </list>
1030     </t>
1031     <t>When <x:ref>If-None-Match</x:ref> is present, evaluate it:
1032       <list style="symbols">
[2133]1033         <t>if true, continue to step 5</t>
[1799]1034         <t>if false for GET/HEAD, respond <x:ref>304 (Not Modified)</x:ref></t>
1035         <t>if false for other methods, respond <x:ref>412 (Precondition Failed)</x:ref></t>
1036       </list>
1037     </t>
1038     <t>When the method is GET or HEAD,
1039        <x:ref>If-None-Match</x:ref> is not present, and
1040        <x:ref>If-Modified-Since</x:ref> is present, evaluate it:
1041       <list style="symbols">
[2133]1042         <t>if true, continue to step 5</t>
[1799]1043         <t>if false, respond <x:ref>304 (Not Modified)</x:ref></t>
1044       </list>
1045     </t>
[2133]1046     <t>When the method is GET and both <x:ref>Range</x:ref> and
1047        <x:ref>If-Range</x:ref> are present, evaluate If-Range:
1048       <list style="symbols">
1049         <t>if the validator matches and the Range specification is
1050            applicable to the selected representation, respond
1051            <x:ref>206 (Partial Content)</x:ref> <xref target="Part5"/></t>
1052       </list>
1053     </t>
1054     <t>Otherwise,
1055       <list style="symbols">
[2137]1056         <t>all conditions are met, so perform the requested action and
1057            respond according to its success or failure.</t>
[2133]1058       </list>
1059     </t>
[1799]1060   </list>
1063   Any extension to HTTP/1.1 that defines additional conditional request
1064   header fields ought to define its own expectations regarding the order
1065   for evaluating such fields in relation to those defined in this document
1066   and other conditionals that might be found in practice.
[29]1070<section title="IANA Considerations" anchor="IANA.considerations">
1072<section title="Status Code Registration" anchor="status.code.registration">
1074   The HTTP Status Code Registry located at <eref target=""/>
[969]1075   shall be updated with the registrations below:
1077<?BEGININC p4-conditional.iana-status-codes ?>
1078<!--AUTOGENERATED FROM extract-status-code-defs.xslt, do not edit manually-->
1079<texttable align="left" suppress-title="true" anchor="iana.status.code.registration.table">
1080   <ttcol>Value</ttcol>
1081   <ttcol>Description</ttcol>
1082   <ttcol>Reference</ttcol>
1083   <c>304</c>
1084   <c>Not Modified</c>
1085   <c>
1086      <xref target="status.304"/>
1087   </c>
1088   <c>412</c>
1089   <c>Precondition Failed</c>
1090   <c>
1091      <xref target="status.412"/>
1092   </c>
1095<?ENDINC p4-conditional.iana-status-codes ?>
[921]1098<section title="Header Field Registration" anchor="header.field.registration">
[969]1100   The Message Header Field Registry located at <eref target=""/> shall be updated
[2046]1101   with the permanent registrations below (see <xref target="BCP90"/>):
[680]1103<?BEGININC p4-conditional.iana-headers ?>
[253]1104<!--AUTOGENERATED FROM extract-header-defs.xslt, do not edit manually-->
[290]1105<texttable align="left" suppress-title="true" anchor="iana.header.registration.table">
[253]1106   <ttcol>Header Field Name</ttcol>
1107   <ttcol>Protocol</ttcol>
1108   <ttcol>Status</ttcol>
1109   <ttcol>Reference</ttcol>
1111   <c>ETag</c>
1112   <c>http</c>
1113   <c>standard</c>
1114   <c>
1115      <xref target="header.etag"/>
1116   </c>
1117   <c>If-Match</c>
1118   <c>http</c>
1119   <c>standard</c>
1120   <c>
1121      <xref target="header.if-match"/>
1122   </c>
1123   <c>If-Modified-Since</c>
1124   <c>http</c>
1125   <c>standard</c>
1126   <c>
1127      <xref target="header.if-modified-since"/>
1128   </c>
1129   <c>If-None-Match</c>
1130   <c>http</c>
1131   <c>standard</c>
1132   <c>
1133      <xref target="header.if-none-match"/>
1134   </c>
1135   <c>If-Unmodified-Since</c>
1136   <c>http</c>
1137   <c>standard</c>
1138   <c>
1139      <xref target="header.if-unmodified-since"/>
1140   </c>
1141   <c>Last-Modified</c>
1142   <c>http</c>
1143   <c>standard</c>
1144   <c>
1145      <xref target="header.last-modified"/>
1146   </c>
[680]1149<?ENDINC p4-conditional.iana-headers ?>
[290]1151   The change controller is: "IETF ( - Internet Engineering Task Force".
1156<section title="Security Considerations" anchor="security.considerations">
[2069]1158   This section is meant to inform developers, information providers, and
1159   users of known security concerns specific to the HTTP/1.1 conditional
[2130]1160   request mechanisms. More general security considerations are addressed
1161   in HTTP messaging &messaging; and semantics &semantics;.
1164   The validators defined by this specification are not intended to ensure
1165   the validity of a representation, guard against malicious changes, or
1166   detect man-in-the-middle attacks. At best, they enable more efficient cache
1167   updates and optimistic concurrent writes when all participants are behaving
1168   nicely. At worst, the conditions will fail and the client will receive a
1169   response that is no more harmful than an HTTP exchange without conditional
1170   requests.
1173   An entity-tag can be abused in ways that create privacy risks. For example,
1174   a site might deliberately construct a semantically invalid entity-tag that
1175   is unique to the user or user agent, send it in a cacheable response with a
1176   long freshness time, and then read that entity-tag in later conditional
1177   requests as a means of re-identifying that user or user agent. Such an
1178   identifying tag would become a persistent identifier for as long as the
1179   user agent retained the original cache entry. User agents that cache
1180   representations ought to ensure that the cache is cleared or replaced
1181   whenever the user performs privacy-maintaining actions, such as clearing
1182   stored cookies or changing to a private browsing mode.
[1364]1186<section title="Acknowledgments" anchor="acks">
1188  See &acks;.
1194<references title="Normative References">
[31]1196<reference anchor="Part1">
[119]1197  <front>
[1864]1198    <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
[119]1199    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
[1106]1200      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
[119]1201      <address><email></email></address>
1202    </author>
1203    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1204      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1205      <address><email></email></address>
1206    </author>
1207    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1208  </front>
1209  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p1-messaging-&ID-VERSION;"/>
1210  <x:source href="p1-messaging.xml" basename="p1-messaging"/>
[1436]1213<reference anchor="Part2">
1214  <front>
[1864]1215    <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
[1436]1216    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
1217      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
1218      <address><email></email></address>
1219    </author>
1220    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1221      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1222      <address><email></email></address>
1223    </author>
1224    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1225  </front>
1226  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p2-semantics-&ID-VERSION;"/>
[1715]1227  <x:source href="p2-semantics.xml" basename="p2-semantics">
[1727]1228    <x:defines>2xx</x:defines>
[1734]1229    <x:defines>2xx (Successful)</x:defines>
[1715]1230    <x:defines>200 (OK)</x:defines>
[1740]1231    <x:defines>Accept-Encoding</x:defines>
1232    <x:defines>Content-Location</x:defines>
1233    <x:defines>Content-Type</x:defines>
1234    <x:defines>Date</x:defines>
1235    <x:defines>Location</x:defines>
[1860]1236    <x:defines>Vary</x:defines>
[2161]1237    <x:defines>selected representation</x:defines>
[1715]1238  </x:source>
[31]1241<reference anchor="Part5">
[119]1242  <front>
[1864]1243    <title>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title>
[119]1244    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
[1106]1245      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
[119]1246      <address><email></email></address>
1247    </author>
1248    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
1249      <organization abbrev="W3C">World Wide Web Consortium</organization>
1250      <address><email></email></address>
1251    </author>
1252    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1253      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1254      <address><email></email></address>
1255    </author>
1256    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1257  </front>
1258  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p5-range-&ID-VERSION;"/>
[1738]1259  <x:source href="p5-range.xml" basename="p5-range">
1260    <x:defines>If-Range</x:defines>
1261    <x:defines>Range</x:defines>
[2133]1262    <x:defines>206 (Partial Content)</x:defines>
[1738]1263  </x:source>
1266<reference anchor="Part6">
[119]1267  <front>
[1864]1268    <title>Hypertext Transfer Protocol (HTTP/1.1): Caching</title>
[119]1269    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
[1106]1270      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
[119]1271      <address><email></email></address>
1272    </author>
[601]1273    <author initials="M." surname="Nottingham" fullname="Mark Nottingham" role="editor">
[1915]1274      <organization>Akamai</organization>
[601]1275      <address><email></email></address>
1276    </author>
[119]1277    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
1278      <organization abbrev="greenbytes">greenbytes GmbH</organization>
1279      <address><email></email></address>
1280    </author>
1281    <date month="&ID-MONTH;" year="&ID-YEAR;"/>
1282  </front>
1283  <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-p6-cache-&ID-VERSION;"/>
[1737]1284  <x:source href="p6-cache.xml" basename="p6-cache">
[1739]1285    <x:defines>Cache-Control</x:defines>
[1737]1286    <x:defines>Expires</x:defines>
1287  </x:source>
[96]1290<reference anchor="RFC2119">
1291  <front>
1292    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
1293    <author initials="S." surname="Bradner" fullname="Scott Bradner">
1294      <organization>Harvard University</organization>
1295      <address><email></email></address>
1296    </author>
1297    <date month="March" year="1997"/>
1298  </front>
1299  <seriesInfo name="BCP" value="14"/>
1300  <seriesInfo name="RFC" value="2119"/>
[425]1303<reference anchor="RFC5234">
1304  <front>
1305    <title abbrev="ABNF for Syntax Specifications">Augmented BNF for Syntax Specifications: ABNF</title>
1306    <author initials="D." surname="Crocker" fullname="Dave Crocker" role="editor">
1307      <organization>Brandenburg InternetWorking</organization>
1308      <address>
[728]1309        <email></email>
1310      </address> 
[425]1311    </author>
1312    <author initials="P." surname="Overell" fullname="Paul Overell">
1313      <organization>THUS plc.</organization>
1314      <address>
[728]1315        <email></email>
1316      </address>
[425]1317    </author>
1318    <date month="January" year="2008"/>
1319  </front>
1320  <seriesInfo name="STD" value="68"/>
1321  <seriesInfo name="RFC" value="5234"/>
1326<references title="Informative References">
1328<reference anchor="RFC2616">
1329  <front>
1330    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
1331    <author initials="R." surname="Fielding" fullname="R. Fielding">
1332      <organization>University of California, Irvine</organization>
1333      <address><email></email></address>
1334    </author>
1335    <author initials="J." surname="Gettys" fullname="J. Gettys">
1336      <organization>W3C</organization>
1337      <address><email></email></address>
1338    </author>
1339    <author initials="J." surname="Mogul" fullname="J. Mogul">
1340      <organization>Compaq Computer Corporation</organization>
1341      <address><email></email></address>
1342    </author>
1343    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
1344      <organization>MIT Laboratory for Computer Science</organization>
1345      <address><email></email></address>
1346    </author>
1347    <author initials="L." surname="Masinter" fullname="L. Masinter">
1348      <organization>Xerox Corporation</organization>
1349      <address><email></email></address>
1350    </author>
1351    <author initials="P." surname="Leach" fullname="P. Leach">
1352      <organization>Microsoft Corporation</organization>
1353      <address><email></email></address>
1354    </author>
1355    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
1356      <organization>W3C</organization>
1357      <address><email></email></address>
1358    </author>
1359    <date month="June" year="1999"/>
1360  </front>
1361  <seriesInfo name="RFC" value="2616"/>
[2046]1364<reference anchor='BCP90'>
[253]1365  <front>
1366    <title>Registration Procedures for Message Header Fields</title>
1367    <author initials='G.' surname='Klyne' fullname='G. Klyne'>
1368      <organization>Nine by Nine</organization>
1369      <address><email></email></address>
1370    </author>
1371    <author initials='M.' surname='Nottingham' fullname='M. Nottingham'>
1372      <organization>BEA Systems</organization>
1373      <address><email></email></address>
1374    </author>
1375    <author initials='J.' surname='Mogul' fullname='J. Mogul'>
1376      <organization>HP Labs</organization>
1377      <address><email></email></address>
1378    </author>
1379    <date year='2004' month='September' />
1380  </front>
1381  <seriesInfo name='BCP' value='90' />
1382  <seriesInfo name='RFC' value='3864' />
[1251]1385<reference anchor='RFC4918'>
1386  <front>
1387    <title>HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</title>
1388    <author initials="L.M." surname="Dusseault" fullname="Lisa Dusseault" role="editor" >
1389      <organization abbrev="CommerceNet">CommerceNet</organization>
1390      <address><email></email></address>
1391    </author>
1392    <date month="June" year="2007" />
1393  </front>
1394  <seriesInfo name='RFC' value='4918' />
1398<section title="Changes from RFC 2616" anchor="changes.from.rfc.2616">
[2022]1400  The definition of validator weakness has been expanded and clarified.
1401  (<xref target="weak.and.strong.validators" />)
[2014]1404  Weak entity-tags are now allowed in all requests except range requests
1405  (Sections <xref target="weak.and.strong.validators" format="counter"/> and
[245]1406  <xref target="header.if-none-match" format="counter"/>).
[2014]1409  The <x:ref>ETag</x:ref> header field ABNF has been changed to not use
1410  quoted-string, thus avoiding escaping issues.
[2022]1411  (<xref target="header.etag" />)
[2024]1414  ETag is defined to provide an entity tag for the selected representation,
1415  thereby clarifying what it applies to in various situations (such as a
1416  PUT response).
1417  (<xref target="header.etag" />)
[2022]1420  The precedence for evaluation of conditional requests has been defined.
1421  (<xref target="precedence" />)
[1805]1425<section title="Imported ABNF" anchor="imported.abnf">
1426  <x:anchor-alias value="ALPHA"/>
1427  <x:anchor-alias value="CR"/>
1428  <x:anchor-alias value="DIGIT"/>
1429  <x:anchor-alias value="DQUOTE"/>
1430  <x:anchor-alias value="LF"/>
1431  <x:anchor-alias value="OCTET"/>
1432  <x:anchor-alias value="VCHAR"/>
1433  <x:anchor-alias value="core.rules"/>
1434  <x:anchor-alias value="obs-text"/>
1435  <x:anchor-alias value="OWS"/>
1436  <x:anchor-alias value="HTTP-date"/>
1438  The following core rules are included by
[1806]1439  reference, as defined in <xref target="RFC5234" x:fmt="of" x:sec="B.1"/>:
[1805]1440  ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls),
1441  DIGIT (decimal 0-9), DQUOTE (double quote),
1442  HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed),
1443  OCTET (any 8-bit sequence of data), SP (space), and
1444  VCHAR (any visible US-ASCII character).
1447  The rules below are defined in <xref target="Part1"/>:
1449<figure><artwork type="abnf2616">
1450  <x:ref>OWS</x:ref>           = &lt;OWS, defined in &whitespace;&gt;
1451  <x:ref>obs-text</x:ref>      = &lt;obs-text, defined in &field-components;&gt;
1454  The rules below are defined in other parts:
1456<figure><artwork type="abnf2616">
1457  <x:ref>HTTP-date</x:ref>     = &lt;HTTP-date, defined in &http-date;&gt;
[680]1461<?BEGININC p4-conditional.abnf-appendix ?>
[427]1462<section xmlns:x="" title="Collected ABNF" anchor="collected.abnf">
1464  In the collected ABNF below, list rules are expanded as per <xref target="Part1" x:rel="#notation"/>.
[427]1466<artwork type="abnf" name="p4-conditional.parsed-abnf">
[1233]1467<x:ref>ETag</x:ref> = entity-tag
[2052]1469<x:ref>HTTP-date</x:ref> = &lt;HTTP-date, defined in [Part2], Section;
[1233]1471<x:ref>If-Match</x:ref> = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS
[427]1472 entity-tag ] ) )
[1233]1473<x:ref>If-Modified-Since</x:ref> = HTTP-date
1474<x:ref>If-None-Match</x:ref> = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS
[427]1475 entity-tag ] ) )
[1233]1476<x:ref>If-Unmodified-Since</x:ref> = HTTP-date
[1233]1478<x:ref>Last-Modified</x:ref> = HTTP-date
[2044]1480<x:ref>OWS</x:ref> = &lt;OWS, defined in [Part1], Section 3.2.3&gt;
1482<x:ref>entity-tag</x:ref> = [ weak ] opaque-tag
[1470]1483<x:ref>etagc</x:ref> = "!" / %x23-7E ; '#'-'~'
1484 / obs-text
[2044]1486<x:ref>obs-text</x:ref> = &lt;obs-text, defined in [Part1], Section 3.2.6&gt;
[1470]1487<x:ref>opaque-tag</x:ref> = DQUOTE *etagc DQUOTE
[581]1489<x:ref>weak</x:ref> = %x57.2F ; W/
[680]1493<?ENDINC p4-conditional.abnf-appendix ?>
[252]1495<section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log">
[1624]1497  Changes up to the first Working Group Last Call draft are summarized
1498  in <eref target=""/>.
[1592]1501<section title="Since draft-ietf-httpbis-p4-conditional-19" anchor="changes.since.19">
[1682]1503  Closed issues:
1504  <list style="symbols">
1505    <t>
[1800]1506      <eref target=""/>:
1507      "Need to clarify eval order/interaction of conditional headers"
1508    </t>
1509    <t>
[1819]1510      <eref target=""/>:
1511      "Required headers on 304 and 206"
1512    </t>
1513    <t>
1514      <eref target=""/>:
1515      "Optionality of Conditional Request Support"
1516    </t>
1517    <t>
[1696]1518      <eref target=""/>:
1519      "ETags and Conditional Requests"
1520    </t>
1521    <t>
[1682]1522      <eref target=""/>:
1523      "ABNF requirements for recipients"
1524    </t>
[1703]1525    <t>
1526      <eref target=""/>:
1527      "Rare cases"
1528    </t>
[1761]1529    <t>
[1802]1530      <eref target=""/>:
1531      "Conditional Request Security Considerations"
1532    </t>
1533    <t>
[1800]1534      <eref target=""/>:
1535      "If-Modified-Since lacks definition for method != GET"
1536    </t>
1537    <t>
[1761]1538      <eref target=""/>:
1539      "refactor conditional header field descriptions"
1540    </t>
[1682]1541  </list>
[1807]1545<section title="Since draft-ietf-httpbis-p4-conditional-20" anchor="changes.since.20">
[1889]1547  <list style="symbols">
1548    <t>
1549      Conformance criteria and considerations regarding error handling are
1550      now defined in Part 1.
1551    </t>
1552  </list>
[1929]1556<section title="Since draft-ietf-httpbis-p4-conditional-21" anchor="changes.since.21">
[2045]1558  Closed issues:
1559  <list style="symbols">
1560    <t>
[2168]1561      <eref target=""/>:
1562      "Conditional GET text"
1563    </t>
1564    <t>
[2159]1565      <eref target=""/>:
1566      "Optionality of Conditional Request Support"
1567    </t>
1568    <t>
[2045]1569      <eref target=""/>:
1570      "unclear prose in definition of 304"
1571    </t>
[2102]1572    <t>
[2159]1573      <eref target=""/>:
1574      "ETags and Conneg"
1575    </t>
1576    <t>
1577      <eref target=""/>:
1578      "Comparison function for If-Match and If-None-Match"
1579    </t>
1580    <t>
[2102]1581      <eref target=""/>:
1582      "304 without validator"
1583    </t>
[2159]1584    <t>
1585      <eref target=""/>:
1586      "If-Match and 428"
1587    </t>
[2045]1588  </list>
[2190]1592<section title="Since draft-ietf-httpbis-p4-conditional-22" anchor="changes.since.22">
[2206]1594  Closed issues:
1595  <list style="symbols">
1596    <t>
1597      <eref target=""/>:
1598      "explain list expansion in ABNF appendices"
1599    </t>
[2207]1600    <t>
1601      <eref target=""/>:
1602      "incorrect example dates"
1603    </t>
[2206]1604  </list>
1607  Partly resolved issues:
1608  <list style="symbols">
1609    <t>
1610      <eref target=""/>:
1611      "Editorial suggestions"
1612    </t>
1613  </list>
Note: See TracBrowser for help on using the repository browser.