Note:“>
MAY“>
MUST“>
MUST NOT“>
OPTIONAL“>
RECOMMENDED“>
REQUIRED“>
SHALL“>
SHALL NOT“>
SHOULD“>
SHOULD NOT“>
]>
Hypertext Transfer Protocol (HTTP) Client-Initiated Content-Encodinggreenbytes GmbHHafenweg 16MuensterNW48155Germanyjulian.reschke@greenbytes.dehttp://greenbytes.de/tech/webdav/
Applications
HTTPHTTPcontent-encoding
In HTTP, “Content Codings” allow for payload encodings such as for
compression or integrity checks. In particular, the “gzip” content
coding is widely used for payload data sent in response messages.
Content Codings can be used in request messages as well, however
discoverability is not on par with response messages. This document
extends the HTTP “Accept-Encoding” header field for use in responses.
Discussion of this draft takes place on the HTTPBIS working group mailing list
(ietf-http-wg@w3.org), which is archived at .
Working Group information can be found at
and ; source code and issues
list for this draft can be found at
.
The changes in this draft are summarized in .
In HTTP, “Content Codings” allow for payload encodings such as for
compression or integrity checks (). In particular, the “gzip” content
coding is widely used for payload data sent in response messages.
Content Codings can be used in request messages as well, however
discoverability is not on par with response messages. This document
extends the HTTP “Accept-Encoding” header field () for use in responses.
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”,
“SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this
document are to be interpreted as described in .
This document reuses terminology used in the base HTTP specifications,
namely and
.
defines
“Accept-Encoding” as a request header field only.
This specification extends that definition to allow “Accept-Encoding”
as a response header field as well. When present, it indicates what
content codings a resource was willing to accept at the time of the
response.
A field value that only contains “identity” implies that no
content codings are supported.
Note that this information is specific to the specific request. The
set of supported encodings might be different for other resources on the
same server, could also change depending on other aspects of the
request (such as the request method), or might change in the future.
defines status code
415 (Unsupported Media Type) to apply to both media type and content coding
related problems.
Servers that fail a request due to an unsupported content coding &SHOULD;
respond with a 415 status and &SHOULD; include an “Accept-Encoding” header field in
that response, allowing clients to distinguish between content coding
related issues and media type related issues. In order
to avoid confusion with media type related problems, servers that fail a request
with a 415 status for reasons unrelated to content codings &SHOULD-NOT;
include the “Accept-Encoding” header field.
While sending “Accept-Encoding” in a 415 (Unsupported Media Type) response will be the most common use case,
it is not restricted to this particular status code. For instance, a server
might include it in a 2xx response when a request payload was
big enough to justify use of a compression coding, but the client failed to do so.
Client submits a POST request using Content-Encoding “compress”
():
POST /edit/ HTTP/1.1
Host: example.org
Content-Type: application/atom+xml;type=entry
Content-Encoding: compress
…compressed payload…
Server rejects request because it only allows the “gzip” content coding:
HTTP/1.1 415 Unsupported Media Type
Date: Fri, 09 May 2014 11:43:53 GMT
Accept-Encoding: gzip
Content-Length:
Content-Type: text/plain
This resource only supports the “gzip” content coding in requests.
…at which point the client can retry the request with the supported
“gzip” content coding.
Alternatively, a server that does not support any content codings in
requests could answer with:
HTTP/1.1 415 Unsupported Media Type
Date: Fri, 09 May 2014 11:43:53 GMT
Accept-Encoding: identity
Content-Length:
Content-Type: text/plain
This resource does not support content codings in requests.
Servers that do not support content codings in requests already are required
to fail a request that does use a content coding.
recommends to use the status code 415 (Unsupported Media Type), so the only
change needed is to include the “Accept-Encoding” header field with value
“identity” in that response.
Servers that do support some content codings are required to fail requests
with unsupported content codings as well. To be compliant with this specification,
servers will need to use the status code 415 (Unsupported Media Type) to
signal the problem, and will have to include an “Accept-Encoding” header field
that enumerates the content codings that are supported. As the set of
supported content codings usually is
static and small, adding the header field ought to be trivial.
This specification does not introduce any new security considerations
beyond those discussed in .
HTTP header fields are registered within the “Message Headers” registry
located at ,
as defined by .
This document updates the definition of the “Accept-Encoding” header field,
so the “Permanent Message Header Field Names” registry shall be updated
accordingly:
Header Field NameProtocolStatusReferenceAccept-Encodinghttpstandard,
extended by of this document
Key words for use in RFCs to Indicate Requirement LevelsHarvard Universitysob@harvard.eduHypertext Transfer Protocol (HTTP/1.1): Message Syntax and RoutingAdobe Systems Incorporatedfielding@gbiv.comgreenbytes GmbHjulian.reschke@greenbytes.deHypertext Transfer Protocol (HTTP/1.1): Semantics and ContentAdobe Systems Incorporatedfielding@gbiv.comgreenbytes GmbHjulian.reschke@greenbytes.deRegistration Procedures for Message Header FieldsNine by NineGK-IETF@ninebynine.orgBEA Systemsmnot@pobox.comHP LabsJeffMogul@acm.org
Clarified that the information returned in Accept-Encoding is per resource, not per server.
Added some deployment considerations.
Updated HTTP/1.1 references.
Restrict the scope of A-E from “future requests” to “at the time of this request”.
Mention use of A-E in responses other than 415.
Recommend not to include A-E in a 415 response unless there was actually a problem related to content coding.
First Working Group draft; updated boilerplate accordingly.
Thanks go to the members of the and HTTPbis Working Group, namely
Amos Jeffries, Mark Nottingham, and Ted Hardie.