Changeset 1757 for draft-ietf-httpbis/latest/p4-conditional.html
- Timestamp:
- 10/07/12 19:15:16 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
draft-ietf-httpbis/latest/p4-conditional.html
r1756 r1757 968 968 <h2 id="rfc.section.3.1"><a href="#rfc.section.3.1">3.1</a> <a id="header.if-match" href="#header.if-match">If-Match</a></h2> 969 969 <p id="rfc.section.3.1.p.1">The "If-Match" header field can be used to make a request method conditional on the current existence or value of an entity-tag 970 for one or more representations of the target resource. If-Match is generally useful for resource update requests, such as 971 PUT requests, as a means for protecting against accidental overwrites when multiple clients are acting in parallel on the 972 same resource (i.e., the "lost update" problem). An If-Match field-value of "*" places the precondition on the existence of 973 any current representation for the target resource. 970 for one or more representations of the target resource. 971 </p> 972 <p id="rfc.section.3.1.p.2">If-Match is generally useful for resource update requests, such as PUT requests, as a means for protecting against accidental 973 overwrites when multiple clients are acting in parallel on the same resource (i.e., the "lost update" problem). An If-Match 974 field-value of "*" places the precondition on the existence of any current representation for the target resource. 974 975 </p> 975 976 <div id="rfc.figure.u.9"></div><pre class="inline"><span id="rfc.iref.g.7"></span> <a href="#header.if-match" class="smpl">If-Match</a> = "*" / 1#<a href="#header.etag" class="smpl">entity-tag</a> 976 </pre><p id="rfc.section.3.1.p. 3">If any of the entity-tags listed in the If-Match field value match (as per <a href="#entity.tag.comparison" title="Comparison">Section 2.3.2</a>) the entity-tag of the selected representation for the target resource, or if "*" is given and any current representation977 </pre><p id="rfc.section.3.1.p.4">If any of the entity-tags listed in the If-Match field value match (as per <a href="#entity.tag.comparison" title="Comparison">Section 2.3.2</a>) the entity-tag of the selected representation for the target resource, or if "*" is given and any current representation 977 978 exists for the target resource, then the server <em class="bcp14">MAY</em> perform the request method as if the If-Match header field was not present. 978 979 </p> 979 <p id="rfc.section.3.1.p. 4">Origin servers <em class="bcp14">MUST NOT</em> perform the requested method if none of the entity-tags match, or if "*" is given and no current representation exists; instead980 <p id="rfc.section.3.1.p.5">Origin servers <em class="bcp14">MUST NOT</em> perform the requested method if none of the entity-tags match, or if "*" is given and no current representation exists; instead 980 981 they <em class="bcp14">MUST</em> respond with the <a href="#status.412" class="smpl">412 (Precondition Failed)</a> status code. 981 982 </p> 982 <p id="rfc.section.3.1.p. 5">Proxy servers using a cached response as the selected representation <em class="bcp14">MUST NOT</em> perform the requested method if none of the entity-tags match, or if "*" is given and no current representation exists; instead,983 <p id="rfc.section.3.1.p.6">Proxy servers using a cached response as the selected representation <em class="bcp14">MUST NOT</em> perform the requested method if none of the entity-tags match, or if "*" is given and no current representation exists; instead, 983 984 they <em class="bcp14">MUST</em> forward the request towards the origin server. 984 985 </p> 985 <p id="rfc.section.3.1.p. 6">If the request would, without the If-Match header field, result in anything other than a <a href="p2-semantics.html#status.2xx" class="smpl">2xx (Successful)</a> or <a href="#status.412" class="smpl">412 (Precondition Failed)</a> status code, then the If-Match header field <em class="bcp14">MUST</em> be ignored.986 </p> 987 <p id="rfc.section.3.1.p. 7">Examples:</p>986 <p id="rfc.section.3.1.p.7">If the request would, without the If-Match header field, result in anything other than a <a href="p2-semantics.html#status.2xx" class="smpl">2xx (Successful)</a> or <a href="#status.412" class="smpl">412 (Precondition Failed)</a> status code, then the If-Match header field <em class="bcp14">MUST</em> be ignored. 987 </p> 988 <p id="rfc.section.3.1.p.8">Examples:</p> 988 989 <div id="rfc.figure.u.10"></div><pre class="text"> If-Match: "xyzzy" 989 990 If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz" 990 991 If-Match: * 991 </pre><p id="rfc.section.3.1.p. 9">The result of a request having both an If-Match header field and either an <a href="#header.if-none-match" class="smpl">If-None-Match</a> or an <a href="#header.if-modified-since" class="smpl">If-Modified-Since</a> header field is undefined by this specification.992 </pre><p id="rfc.section.3.1.p.10">The result of a request having both an If-Match header field and either an <a href="#header.if-none-match" class="smpl">If-None-Match</a> or an <a href="#header.if-modified-since" class="smpl">If-Modified-Since</a> header field is undefined by this specification. 992 993 </p> 993 994 <div id="rfc.iref.i.2"></div> … … 995 996 <h2 id="rfc.section.3.2"><a href="#rfc.section.3.2">3.2</a> <a id="header.if-none-match" href="#header.if-none-match">If-None-Match</a></h2> 996 997 <p id="rfc.section.3.2.p.1">The "If-None-Match" header field can be used to make a request method conditional on not matching any of the current entity-tag 997 values for representations of the target resource. If-None-Match is primarily used in conditional GET requests to enable efficient 998 updates of cached information with a minimum amount of transaction overhead. A client that has one or more representations 999 previously obtained from the target resource can send If-None-Match with a list of the associated entity-tags in the hope 1000 of receiving a <a href="#status.304" class="smpl">304 (Not Modified)</a> response if at least one of those representations matches the selected representation. 1001 </p> 1002 <p id="rfc.section.3.2.p.2">If-None-Match can also be used with a value of "*" to prevent an unsafe request method (e.g., PUT) from inadvertently modifying 998 values for representations of the target resource. 999 </p> 1000 <p id="rfc.section.3.2.p.2">If-None-Match is primarily used in conditional GET requests to enable efficient updates of cached information with a minimum 1001 amount of transaction overhead. A client that has one or more representations previously obtained from the target resource 1002 can send If-None-Match with a list of the associated entity-tags in the hope of receiving a <a href="#status.304" class="smpl">304 (Not 1003 Modified)</a> response if at least one of those representations matches the selected representation. 1004 </p> 1005 <p id="rfc.section.3.2.p.3">If-None-Match can also be used with a value of "*" to prevent an unsafe request method (e.g., PUT) from inadvertently modifying 1003 1006 an existing representation of the target resource when the client believes that the resource does not have a current representation. 1004 1007 This is a variation on the "lost update" problem that might arise if more than one client attempts to create an initial representation … … 1006 1009 </p> 1007 1010 <div id="rfc.figure.u.11"></div><pre class="inline"><span id="rfc.iref.g.8"></span> <a href="#header.if-none-match" class="smpl">If-None-Match</a> = "*" / 1#<a href="#header.etag" class="smpl">entity-tag</a> 1008 </pre><p id="rfc.section.3.2.p. 4">If any of the entity-tags listed in the If-None-Match field-value match (as per <a href="#entity.tag.comparison" title="Comparison">Section 2.3.2</a>) the entity-tag of the selected representation, or if "*" is given and any current representation exists for that resource,1011 </pre><p id="rfc.section.3.2.p.5">If any of the entity-tags listed in the If-None-Match field-value match (as per <a href="#entity.tag.comparison" title="Comparison">Section 2.3.2</a>) the entity-tag of the selected representation, or if "*" is given and any current representation exists for that resource, 1009 1012 then the server <em class="bcp14">MUST NOT</em> perform the requested method. Instead, if the request method was GET or HEAD, the server <em class="bcp14">SHOULD</em> respond with a <a href="#status.304" class="smpl">304 (Not Modified)</a> status code, including the cache-related header fields (particularly <a href="#header.etag" class="smpl">ETag</a>) of the selected representation that has a matching entity-tag. For all other request methods, the server <em class="bcp14">MUST</em> respond with a <a href="#status.412" class="smpl">412 (Precondition Failed)</a> status code. 1010 1013 </p> 1011 <p id="rfc.section.3.2.p. 5">If none of the entity-tags match, then the server <em class="bcp14">MAY</em> perform the requested method as if the If-None-Match header field did not exist, but <em class="bcp14">MUST</em> also ignore any <a href="#header.if-modified-since" class="smpl">If-Modified-Since</a> header field(s) in the request. That is, if no entity-tags match, then the server <em class="bcp14">MUST NOT</em> return a <a href="#status.304" class="smpl">304 (Not Modified)</a> response.1012 </p> 1013 <p id="rfc.section.3.2.p. 6">If the request would, without the If-None-Match header field, result in anything other than a <a href="p2-semantics.html#status.2xx" class="smpl">2xx (Successful)</a> or <a href="#status.304" class="smpl">304 (Not Modified)</a> status code, then the If-None-Match header field <em class="bcp14">MUST</em> be ignored. (See <a href="#rules.for.when.to.use.entity.tags.and.last-modified.dates" title="Rules for When to Use Entity-tags and Last-Modified Dates">Section 2.4</a> for a discussion of server behavior when both <a href="#header.if-modified-since" class="smpl">If-Modified-Since</a> and If-None-Match appear in the same request.)1014 </p> 1015 <p id="rfc.section.3.2.p. 7">Examples:</p>1014 <p id="rfc.section.3.2.p.6">If none of the entity-tags match, then the server <em class="bcp14">MAY</em> perform the requested method as if the If-None-Match header field did not exist, but <em class="bcp14">MUST</em> also ignore any <a href="#header.if-modified-since" class="smpl">If-Modified-Since</a> header field(s) in the request. That is, if no entity-tags match, then the server <em class="bcp14">MUST NOT</em> return a <a href="#status.304" class="smpl">304 (Not Modified)</a> response. 1015 </p> 1016 <p id="rfc.section.3.2.p.7">If the request would, without the If-None-Match header field, result in anything other than a <a href="p2-semantics.html#status.2xx" class="smpl">2xx (Successful)</a> or <a href="#status.304" class="smpl">304 (Not Modified)</a> status code, then the If-None-Match header field <em class="bcp14">MUST</em> be ignored. (See <a href="#rules.for.when.to.use.entity.tags.and.last-modified.dates" title="Rules for When to Use Entity-tags and Last-Modified Dates">Section 2.4</a> for a discussion of server behavior when both <a href="#header.if-modified-since" class="smpl">If-Modified-Since</a> and If-None-Match appear in the same request.) 1017 </p> 1018 <p id="rfc.section.3.2.p.8">Examples:</p> 1016 1019 <div id="rfc.figure.u.12"></div><pre class="text"> If-None-Match: "xyzzy" 1017 1020 If-None-Match: W/"xyzzy" … … 1019 1022 If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz" 1020 1023 If-None-Match: * 1021 </pre><p id="rfc.section.3.2.p. 9">The result of a request having both an If-None-Match header field and either an <a href="#header.if-match" class="smpl">If-Match</a> or an <a href="#header.if-unmodified-since" class="smpl">If-Unmodified-Since</a> header field is undefined by this specification.1024 </pre><p id="rfc.section.3.2.p.10">The result of a request having both an If-None-Match header field and either an <a href="#header.if-match" class="smpl">If-Match</a> or an <a href="#header.if-unmodified-since" class="smpl">If-Unmodified-Since</a> header field is undefined by this specification. 1022 1025 </p> 1023 1026 <div id="rfc.iref.i.3"></div>
Note: See TracChangeset
for help on using the changeset viewer.