Note:“>
MAY“>
MUST“>
MUST NOT“>
OPTIONAL“>
RECOMMENDED“>
REQUIRED“>
SHALL“>
SHALL NOT“>
SHOULD“>
SHOULD NOT“>
]>
‘Out-Of-Band’ Content Coding for HTTPgreenbytes GmbHHafenweg 16MuensterNW48155Germanyjulian.reschke@greenbytes.dehttp://greenbytes.de/tech/webdav/EricssonHirsalantie 1102420JorvasFinlandsalvatore.loreto@ericsson.com
Applications and Real-Time
HTTPcontent codingouf-of-band
This document describes an Hypertext Transfer Protocol (HTTP) content
coding that can be used to describe the location of a secondary resource
that contains the payload.
Distribution of this document is unlimited. Although this is not a work
item of the HTTPbis Working Group, comments should be sent to the
Hypertext Transfer Protocol (HTTP) mailing list at ietf-http-wg@w3.org,
which may be joined by sending a message with subject
“subscribe” to ietf-http-wg-request@w3.org.
Discussions of the HTTPbis Working Group are archived at
.
XML versions, latest edits, and issue tracking for this document
are available from and
.
The changes in this draft are summarized in .
This document describes an Hypertext Transfer Protocol (HTTP) content
coding () that can be used
to describe the location of a secondary resource that contains the payload.
The primary use case for this content coding is to enable origin servers
to delegate the delivery of content to a secondary server that might
be “closer” to the client (with respect to network topology) and/or
able to cache content, leveraging content encryption, as described in
.
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
.
The ‘Out-Of-Band’ content coding is used to direct the recipient to retrieve the
actual message representation ()
from a secondary resource, such as a public cache:
Client performs GET requestReceived response specifies the ‘out-of-band’ content coding; the payload
of the response contains additional meta data, plus the location of the secondary
resourceClient performs GET request on secondary resource (usually again via HTTP(s))Secondary server provides wrapped HTTP messageClient unwraps that representation (obtaining a full HTTP message)Client combines above representation with additional representation metadata
obtained from the primary resource
Client Secondary Server Origin Server
sends GET request with Accept-Encoding: out-of-band
() |———————————————————\
status 200 and Content-Coding: out-of-band |
() <———————————————————/
GET to secondary server
() |—————————\
wrapped HTTP message |
() <—————————/
(, )
Client and combines HTTP message received in ()
with metadata received in ().
The name of the content coding is “out-of-band”.
The payload format uses JavaScript Object Notation (JSON, ),
describing an array of objects describing secondary resources, each containing
some of the members below:
A &REQUIRED; string containing the URI reference () of the secondary resource.
An &OPTIONAL; object containing additional members, representing header field values
to be recombined with the metadata from the secondary resource
and which can not appear as header fields in the response message itself
(header fields that occur multiple times need to be combined into a single field value as
per ; header field names are lower-cased).
The payload format uses a JSON array so that the origin server can specify
multiple secondary resources. When a client receives a response containing
multiple entries, it is free to choose which of these to use.
The representation of the secondary resource needs to use a media type
capable of representing a full HTTP message. For now the only supported
type is “application/http” ().
The client then obtains the original message by:
Unwrapping the encapsulated HTTP message by removing any transfer and content codings.
The latter might require
additional metadata that could be present in the “metadata” object,
such as the “Crypto-Key” header field described in .
Replacing/setting any response header fields from the primary
response except for framing-related information such as
Content-Length, Transfer-Encoding and Content-Encoding.
Replacing/setting any header fields with those present as members
in the “metadata” object.
Do we have a use case for this?
If the client is unable to retrieve the secondary resource’s representation
(host can’t be reached, non 2xx response status code, payload failing
integrity check, etc.), it can choose
an alternate secondary resource (if specified), or simply retry the
request to the origin server without including “out-of-band” in the
Accept-Encoding request header field. In the latter case, it can be useful
to inform the origin server about what problems were encountered
when trying to access the secondary resource; see
for details.
Note that although this mechanism causes the inclusion of external
content, it will not affect the application-level security properties
of the reconstructed message, such as its web origin ().
The cacheability of the response for the secondary resource does not affect
the cacheability of the reconstructed response message, which is the same as
for the origin server’s response.
Note that because the server’s response depends on the request’s Accept-Encoding
header field, the response usually will need to be declared to vary on that. See
and
for details.
When the client fails to obtain the secondary resource, it can be useful
to inform the origin server about the condition. This can be accomplished
by adding a “Link” header field () to a subsequent request to the origin server,
detailing the URI of the secondary resource and the failure reason.
The following link extension relations are defined:
Used in case the server was not reachable.
Link relation:
http://purl.org/NET/linkrel/not-reachable
Used in case the server responded, but the object could not be obtained.
Link relation:
http://purl.org/NET/linkrel/resource-not-found
Used in case the the payload could be obtained, but wasn’t usable
(for instance, because integrity checks failed).
Link relation:
http://purl.org/NET/linkrel/payload-unusableClient request of primary resource:
GET /test HTTP/1.1
Host: www.example.com
Accept-Encoding: gzip, out-of-band
Response:
HTTP/1.1 200 OK
Date: Thu, 14 May 2015 18:52:00 GMT
Content-Type: text/plain
Cache-Control: max-age=10, public
Content-Encoding: out-of-band
Content-Length:
Vary: Accept-Encoding
[{
“URI”: “http://example.net/bae27c36-fa6a-11e4-ae5d-00059a3c7a00”
}]
(note that the Content-Type header field describes the media type of the
secondary’s resource representation)
Client request for secondary resource:
GET /bae27c36-fa6a-11e4-ae5d-00059a3c7a00 HTTP/1.1
Host: example.net
Response:
HTTP/1.1 200 OK
Date: Thu, 14 May 2015 18:52:10 GMT
Content-Type: application/http
Cache-Control: private
Content-Length: HTTP/1.1 200 OK
Date: Thu, 14 May 2015 17:00:00 GMT
Content-Length:
Content-Language: en
Hello, world.
Final message after recombining header fields:
HTTP/1.1 200 OK
Date: Thu, 14 May 2015 18:52:00 GMT
Content-Length: Cache-Control: max-age=10, publicContent-Type: text/plain
Content-Language: en
Hello, world.
In this example, Cache-Control, Content-Length, and Date have been set/overwritten with data from the primary resource’s representation.
Given the example HTTP message from ,
a primary resource could use the “out-of-band” encoding to specify just
the location of the secondary resource plus the contents of the
“Crypto-Key” header field needed to decrypt the payload:
Response:
HTTP/1.1 200 OK
Date: Thu, 14 May 2015 18:52:00 GMT
Content-Encoding: out-of-band
Content-Type: text/plain
Content-Length:
Vary: Accept-Encoding
[{
“URI”: “http://example.net/bae27c36-fa6a-11e4-ae5d-00059a3c7a00”
“metadata”: {
“crypto-key”: “keyid=\”a1\”;
aesgcm128=\”csPJEXBYA5U-Tal9EdJi-w\””
}
}]
(note that the Content-Type header field describes the media type of the
secondary’s resource representation)
Response for secondary resource:
HTTP/1.1 200 OK
Date: Thu, 14 May 2015 18:52:10 GMT
Content-Type: application/http
Content-Length: …
Cache-Control: private
HTTP/1.1 200 OK
Content-Length: 32
Content-Encoding: aesgcm128
Encryption: keyid=”a1″; salt=”vr0o6Uq3w_KDWeatc27mUg”
fuag8ThIRIazSHKUqJ5OduR75UgEUuM76J8UFwadEvg(payload body shown in base64 here)Final message after recombining header fields:
HTTP/1.1 200 OK
Date: Thu, 14 May 2015 18:52:00 GMT
Content-Length:
Content-Type: text/plain
I am the walrus
Client requests primary resource as in , but the
attempt to access the secondary resource fails.
Response:
HTTP/1.1 404 Not Found
Date: Thu, 08 September 2015 16:49:00 GMT
Content-Type: text/plain
Content-Length: Resource Not Found
Client retries with the origin server and includes Link
header field reporting the problem:
GET /test HTTP/1.1
Host: www.example.com
Accept-Encoding: gzip, out-of-band
Link: <http://example.net/bae27c36-fa6a-11e4-ae5d-00059a3c7a00>;
rel=”http://purl.org/NET/linkrel/resource-not-found”
New content codings can be deployed easily, as the client can use
the “Accept-Encoding” header field ()
to signal which content codings are supported.
This specification does not define means to verify that the payload
obtained from the secondary resource really is what the origin server
expects it to be. Content signatures can address this concern
(see ).
In general, content codings can be used in both requests and responses. This particular
content coding has been designed for responses. When supported in requests, it
creates a new attack vector where the receiving server can be tricked into
including content that the client might not have access to otherwise
(such as HTTP resources behind a firewall).
The IANA “HTTP Content Coding Registry”, located at ,
needs to be updated with the registration below:
out-of-bandPayload needs to be retrieved from a secondary resource of this documentKey words for use in RFCs to Indicate Requirement LevelsUniform Resource Identifier (URI): Generic SyntaxWeb LinkingThe JavaScript Object Notation (JSON) Data Interchange FormatHypertext Transfer Protocol (HTTP/1.1): Message Syntax and RoutingHypertext Transfer Protocol (HTTP/1.1): Semantics and ContentDefinition of the URL MIME External-Body Access-TypeA Mechanism for Content Indirection in Session Initiation Protocol (SIP) MessagesThe Web Origin ConceptHypertext Transfer Protocol (HTTP/1.1): Conditional RequestsEncrypted Content-Encoding for HTTPContent-Signature Header Field for HTTP
A plausible alternative approach would be to implement this functionality one level
up, using a new redirect status code (). However,
this would have several drawbacks:
Servers will need to know whether a client understands the new status code;
thus some additional signal to opt into this protocol would always be needed.In redirect messages, representation metadata (),
namely “Content-Type”, applies to the response message, not the redirected-to
resource.The origin-preserving nature of using a content coding woudld be lost.
Another alternative would be to implement the indirection on the level
of the media type using something similar to the type “message/external-body”,
defined in and refined for use in the
Session Initiation Protocol (SIP) in . This approach
though would share most of the drawbacks of the status code approach mentioned
above.
We probably need to handle Range Requests. How would this work? Passing down
the Range request header field to the secondary resource?
What about codes other than 200 and 206?
One use-case for this protocol is to enable a system of “blind caches”,
which would serve the secondary resources. These caches might only be populated
on demand, thus it could happen that whatever mechanism is used to populate
the cache hasn’t finished when the client hits it (maybe due to race
conditions, or because the cache is behind a middlebox which doesn’t allow
the origin server to push content to it).
In this particular case, it can be useful if the client was able to
“piggyback” the URI of the primary resource, giving the secondary server
a means by which it could obtain the payload itself. This information could
be provided in yet another Link header field:
GET bae27c36-fa6a-11e4-ae5d-00059a3c7a00 HTTP/1.1
Host: example.net
Link: <http://example.com/test>;
rel=”http://purl.org/NET/linkrel/primary-resource”
(continuing the example from )
What’s unclear is whether it’s ok for the client to reveal the URI
if the primary resource, and under which conditions it’s ok for the secondary
server to access it. All it needs is the potentially encrypted payload,
so maybe yet another URI on the origin server is needed.
Mention media type approach.
Explain that clients can always fall back not to use oob when the secondary
resource isn’t available.
Add Vary response header field to examples and mention that it’ll
usually be needed
().
Experimentally add problem reporting using piggy-backed Link header fields
().
Updated ENCRYPTENC reference.
Thanks to Christer Holmberg, Daniel Lindstrom, Goran Eriksson, John Mattsson, Kevin Smith, Mark Nottingham, Martin Thomson,
and Roland Zink for feedback on this document.