One document matched: draft-snell-http-prefer-06.xml
<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc2616 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml'>
<!ENTITY rfc4918 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4918.xml'>
<!ENTITY rfc2119 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
<!ENTITY rfc3864 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.3864.xml'>
<!ENTITY rfc5226 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5226.xml'>
<!ENTITY rfc2026 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2026.xml'>
<!ENTITY rfc5234 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5234.xml'>
<!ENTITY part1 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-httpbis-p1-messaging-17.xml'>
<!ENTITY part2 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-httpbis-p2-semantics-17.xml'>
<!ENTITY part3 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-httpbis-p3-payload-17.xml'>
<!ENTITY part4 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-httpbis-p4-conditional-17.xml'>
<!ENTITY part5 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-httpbis-p5-range-17.xml'>
<!ENTITY part6 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-httpbis-p6-cache-17.xml'>
<!ENTITY part7 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-httpbis-p7-auth-17.xml'>
]>
<?rfc toc="yes"?>
<?rfc strict="yes"?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<rfc category="info" ipr="trust200811" docName="draft-snell-http-prefer-06">
<front>
<title abbrev="HTTP Prefer">
Prefer Header for HTTP
</title>
<author initials="J.M." surname="Snell" fullname="James M Snell">
<organization></organization>
<address>
<postal>
<street></street>
<city></city> <region></region> <code></code>
<country></country>
</postal>
<phone></phone>
<email>jasnell@gmail.com</email>
<uri></uri>
</address>
</author>
<date month="December" year="2011" />
<area>Applications</area>
<workgroup>Individual Submission</workgroup>
<keyword>I-D</keyword>
<keyword>http</keyword>
<keyword>prefer</keyword>
<abstract>
<t>This specification defines an HTTP header field that can be
used by a client to request that certain behaviors be implemented
by a server while processing a request.</t>
</abstract>
</front>
<middle>
<section anchor="intro" title="Introduction">
<t>This specification defines a new HTTP request header field that may be
used by clients to request optional behaviors be applied
by a server during the processing the request.</t>
<t>In this document, the key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
"SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL"
are to be interpreted as described in <xref target="RFC2119" />.</t>
<section title="Syntax Notation">
<t>This specification uses the Augmented Backus-Naur Form (ABNF)
notation of <xref target="RFC5234"/> and includes, by reference,
the "token", "quoted-string", "OWS", "BWS" rules and the #rule
extension as defined within <xref target="I-D.ietf-httpbis-p1-messaging"/>
Section 1.2.</t>
</section>
</section>
<section title="The Prefer Request Header" anchor="prefer">
<t>The Prefer request-header field is used to indicate that particular
server behaviors are preferred by the client, but not required for
successful completion of the request. Prefer is similar in nature to the
Expect header field defined by <xref target="I-D.ietf-httpbis-p2-semantics"/>
Section 9.3 with the exception that servers are allowed to ignore stated preferences.</t>
<figure><artwork>
Prefer = "Prefer" ":" 1#preference
preference = token [ BWS "=" BWS value ]
*( OWS ";" [ OWS parameter ] )
parameter = token [ BWS "=" BWS value ]
value = token / quoted-string
</artwork></figure>
<t>This header field is defined with an extensible syntax to allow for future
values included in the <xref target="registry">Registry of Preferences</xref>).
A server that does not recognize or is unable to comply with particular
preference tokens in the Prefer header field of a request MUST ignore those tokens
and MUST NOT stop processing or signal an error.</t>
<t>A preference token MAY specify a value. Empty, or zero
length values on both the preference token and within parameters are
equivalent to no value being specified at all. The following, then, are
equivalent:</t>
<figure><artwork>
Prefer: foo; bar=""
Prefer: foo=; bar
Prefer: foo=""; bar=
</artwork></figure>
<t>An optional, arbitrary collection of parameters MAY be specified for
any preference token. The meaning and application of such parameters is
dependent on the definition of each preference token and the server's
implementation thereof.</t>
<t>If a particular preference token or parameter is specified multiple
times, repeated occurrences MUST be ignored without signaling an error or
otherwise altering the processing of the request. </t>
<t>Comparison of preference token names is case-insensitive while values
are case-sensitive regardless of whether token or quoted-string values
are used.</t>
<t>Note that the application of a preference by the server MAY affect
the caching characteristics of the response. Specifically, should the
application of a preference result in a variance to the representation
returned by a cacheable response, a Vary header field MUST be included
listing the Prefer header field as one of the selecting header fields.</t>
<t>The Prefer request header field MUST be forwarded by the proxy if the
request is forwarded. In various situations, A proxy may determine
that it is capable of honoring a preference independently of the server
to which the request is directed. For instance, an intervening proxy
may be capable of transparently providing asynchronous handling of a
request using a 202 Accepted responses independently of the origin server.
Such proxies could choose to honor the "return-accepted" preference.
Individual preference tokens MAY define their own requirements and
restrictions as to whether and how proxies may apply the preference to
a request independently of the origin server.</t>
<t>As per <xref target="I-D.ietf-httpbis-p1-messaging"/>, Section 3.2,
Implementations MUST be capable of supporting either multiple instances
of the Prefer header field in a single message as well as multiple preference
tokens separated by commas in a single Prefer header, for instance, the
following examples are equivalent:</t>
<figure><artwork>
# Multiple Prefer Header Fields
POST /foo HTTP/1.1
Host: example.org
Prefer: return-accepted
Prefer: wait=100
# Single Prefer Header Field
POST /foo HTTP/1.1
Host: example.org
Prefer: return-accepted, wait=100
</artwork></figure>
<section title="Examples">
<t>The following examples illustrate the use of various Preferences
defined by this specification, as well as undefined extensions for
strictly illustrative purposes:</t>
<figure><artwork>
# Return a 202 Accepted response for asynchronous processing
# if the response cannot be processed within 10 seconds.
# An undefined "priority" preference is also specified.
Prefer: return-accepted;
Prefer: wait=10;
Prefer: priority=5;
# Use lenient processing, a reporting detail level of 10,
# and return an entity describing the status of the request
# rather than a representation of the resource
Prefer: Lenient, Detail=10, Return-Status
# Use of an optional, undefined parameter on the
# return-minimal preference requesting a response
# status code of 204 for a successful response.
Prefer: return-minimal; status=204
</artwork></figure>
</section>
</section>
<section title="The Preference-Applied Response Header" anchor="preference-applied">
<t>The Preference-Applied response header MAY be included within a
response message as an indication as to which Prefer tokens were
honored by the server and applied to the processing of the request.</t>
<figure><artwork>
Preference-Applied = "Preference-Applied" ":" 1#token
</artwork></figure>
<t>Note that the syntax of the Preference-Applied header differs from
that of the Prefer header in that token values and parameters are not
included.</t>
<t>Use of the Preference-Applied header is not required in all cases.
For instance, when using the return-accepted, return-minimal or wait
preferences, as defined below, the application of the preference will
be apparent based on the context and nature of the response. However,
there are cases in which the application of a preference cannot be
easily determined by the client. For instance, when posting a resource
to a server using either the return-representation or return-status
preferences, a client cannot be certain in all cases whether the returned
entity is a representation of the modified resource or a representation
of the request status. In such situations, where the nature of the response
is ambiguous and a clear preference has been stated by the client using
the Prefer request header field, the Preference-Applied response header
field SHOULD be used.</t>
<t>For example, here a request is sent to the server requesting the
return of the resource representation.</t>
<figure><artwork>
#Request
POST /collection HTTP/1.1
Host: example.org
Content-Type: application/json
Prefer: return-representation
{...}
# Response
HTTP/1.1 201 Created
Content-Type: application/json
Preference-Applied: return-representation
Location: /collection/1
{...}
</artwork></figure>
<t>Whereas in this example, the request is sent asking for the return of
a status representation.</t>
<figure><artwork>
#Request
POST /collection HTTP/1.1
Host: example.org
Content-Type: application/json
Prefer: return-status
{...}
# Response
HTTP/1.1 201 Created
Content-Type: application/json
Preference-Applied: return-status
Location: /collection/1
{...}
</artwork></figure>
<t>Use of the Preference-Applied response header allows the client to
unambiguously determine whether the requested preference was applied.</t>
</section>
<section title="The "return-accepted" Preference" anchor="return-accepted">
<t>The "return-accepted" preference indicates that the client prefers
the server to respond with a 202 Accepted status in the case
where the length of time it takes to generate a response will exceed
some arbitrary threshold established by the server.</t>
<figure><artwork>
return-accepted = "return-accepted"
</artwork></figure>
<t>The key motivation for the "return-accepted" preference is to facilitate
the operation of asynchronous request handling by allowing the
client to indicate to a server it's capability and preference for
handling 202 Accepted responses.</t>
</section>
<section title="The "return-representation" Preference" anchor="return-representation">
<t>The "return-representation" preference indicates that the client prefers
that the server include an entity representing the current state of the
resource in the response to a successful request.</t>
<figure><artwork>
return-representation = "return-representation"
</artwork></figure>
<t>When honoring the "return-representation" preference, the server
MUST include a Content-Location header field specifying the URI of the
resource representation being returned. Per section 6.1 of
<xref target="I-D.ietf-httpbis-p2-semantics"/>, the presence of the
Content-Location header field in the response asserts that the payload
is a representation of the resource identified by the Content-Location
URI.</t>
<t>The "return-representation" preference is intended primarily to provide
a means of optimizing communication between the client and server
by eliminating the need for a subsequent GET request to retrieve the
current representation of the resource following a modification.</t>
<t>Currently, after successfully processing a modification request such
as a POST or PUT, a server may choose to return either an entity describing
the status of the operation or a representation of the modified resource
itself. While the selection of which type of entity to return, if any at all,
is solely at the discretion of the server, the "return-representation" preference --
along with the "return-status" and "return-minimal" directives defined
below -- allow the server to take the client's preferences into
consideration while constructing the response.</t>
</section>
<section title="The "return-status" Preference" anchor="return-status">
<t>The "return-status" preference indicates that the client prefers
the server to include an entity describing the status of the request
in the response as opposed to returning a representation of the current
state of the resource.</t>
<figure><artwork>
return-status = "return-status"
</artwork></figure>
<t>When honoring the "return-status" preference, the server
SHOULD NOT include a Content-Location header field in the response.</t>
</section>
<section title="The "return-minimal" Preference" anchor="return-minimal">
<t>The "return-minimal" preference indicates that the client wishes
the server to return a minimal response to a successful request.
Typically, such responses would utilize the 204 No Content status, but other
codes MAY be used as appropriate, such as a 200 status with a zero-length
response entity. The determination of what constitutes an appropriate minimal response
is solely at the discretion of the server.</t>
<figure><artwork>
return-minimal = "return-minimal"
</artwork></figure>
<t>The "return-minimal" preference is intended to
provide a means of optimizing communication between the client
and server by reducing the amount of data the server is required to
return to the client following a request. This can be
particularly useful, for instance, when communicating with
limited-bandwidth mobile devices or when the client simply
does not require any further information about the result of a
request beyond knowing if it was successfully processed.</t>
</section>
<section title="The "wait" Preference" anchor="wait">
<t>The "wait" preference can be used to establish an upper bound on the
length of time, in seconds, the client is willing to wait for a response,
after which the client may choose to abandon the request.
In the case generating a response will take longer than the time specified,
the server, or proxy, can choose to either return a 202 Accepted response,
cancel processing, or continue attempting to complete the request.</t>
<figure><artwork>
wait = "wait" BWS "=" BWS delta-seconds
</artwork></figure>
<t>Clients specifying the "wait" Preference SHOULD also use the
Date header field, as specified in <xref target="I-D.ietf-httpbis-p2-semantics"/> Section 9.2,
within the request to establish the time at which the client began waiting
for the completion of the request. Failing to include a Date header field
in the request would require the server to use the instant it received
and began processing the request as the baseline for determining how long
the client has been waiting which could yield unintended results depending
on how out of synch the client and server clocks are.</t>
</section>
<!--
<section title="The "priority" Preference" anchor="priority">
<t>ED NOTE: This preference directive is currently exploratory in
nature. I've added it to solicit feedback as to it's general utility.
It is possible that I may pull this back out.</t>
<t>The "priority" preference can be used to indicate the
priority a client wishes the server or proxy to assign to processing the
request relative to other requests that may be concurrently
received. The application and assignment of a priority value
to requests is entirely at the discretion of the server or proxy. Priority
values are specified as non-negative integers within the range 0-100,
inclusive, where the value 0 indicates that the client wishes to
have a server-determined default priority assigned to the
request, and all other values indicate a strictly decreasing
priority as the integer value increases.</t>
<figure><artwork>
priority = "priority" "=" "100" / (1*2DIGIT)
</artwork></figure>
<t>Implementations are free to apply additional constraints on the range
of acceptable values for this directive but MUST NOT signal an error
or fail to process the request should the client provide a value
outside the acceptable range. In such cases, the server SHOULD either
ignore the preference or apply a reasonable default value.</t>
</section>
-->
<section title="The "strict" and "lenient" Processing Preferences" anchor="handling">
<t>The "strict" and "lenient" preferences are mutually-exclusive directives
indicating, at the servers discretion, how the client wishes the server to
handle potential error conditions that may arise in the processing of a
request. For instance, if the payload of a request contains various
minor syntactical or semantic errors, but the server is still capable of
comprehending and successfully processing the request, a decision must be
made to either reject the request with an appropriate 4xx error response
or to go ahead with processing. The "strict" preference can be used by
the client to indicate that, in such conditions, it would prefer that
the server reject the request, while the "lenient" preference indicates
that the client would prefer the server to attempt to process the
request. The specific meaning and application of the "strict" and "lenient"
directives is specific to each type of resource, the request method and
the operation of the server.</t>
<figure><artwork>
handling = "strict" / "lenient"
</artwork></figure>
</section>
<section title="The "detail" Preference" anchor="detail">
<t>The "detail" preference specifies the level of detail the client
wishes the server to provide within a response to an operation. This
preference is akin to specifying the level of verbose output an
operation should generate or to specifying the trace level within a
debug log. The detail level is specified as a non-negative integer in
the range 0-100, where the value 0 indicates a server-determined default
detail level and all other integer values specify a strictly decreasing
level of detail as the integer value increases.</t>
<figure><artwork>
detail = "detail" BWS "=" BWS ("100" / 1*2DIGIT )
</artwork></figure>
<t>Implementations are free to apply additional constraints on the range
of acceptable values for this directive but MUST NOT signal an error
or fail to process the request should the client provide a value
outside the acceptable range. In such cases, the server SHOULD either
ignore the preference or apply a reasonable default value.</t>
<t>One example of a potential use for the application of the "detail"
preference would be in deciding the amount of detailed error information
a server includes in the payload of a 4xx or 5xx response. Solely at the
discretion of the server, an error response to a request specifying a
higher detail level (e.g., detail=1) may included significantly more
detailed information about the error condition than an error response
specifying a much lower detail level (e.g., detail=10).</t>
</section>
<section title="Registered Preferences" anchor="requirements">
<t>Well-defined preferences can be registered for convenience
and/or to promote reuse by other applications. This specification
establishes an IANA registry of such relation types see Section
<xref target="registry" />.</t>
<t>Registered preference names MUST conform to the token rule,
and MUST be compared character-by-character in a case-insensitive
fashion. They SHOULD be appropriate to the specificity of the
preference; i.e., if the semantics are highly specific to a
particular application, the name should reflect that, so that more
general names are available for less specific use.</t>
<t>Registered preferences MUST NOT constrain servers, clients
or any intermediaries involved in the exchange and processing of
a request to any behavior required for successful processing. The
use and application of a preference within a given request MUST
be optional on the part of all participants.</t>
</section>
<section title="IANA Considerations">
<t>The 'Prefer' header field should be added to
the permanent registry (see <xref target="RFC3864" />).</t>
<t><figure><artwork>
Header field name: Prefer
Applicable Protocol: HTTP
Status:
Author/Change controller: IETF
Specification document: this specification
</artwork></figure></t>
<section title="The Registry of Preferences" anchor="registry">
<t>Preferences are registered on the advice of a Designated Expert
(appointed by the IESG or their delegate), with a Specification
Required (using terminology from <xref target="RFC5226" />).</t>
<t>The requirements for registered preferences are described in
<xref target="requirements" /></t>
<t>Registration requests consist of the completed registration template
below, typically published in an RFC or Open Standard (in the sense
described by <xref target="RFC2026" />, Section 7). However, to allow
for the allocation of values prior to publication, the Designated Expert
may approve registration once they are satisfied that a specification
will be published.</t>
<t>Note that relation types can be registered by third parties, if the
Designated Expert determines that an unregistered relation type is
widely deployed and not likely to be registered in a timely manner.</t>
<t>The registration template is:</t>
<t>
<list style="symbols">
<t>Preference: (A value for the Prefer request header field that conforms to the
syntax rule given in <xref target="prefer"/>)</t>
<t>Description:</t>
<t>Reference:</t>
<t>Notes: [optional]</t>
<t>Application Data: [optional]</t>
</list>
</t>
<t>Registration requests should be sent to the preferences@ietf.org
mailing list, marked clearly in the subject line (e.g., "NEW PREFERENCE
- example" to register an "example" preference).</t>
<t>Within at most 14 days of the request, the Designated Expert(s) will
either approve or deny the registration request, communicating this
decision to the review list and IANA. Denials should include an
explanation and, if applicable, suggestions as to how to make the
request successful.</t>
<t>Decisions (or lack thereof) made by the Designated Expert can be
first appealed to Application Area Directors (contactable using
app-ads@tools.ietf.org email address or directly by looking up their
email addresses on http://www.iesg.org/ website) and, if the
appellant is not satisfied with the response, to the full IESG (using
the iesg@iesg.org mailing list).</t>
<t>IANA should only accept registry updates from the Designated
Expert(s), and should direct all requests for registration to the
review mailing list.</t>
<section title="Initial Registry Contents">
<t>The Preferences Registry's initial contents are:</t>
<t>
<list style="symbols">
<t>Preference: return-accepted</t>
<t>Description: Indicates that the client prefers
the server to respond with a 202 Accepted status as described
by <xref target="return-accepted" /></t>
<t>Reference: [this specification]</t>
</list>
</t>
<t>
<list style="symbols">
<t>Preference: return-minimal</t>
<t>Description: Indicates that the client prefers
the server return a minimal response to a
request as described by <xref target="return-minimal" /></t>
<t>Reference: [this specification]</t>
</list>
</t>
<t>
<list style="symbols">
<t>Preference: return-representation</t>
<t>Description: Indicates that the client prefers
the server to include a representation of the current state
of the resource in response to a request as described by
<xref target="return-representation"/></t>
<t>Reference: [this specification]</t>
</list>
</t>
<t>
<list style="symbols">
<t>Preference: return-status</t>
<t>Description: Indicates that the client prefers
the server to return an entity describing the current
state of a resource in response to a request as
described by <xref target="return-status" /></t>
<t>Reference: [this specification]</t>
</list>
</t>
<t>
<list style="symbols">
<t>Preference: wait</t>
<t>Description: Indicates an upper bound to the lenght of
time the client is willing to wait for a response, after which
the request may be aborted.</t>
<t>Reference: [this specification]</t>
</list>
</t>
<!--
<t>
<list style="symbols">
<t>Preference: priority</t>
<t>Description: Indicates the priority a client wishes the
server to assign to the processing of a request relative to
other concurrently processed requests.</t>
<t>Reference: [this specification]</t>
</list>
</t>
-->
<t>
<list style="symbols">
<t>Preference: strict</t>
<t>Description: Indicates that the client wishes the server
to apply strict validation and error handling to the processing
of a request.</t>
<t>Reference: [this specification]</t>
</list>
</t>
<t>
<list style="symbols">
<t>Preference: lenient</t>
<t>Description: Indicates that the client wishes the server
to apply lenient validation and error handling to the processing
of a request.</t>
<t>Reference: [this specification]</t>
</list>
</t>
<t>
<list style="symbols">
<t>Preference: detail</t>
<t>Description: Indicates the client's preference as to the amount
of detail the server should include in responses to a request.</t>
<t>Reference: [this specification]</t>
</list>
</t>
</section>
</section>
</section>
<section title="Security Considerations">
<t>Specific preferences requested by a client can introduce security
considerations and concerns beyond those discussed in HTTP/1.1 Parts
<xref target="I-D.ietf-httpbis-p1-messaging">1</xref>,
<xref target="I-D.ietf-httpbis-p2-semantics">2</xref>,
<xref target="I-D.ietf-httpbis-p3-payload">3</xref>,
<xref target="I-D.ietf-httpbis-p4-conditional">4</xref>,
<xref target="I-D.ietf-httpbis-p5-range">5</xref>,
<xref target="I-D.ietf-httpbis-p6-cache">6</xref>, and
<xref target="I-D.ietf-httpbis-p7-auth">7</xref>.
Implementors must refer to the specifications and descriptions of each
preference to determine the security considerations relevant to each.</t>
</section>
</middle>
<back>
<references title="Normative References">
&rfc2119;
&rfc3864;
&rfc5226;
&rfc2026;
&rfc5234;
&part1;
&part2;
&part3;
&part4;
&part5;
&part6;
&part7;
</references>
</back>
</rfc>
| PAFTECH AB 2003-2026 | 2026-04-24 04:05:17 |