Ignore:
Timestamp:
24/09/13 00:36:40 (7 years ago)
Author:
fielding@…
Message:

The changes in [2361] and [2372] to address #479 had the unfortunate effect of making most caches noncompliant; this change removes the need for caches to process If-Match and If-Unmodified-Since and reduces the precondition evaluation to checking the stored response already selected by the cache

File:
1 edited

Legend:

Unmodified
Added
Removed
  • draft-ietf-httpbis/latest/p6-cache.html

    r2407 r2408  
    10501050      </p>
    10511051      <h3 id="rfc.section.4.3.2"><a href="#rfc.section.4.3.2">4.3.2</a>&nbsp;<a id="validation.received" href="#validation.received">Handling a Received Validation Request</a></h3>
    1052       <p id="rfc.section.4.3.2.p.1">Each client in the request chain may have its own cache, so it is common for a cache at an intermediary or origin server to
    1053          receive conditional requests from other (outbound) caches. Likewise, some user agents make use of conditional requests to
    1054          limit data transfers to recently modified representations or to complete the transfer of partially retrieved representations.
    1055       </p>
    1056       <p id="rfc.section.4.3.2.p.2">If the request semantics can be satisfied with a cached response and a recipient cache has at least one response stored for
    1057          this primary cache key, the cache <em class="bcp14">MUST</em> evaluate received precondition header fields as part of its selection process for determining a suitable response. A cache <em class="bcp14">MUST NOT</em> evaluate received precondition header fields in a request with semantics that cannot be satisfied with a cached response,
    1058          or for which the cache has no prior stored responses, since such preconditions are intended for some other (inbound) server.
     1052      <p id="rfc.section.4.3.2.p.1">Each client in the request chain may have its own cache, so it is common for a cache at an intermediary to receive conditional
     1053         requests from other (outbound) caches. Likewise, some user agents make use of conditional requests to limit data transfers
     1054         to recently modified representations or to complete the transfer of a partially retrieved representation.
     1055      </p>
     1056      <p id="rfc.section.4.3.2.p.2">If a cache receives a request that can be satisfied by reusing one of its stored <a href="p2-semantics.html#status.200" class="smpl">200 (OK)</a> or <a href="p5-range.html#status.206" class="smpl">206 (Partial Content)</a> responses, the cache <em class="bcp14">SHOULD</em> evaluate any applicable conditional header field preconditions received in that request with respect to the corresponding
     1057         validators contained within the selected response. A cache <em class="bcp14">MUST NOT</em> evaluate conditional header fields that are only applicable to an origin server, found in a request with semantics that cannot
     1058         be satisfied with a cached response, or applied to a target resource for which it has no stored responses; such preconditions
     1059         are likely intended for some other (inbound) server.
    10591060      </p>
    10601061      <p id="rfc.section.4.3.2.p.3">The proper evaluation of conditional requests by a cache depends on the received precondition header fields and their precedence,
    1061          as defined in <a href="p4-conditional.html#precedence" title="Precedence">Section 6</a> of <a href="#Part4" id="rfc.xref.Part4.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[Part4]</cite></a>.
    1062       </p>
    1063       <p id="rfc.section.4.3.2.p.4">A request containing an <a href="p4-conditional.html#header.if-match" class="smpl">If-Match</a> header field (<a href="p4-conditional.html#header.if-match" title="If-Match">Section 3.1</a> of <a href="#Part4" id="rfc.xref.Part4.6"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[Part4]</cite></a>) indicates that the client wants to receive an error response if the cache has a stored response that cannot be used to answer
    1064          this request. The cache <em class="bcp14">MUST</em> generate a <a href="p4-conditional.html#status.412" class="smpl">412 (Precondition Failed)</a> response if the field-value is "*" and no suitable response is stored, or if the field-value is a list of entity-tags and
    1065          none of them match the entity-tag of a suitable stored response. Otherwise, the cache <em class="bcp14">MUST</em> generate a <a href="p2-semantics.html#status.2xx" class="smpl">2xx (Successful)</a> response that reuses the most recent of its matching stored responses to satisfy the request.
    1066       </p>
    1067       <p id="rfc.section.4.3.2.p.5">A request containing an <a href="p4-conditional.html#header.if-unmodified-since" class="smpl">If-Unmodified-Since</a> header field (<a href="p4-conditional.html#header.if-unmodified-since" title="If-Unmodified-Since">Section 3.4</a> of <a href="#Part4" id="rfc.xref.Part4.7"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[Part4]</cite></a>) indicates that the client wants to receive an error response if the cache has a stored response that cannot be used to answer
    1068          this request. The cache <em class="bcp14">MUST</em> generate a <a href="p4-conditional.html#status.412" class="smpl">412 (Precondition Failed)</a> response if one of the following is true: 1) a stored response has a <a href="p4-conditional.html#header.last-modified" class="smpl">Last-Modified</a> field-value that is more recent than the conditional timestamp; 2) no <a href="p4-conditional.html#header.last-modified" class="smpl">Last-Modified</a> field is present, but a stored response has a <a href="p2-semantics.html#header.date" class="smpl">Date</a> field-value that is more recent than the conditional timestamp; or, 3) neither <a href="p4-conditional.html#header.last-modified" class="smpl">Last-Modified</a> nor <a href="p2-semantics.html#header.date" class="smpl">Date</a> is present, but the cache recorded a stored response as having been received at a time more recent than the conditional timestamp.
    1069          Otherwise, the cache <em class="bcp14">MUST</em> generate a <a href="p2-semantics.html#status.2xx" class="smpl">2xx (Successful)</a> response that reuses the most recent of its matching stored responses to satisfy the request.
    1070       </p>
    1071       <p id="rfc.section.4.3.2.p.6">A request containing an <a href="p4-conditional.html#header.if-none-match" class="smpl">If-None-Match</a> header field (<a href="p4-conditional.html#header.if-none-match" title="If-None-Match">Section 3.2</a> of <a href="#Part4" id="rfc.xref.Part4.8"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[Part4]</cite></a>) indicates that the client wants to validate one or more of its stored responses. If the field-value is "*" and any suitable
    1072          response is stored, or the field-value is a list of entity-tags and at least one of them match the entity-tag of a suitable
    1073          stored response, the cache <em class="bcp14">MUST</em> generate a <a href="p4-conditional.html#status.304" class="smpl">304 (Not Modified)</a> response using the most suitable of those matching responses as the selected representation. Otherwise, if the cache has one
    1074          or more suitable stored responses that do not match the condition, the cache <em class="bcp14">MUST</em> generate a <a href="p2-semantics.html#status.2xx" class="smpl">2xx (Successful)</a> response that reuses the most suitable of those stored responses to satisfy the request. Finally, if the cache has no suitable
    1075          stored responses, the cache <em class="bcp14">SHOULD</em> forward the conditional request toward the origin server; if the received condition contains a list of entity-tags and the
    1076          cache has its own set of stored responses for that primary cache key, the cache <em class="bcp14">SHOULD</em> take the union of the received set with the set of entity-tags for its own stored set of responses (fresh or stale) and generate
    1077          an <a href="p4-conditional.html#header.if-none-match" class="smpl">If-None-Match</a> header field containing that union when it forwards the request toward the origin server. However, if a stored response contains
    1078          only partial content, the cache <em class="bcp14">MUST NOT</em> include its entity-tag in the union unless the request is for a range that would be fully satisfied by that stored response.
    1079       </p>
    1080       <p id="rfc.section.4.3.2.p.7">A request containing an <a href="p4-conditional.html#header.if-modified-since" class="smpl">If-Modified-Since</a> header field (<a href="p4-conditional.html#header.if-modified-since" title="If-Modified-Since">Section 3.3</a> of <a href="#Part4" id="rfc.xref.Part4.9"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[Part4]</cite></a>) indicates that the client wants to validate one or more of its stored responses by modification date if the stored responses
    1081          have no entity-tag or the recipient does not implement <a href="p4-conditional.html#header.if-none-match" class="smpl">If-None-Match</a>. The cache <em class="bcp14">MUST</em> generate a <a href="p2-semantics.html#status.2xx" class="smpl">2xx (Successful)</a> response, reusing the most recent of its stored responses to satisfy the request, if one of the following is true: 1) a stored
    1082          response has a <a href="p4-conditional.html#header.last-modified" class="smpl">Last-Modified</a> field-value that is more recent than the conditional timestamp; 2) no <a href="p4-conditional.html#header.last-modified" class="smpl">Last-Modified</a> field is present, but a stored response has a <a href="p2-semantics.html#header.date" class="smpl">Date</a> field-value that is more recent than the conditional timestamp; or, 3) neither <a href="p4-conditional.html#header.last-modified" class="smpl">Last-Modified</a> nor <a href="p2-semantics.html#header.date" class="smpl">Date</a> is present, but the cache recorded a stored response as having been received at a time more recent than the conditional timestamp.
    1083          Otherwise, if the cache has one or more suitable stored responses, the cache <em class="bcp14">MUST</em> generate a <a href="p4-conditional.html#status.304" class="smpl">304 (Not Modified)</a> response using the most recent of its suitable stored responses as the selected representation. Finally, if the cache has
    1084          no suitable stored responses, the cache <em class="bcp14">SHOULD</em> forward the conditional request toward the origin server.
    1085       </p>
    1086       <p id="rfc.section.4.3.2.p.8">A cache that implements partial responses to range requests, as defined in <a href="#Part5" id="rfc.xref.Part5.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[Part5]</cite></a>, also needs to evaluate a received <a href="p5-range.html#header.if-range" class="smpl">If-Range</a> header field (<a href="p5-range.html#header.if-range" title="If-Range">Section 3.2</a> of <a href="#Part5" id="rfc.xref.Part5.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[Part5]</cite></a>) in respect to its selected stored response.
     1062         as defined in <a href="p4-conditional.html#precedence" title="Precedence">Section 6</a> of <a href="#Part4" id="rfc.xref.Part4.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[Part4]</cite></a>. The <a href="p4-conditional.html#header.if-match" class="smpl">If-Match</a> and <a href="p4-conditional.html#header.if-unmodified-since" class="smpl">If-Unmodified-Since</a> conditional header fields are not applicable to a cache.
     1063      </p>
     1064      <p id="rfc.section.4.3.2.p.4">A request containing an <a href="p4-conditional.html#header.if-none-match" class="smpl">If-None-Match</a> header field (<a href="p4-conditional.html#header.if-none-match" title="If-None-Match">Section 3.2</a> of <a href="#Part4" id="rfc.xref.Part4.6"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[Part4]</cite></a>) indicates that the client wants to validate one or more of its own stored responses in comparison to whichever stored response
     1065         is selected by the cache. If the field-value is "*", or if the field-value is a list of entity-tags and at least one of them
     1066         match the entity-tag of the selected stored response, a cache recipient <em class="bcp14">SHOULD</em> generate a <a href="p4-conditional.html#status.304" class="smpl">304 (Not Modified)</a> response (using the metadata of the selected stored response) instead of sending that stored response.
     1067      </p>
     1068      <p id="rfc.section.4.3.2.p.5">When a cache decides to revalidate its own stored responses for a request that contains an <a href="p4-conditional.html#header.if-none-match" class="smpl">If-None-Match</a> list of entity-tags, the cache <em class="bcp14">MAY</em> combine the received list with a list of entity-tags from its own stored set of responses (fresh or stale) and send the union
     1069         of the two lists as a replacement <a href="p4-conditional.html#header.if-none-match" class="smpl">If-None-Match</a> header field value in the forwarded request. If a stored response contains only partial content, the cache <em class="bcp14">MUST NOT</em> include its entity-tag in the union unless the request is for a range that would be fully satisfied by that partial stored
     1070         response. If the response to the forwarded request is <a href="p4-conditional.html#status.304" class="smpl">304 (Not Modified)</a> and has an ETag header field value with an entity-tag that is not in the client's list, the cache <em class="bcp14">MUST</em> generate a <a href="p2-semantics.html#status.200" class="smpl">200 (OK)</a> response for the client by reusing its corresponding stored response, as updated by the 304 response metadata (<a href="#freshening.responses" title="Freshening Stored Responses upon Validation">Section&nbsp;4.3.4</a>).
     1071      </p>
     1072      <p id="rfc.section.4.3.2.p.6">If an <a href="p4-conditional.html#header.if-none-match" class="smpl">If-None-Match</a> header field is not present, a request containing an <a href="p4-conditional.html#header.if-modified-since" class="smpl">If-Modified-Since</a> header field (<a href="p4-conditional.html#header.if-modified-since" title="If-Modified-Since">Section 3.3</a> of <a href="#Part4" id="rfc.xref.Part4.7"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[Part4]</cite></a>) indicates that the client wants to validate one or more of its own stored responses by modification date. A cache recipient <em class="bcp14">SHOULD</em> generate a <a href="p4-conditional.html#status.304" class="smpl">304 (Not Modified)</a> response (using the metadata of the selected stored response) if one of the following cases is true: 1) the selected stored
     1073         response has a <a href="p4-conditional.html#header.last-modified" class="smpl">Last-Modified</a> field-value that is earlier than or equal to the conditional timestamp; 2) no <a href="p4-conditional.html#header.last-modified" class="smpl">Last-Modified</a> field is present in the selected stored response, but it has a <a href="p2-semantics.html#header.date" class="smpl">Date</a> field-value that is earlier than or equal to the conditional timestamp; or, 3) neither <a href="p4-conditional.html#header.last-modified" class="smpl">Last-Modified</a> nor <a href="p2-semantics.html#header.date" class="smpl">Date</a> is present in the selected stored response, but the cache recorded it as having been received at a time earlier than or equal
     1074         to the conditional timestamp.
     1075      </p>
     1076      <p id="rfc.section.4.3.2.p.7">A cache that implements partial responses to range requests, as defined in <a href="#Part5" id="rfc.xref.Part5.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[Part5]</cite></a>, also needs to evaluate a received <a href="p5-range.html#header.if-range" class="smpl">If-Range</a> header field (<a href="p5-range.html#header.if-range" title="If-Range">Section 3.2</a> of <a href="#Part5" id="rfc.xref.Part5.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[Part5]</cite></a>) with respect to its selected stored response.
    10871077      </p>
    10881078      <h3 id="rfc.section.4.3.3"><a href="#rfc.section.4.3.3">4.3.3</a>&nbsp;<a id="validation.response" href="#validation.response">Handling a Validation Response</a></h3>
     
    11061096      <p id="rfc.section.4.3.4.p.2">The stored response to update is identified by using the first match (if any) of: </p>
    11071097      <ul>
    1108          <li>If the new response contains a <dfn>strong validator</dfn> (see <a href="p4-conditional.html#weak.and.strong.validators" title="Weak versus Strong">Section 2.1</a> of <a href="#Part4" id="rfc.xref.Part4.10"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[Part4]</cite></a>), then that strong validator identifies the selected representation for update. All of the stored responses with the same
     1098         <li>If the new response contains a <dfn>strong validator</dfn> (see <a href="p4-conditional.html#weak.and.strong.validators" title="Weak versus Strong">Section 2.1</a> of <a href="#Part4" id="rfc.xref.Part4.8"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[Part4]</cite></a>), then that strong validator identifies the selected representation for update. All of the stored responses with the same
    11091099            strong validator are selected. If none of the stored responses contain the same strong validator, then the cache <em class="bcp14">MUST NOT</em> use the new response to update any stored responses.
    11101100         </li>
     
    21812171                     </ul>
    21822172                  </li>
    2183                   <li><em>Part4</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.1">4.2.2</a>, <a href="#rfc.xref.Part4.2">4.3</a>, <a href="#rfc.xref.Part4.3">4.3.1</a>, <a href="#rfc.xref.Part4.4">4.3.1</a>, <a href="#rfc.xref.Part4.5">4.3.2</a>, <a href="#rfc.xref.Part4.6">4.3.2</a>, <a href="#rfc.xref.Part4.7">4.3.2</a>, <a href="#rfc.xref.Part4.8">4.3.2</a>, <a href="#rfc.xref.Part4.9">4.3.2</a>, <a href="#rfc.xref.Part4.10">4.3.4</a>, <a href="#Part4"><b>10.1</b></a><ul>
    2184                         <li><em>Section 2.1</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.10">4.3.4</a></li>
     2173                  <li><em>Part4</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.1">4.2.2</a>, <a href="#rfc.xref.Part4.2">4.3</a>, <a href="#rfc.xref.Part4.3">4.3.1</a>, <a href="#rfc.xref.Part4.4">4.3.1</a>, <a href="#rfc.xref.Part4.5">4.3.2</a>, <a href="#rfc.xref.Part4.6">4.3.2</a>, <a href="#rfc.xref.Part4.7">4.3.2</a>, <a href="#rfc.xref.Part4.8">4.3.4</a>, <a href="#Part4"><b>10.1</b></a><ul>
     2174                        <li><em>Section 2.1</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.8">4.3.4</a></li>
    21852175                        <li><em>Section 2.2</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.1">4.2.2</a>, <a href="#rfc.xref.Part4.3">4.3.1</a></li>
    21862176                        <li><em>Section 2.3</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.4">4.3.1</a></li>
    2187                         <li><em>Section 3.1</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.6">4.3.2</a></li>
    2188                         <li><em>Section 3.2</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.8">4.3.2</a></li>
    2189                         <li><em>Section 3.3</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.9">4.3.2</a></li>
    2190                         <li><em>Section 3.4</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.7">4.3.2</a></li>
     2177                        <li><em>Section 3.2</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.6">4.3.2</a></li>
     2178                        <li><em>Section 3.3</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.7">4.3.2</a></li>
    21912179                        <li><em>Section 6</em>&nbsp;&nbsp;<a href="#rfc.xref.Part4.5">4.3.2</a></li>
    21922180                     </ul>
Note: See TracChangeset for help on using the changeset viewer.