draft-ietf-masque-h3-datagram-07.txt   draft-ietf-masque-h3-datagram-08.txt 
MASQUE D. Schinazi MASQUE D. Schinazi
Internet-Draft Google LLC Internet-Draft Google LLC
Intended status: Standards Track L. Pardue Intended status: Standards Track L. Pardue
Expires: 22 September 2022 Cloudflare Expires: 29 September 2022 Cloudflare
21 March 2022 28 March 2022
Using Datagrams with HTTP HTTP Datagrams and the Capsule Protocol
draft-ietf-masque-h3-datagram-07 draft-ietf-masque-h3-datagram-08
Abstract Abstract
The QUIC DATAGRAM extension provides application protocols running This document describes HTTP Datagrams, a convention for conveying
over QUIC with a mechanism to send unreliable data while leveraging multiplexed, potentially unreliable datagrams inside an HTTP
the security and congestion-control properties of QUIC. However, connection.
QUIC DATAGRAM frames do not provide a means to demultiplex
application contexts. This document describes how to use QUIC In HTTP/3, HTTP Datagrams can be conveyed natively using the QUIC
DATAGRAM frames with HTTP/3 by association with HTTP requests. DATAGRAM extension. When the QUIC DATAGRAM frame is unavailable or
Additionally, this document defines the Capsule Protocol that can undesirable, they can be sent using the Capsule Protocol, a more
convey datagrams over prior versions of HTTP. general convention for conveying data in HTTP connections.
Both are intended for use by HTTP extensions, not applications.
Discussion Venues Discussion Venues
This note is to be removed before publishing as an RFC. This note is to be removed before publishing as an RFC.
Discussion of this document takes place on the MASQUE WG mailing list Discussion of this document takes place on the MASQUE WG mailing list
(masque@ietf.org), which is archived at (masque@ietf.org), which is archived at
https://mailarchive.ietf.org/arch/browse/masque/. https://mailarchive.ietf.org/arch/browse/masque/.
Source for this draft and an issue tracker can be found at Source for this draft and an issue tracker can be found at
skipping to change at page 1, line 48 skipping to change at page 2, line 4
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on 29 September 2022.
This Internet-Draft will expire on 22 September 2022.
Copyright Notice Copyright Notice
Copyright (c) 2022 IETF Trust and the persons identified as the Copyright (c) 2022 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents (https://trustee.ietf.org/ Provisions Relating to IETF Documents (https://trustee.ietf.org/
license-info) in effect on the date of publication of this document. license-info) in effect on the date of publication of this document.
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
and restrictions with respect to this document. Code Components and restrictions with respect to this document. Code Components
extracted from this document must include Revised BSD License text as extracted from this document must include Revised BSD License text as
described in Section 4.e of the Trust Legal Provisions and are described in Section 4.e of the Trust Legal Provisions and are
provided without warranty as described in the Revised BSD License. provided without warranty as described in the Revised BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Conventions and Definitions . . . . . . . . . . . . . . . 3 1.1. Conventions and Definitions . . . . . . . . . . . . . . . 3
2. Multiplexing . . . . . . . . . . . . . . . . . . . . . . . . 3 2. HTTP Datagrams . . . . . . . . . . . . . . . . . . . . . . . 3
3. HTTP/3 Datagram Format . . . . . . . . . . . . . . . . . . . 3 2.1. HTTP/3 Datagrams . . . . . . . . . . . . . . . . . . . . 4
3.1. The H3_DATAGRAM HTTP/3 SETTINGS Parameter . . . . . . . . 5 2.1.1. The H3_DATAGRAM HTTP/3 SETTINGS Parameter . . . . . . 5
3.1.1. Note About Draft Versions . . . . . . . . . . . . . . 5 2.2. HTTP Datagrams using Capsules . . . . . . . . . . . . . . 6
4. Capsules . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3. Capsules . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.1. Capsule Protocol . . . . . . . . . . . . . . . . . . . . 7 3.1. HTTP Data Streams . . . . . . . . . . . . . . . . . . . . 7
4.2. Error Handling . . . . . . . . . . . . . . . . . . . . . 8 3.2. The Capsule Protocol . . . . . . . . . . . . . . . . . . 7
4.3. The Capsule-Protocol Header Field . . . . . . . . . . . . 8 3.3. Error Handling . . . . . . . . . . . . . . . . . . . . . 8
4.4. The DATAGRAM Capsule . . . . . . . . . . . . . . . . . . 9 3.4. The Capsule-Protocol Header Field . . . . . . . . . . . . 9
5. Prioritization . . . . . . . . . . . . . . . . . . . . . . . 10 3.5. The DATAGRAM Capsule . . . . . . . . . . . . . . . . . . 9
6. Security Considerations . . . . . . . . . . . . . . . . . . . 10 4. Security Considerations . . . . . . . . . . . . . . . . . . . 11
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11
7.1. HTTP/3 SETTINGS Parameter . . . . . . . . . . . . . . . . 11 5.1. HTTP/3 SETTINGS Parameter . . . . . . . . . . . . . . . . 11
7.2. HTTP/3 Error Code . . . . . . . . . . . . . . . . . . . . 11 5.2. HTTP/3 Error Code . . . . . . . . . . . . . . . . . . . . 12
7.3. HTTP Header Field Name . . . . . . . . . . . . . . . . . 11 5.3. HTTP Header Field Name . . . . . . . . . . . . . . . . . 12
7.4. Capsule Types . . . . . . . . . . . . . . . . . . . . . . 12 5.4. Capsule Types . . . . . . . . . . . . . . . . . . . . . . 12
8. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 13
8.1. Normative References . . . . . . . . . . . . . . . . . . 12 6.1. Normative References . . . . . . . . . . . . . . . . . . 13
8.2. Informative References . . . . . . . . . . . . . . . . . 14 6.2. Informative References . . . . . . . . . . . . . . . . . 14
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 14 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 15
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 14 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 15
1. Introduction 1. Introduction
The QUIC DATAGRAM extension [DGRAM] provides application protocols HTTP extensions sometimes need to access underlying transport
running over QUIC [QUIC] with a mechanism to send unreliable data protocol features such as unreliable delivery (as offered by [DGRAM])
while leveraging the security and congestion-control properties of to enable desirable features like an unreliable version of the
QUIC. However, QUIC DATAGRAM frames do not provide a means to CONNECT method, and unreliable delivery in WebSockets [RFC6455] (or
demultiplex application contexts. This document describes how to use its successors).
QUIC DATAGRAM frames with HTTP/3 [H3] by association with HTTP
requests. Additionally, this document defines the Capsule Protocol
that can convey datagrams over prior versions of HTTP.
This document is structured as follows:
* Section 2 presents core concepts for multiplexing across HTTP
versions.
* Section 3 defines how QUIC DATAGRAM frames are used with HTTP/3.
- Section 3.1 defines an HTTP/3 setting that endpoints can use to
advertise support of the frame.
* Section 4 introduces the Capsule Protocol and the "data stream" In Section 2, this document describes HTTP Datagrams, a convention
concept. Data streams are initiated using special-purpose HTTP that supports the bidirectional and possibly multiplexed exchange of
requests, after which Capsules, an end-to-end message, can be data inside an HTTP connection. While HTTP datagrams are associated
sent. with HTTP requests, they are not part of message content; instead,
they are intended for use by HTTP extensions (such as the CONNECT
method), and are compatible with all versions of HTTP. When the
underlying transport protocol supports unreliable delivery (such as
when the QUIC DATAGRAM extension is available in HTTP/3), they can
use that capability.
- Section 4.4 defines Datagram Capsule types, along with guidance This document also describes the HTTP Capsule Protocol in Section 3,
for specifying new capsule types. to allow conveyance of HTTP Datagrams when the QUIC DATAGRAM frame is
unavailable or undesirable, such as when earlier versions of HTTP are
in use.
1.1. Conventions and Definitions 1.1. Conventions and Definitions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in "OPTIONAL" in this document are to be interpreted as described in
BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
2. Multiplexing 2. HTTP Datagrams
All HTTP Datagrams are associated with an HTTP request. HTTP Datagrams are a convention for conveying bidirectional and
potentially unreliable datagrams inside an HTTP connection, with
multiplexing when possible. All HTTP Datagrams are associated with
an HTTP request.
When running over HTTP/3, multiple exchanges of datagrams need the When HTTP Datagrams are conveyed on an HTTP/3 connection, the QUIC
ability to coexist on a given QUIC connection. To allow this, the DATAGRAM frame can be used to achieve these goals, including
QUIC DATAGRAM frame payload starts with an encoded stream identifier unreliable delivery; see Section 2.1. Negotiation is achieved using
that associates the datagram with a request stream. a setting; see Section 2.1.1.
When running over HTTP/2, demultiplexing is provided by the HTTP/2 When running over HTTP/2, demultiplexing is provided by the HTTP/2
framing layer. When running over HTTP/1, requests are strictly framing layer, but unreliable delivery is unavailable. HTTP
serialized in the connection, therefore demultiplexing is not needed. Datagrams are negotiated and conveyed using the Capsule Protocol; see
Section 3.5.
3. HTTP/3 Datagram Format When running over HTTP/1, requests are strictly serialized in the
connection, and therefore demultiplexing is not available.
Unreliable delivery is likewise not available. HTTP Datagrams are
negotiated and conveyed using the Capsule Protocol; see Section 3.5.
HTTP Datagrams MUST only be sent with an association to a stream
whose HTTP semantics explicitly supports HTTP Datagrams. For
example, existing HTTP methods GET and POST do not define semantics
for associated HTTP Datagrams; therefore, HTTP Datagrams cannot be
sent associated with GET or POST request streams.
If an HTTP Datagram associated with a method that has no known
semantics for HTTP Datagrams is received, the receiver MUST abort the
corresponding stream; if HTTP/3 is in use, the stream MUST be aborted
with H3_DATAGRAM_ERROR. HTTP extensions can override these
requirements by defining a negotiation mechanism and semantics for
HTTP Datagrams.
2.1. HTTP/3 Datagrams
When used with HTTP/3, the Datagram Data field of QUIC DATAGRAM When used with HTTP/3, the Datagram Data field of QUIC DATAGRAM
frames uses the following format (using the notation from the frames uses the following format (using the notation from the
"Notational Conventions" section of [QUIC]): "Notational Conventions" section of [QUIC]):
HTTP/3 Datagram { HTTP/3 Datagram {
Quarter Stream ID (i), Quarter Stream ID (i),
HTTP Datagram Payload (..), HTTP Datagram Payload (..),
} }
Figure 1: HTTP/3 DATAGRAM Format Figure 1: HTTP/3 Datagram Format
Quarter Stream ID: A variable-length integer that contains the value Quarter Stream ID: A variable-length integer that contains the value
of the client-initiated bidirectional stream that this datagram is of the client-initiated bidirectional stream that this datagram is
associated with, divided by four (the division by four stems from associated with, divided by four (the division by four stems from
the fact that HTTP requests are sent on client-initiated the fact that HTTP requests are sent on client-initiated
bidirectional streams, and those have stream IDs that are bidirectional streams, and those have stream IDs that are
divisible by four). The largest legal QUIC stream ID value is divisible by four). The largest legal QUIC stream ID value is
2^62-1, so the largest legal value of Quarter Stream ID is 2^60-1. 2^62-1, so the largest legal value of Quarter Stream ID is 2^60-1.
Receipt of a frame that includes a larger value MUST be treated as Receipt of an HTTP/3 Datagram that includes a larger value MUST be
an HTTP/3 connection error of type H3_DATAGRAM_ERROR. treated as an HTTP/3 connection error of type H3_DATAGRAM_ERROR.
HTTP Datagram Payload: The payload of the datagram, whose semantics HTTP Datagram Payload: The payload of the datagram, whose semantics
are defined by individual applications. Note that this field can are defined by the extension that is using HTTP Datagrams. Note
be empty. that this field can be empty.
Receipt of a QUIC DATAGRAM frame whose payload is too short to allow Receipt of a QUIC DATAGRAM frame whose payload is too short to allow
parsing the Quarter Stream ID field MUST be treated as an HTTP/3 parsing the Quarter Stream ID field MUST be treated as an HTTP/3
connection error of type H3_DATAGRAM_ERROR. connection error of type H3_DATAGRAM_ERROR.
Endpoints MUST NOT send HTTP/3 datagrams unless the corresponding HTTP/3 Datagrams MUST NOT be sent unless the corresponding stream's
stream's send side is open. On a given endpoint, once the receive send side is open. Once the receive side of a stream is closed,
side of a stream is closed, incoming datagrams for this stream are no incoming datagrams for this stream are no longer expected so related
longer expected so the endpoint can release related state. Endpoints state can be released. State MAY be kept for a short time to account
MAY keep state for a short time to account for reordering. Once the for reordering. Once the state is released, the received associated
state is released, the endpoint MUST silently drop received datagrams MUST be silently dropped.
associated datagrams.
If an HTTP/3 datagram is received and its Quarter Stream ID maps to a If an HTTP/3 datagram is received and its Quarter Stream ID maps to a
stream that has not yet been created, the receiver SHALL either drop stream that has not yet been created, the receiver SHALL either drop
that datagram silently or buffer it temporarily (on the order of a that datagram silently or buffer it temporarily (on the order of a
round trip) while awaiting the creation of the corresponding stream. round trip) while awaiting the creation of the corresponding stream.
If an HTTP/3 datagram is received and its Quarter Stream ID maps to a If an HTTP/3 datagram is received and its Quarter Stream ID maps to a
stream that cannot be created due to client-initiated bidirectional stream that cannot be created due to client-initiated bidirectional
stream limits, it SHOULD be treated as an HTTP/3 connection error of stream limits, it SHOULD be treated as an HTTP/3 connection error of
type H3_ID_ERROR. Generating an error is not mandatory in this case type H3_ID_ERROR. Generating an error is not mandatory in this case
because HTTP/3 implementations might have practical barriers to because HTTP/3 implementations might have practical barriers to
determining the active stream concurrency limit that is applied by determining the active stream concurrency limit that is applied by
the QUIC layer. the QUIC layer.
HTTP/3 datagrams MUST only be sent with an association to a stream Prioritization of HTTP/3 datagrams is not defined in this document.
that supports semantics for HTTP Datagrams. For example, existing Future extensions MAY define how to prioritize datagrams, and MAY
HTTP methods GET and POST do not define semantics for associated HTTP define signaling to allow communicating prioritization preferences.
Datagrams; therefore, HTTP/3 datagrams cannot be sent associated with
GET or POST request streams. If an endpoint receives an HTTP/3
datagram associated with a method that has no known semantics for
HTTP Datagrams, it MUST abort the corresponding stream with
H3_DATAGRAM_ERROR. Future extensions MAY remove these requirements
if they define semantics for such HTTP Datagrams and negotiate mutual
support.
3.1. The H3_DATAGRAM HTTP/3 SETTINGS Parameter 2.1.1. The H3_DATAGRAM HTTP/3 SETTINGS Parameter
Implementations of HTTP/3 that support HTTP Datagrams can indicate Implementations of HTTP/3 that support HTTP Datagrams can indicate
that to their peer by sending the H3_DATAGRAM SETTINGS parameter with that to their peer by sending the H3_DATAGRAM SETTINGS parameter with
a value of 1. The value of the H3_DATAGRAM SETTINGS parameter MUST a value of 1.
be either 0 or 1. A value of 0 indicates that HTTP Datagrams are not
supported. An endpoint that receives the H3_DATAGRAM SETTINGS
parameter with a value that is neither 0 or 1 MUST terminate the
connection with error H3_SETTINGS_ERROR.
Endpoints MUST NOT send QUIC DATAGRAM frames until they have both The value of the H3_DATAGRAM SETTINGS parameter MUST be either 0 or
sent and received the H3_DATAGRAM SETTINGS parameter with a value of 1. A value of 0 indicates that HTTP Datagrams are not supported. If
1. the H3_DATAGRAM SETTINGS parameter is received with a value that is
neither 0 or 1, the receiver MUST terminate the connection with error
H3_SETTINGS_ERROR.
QUIC DATAGRAM frames MUST NOT be sent until the H3_DATAGRAM SETTINGS
parameter has been both sent and received with a value of 1.
When clients use 0-RTT, they MAY store the value of the server's When clients use 0-RTT, they MAY store the value of the server's
H3_DATAGRAM SETTINGS parameter. Doing so allows the client to send H3_DATAGRAM SETTINGS parameter. Doing so allows the client to send
QUIC DATAGRAM frames in 0-RTT packets. When servers decide to accept QUIC DATAGRAM frames in 0-RTT packets. When servers decide to accept
0-RTT data, they MUST send a H3_DATAGRAM SETTINGS parameter greater 0-RTT data, they MUST send a H3_DATAGRAM SETTINGS parameter greater
than or equal to the value they sent to the client in the connection than or equal to the value they sent to the client in the connection
where they sent them the NewSessionTicket message. If a client where they sent them the NewSessionTicket message. If a client
stores the value of the H3_DATAGRAM SETTINGS parameter with their stores the value of the H3_DATAGRAM SETTINGS parameter with their
0-RTT state, they MUST validate that the new value of the H3_DATAGRAM 0-RTT state, they MUST validate that the new value of the H3_DATAGRAM
SETTINGS parameter sent by the server in the handshake is greater SETTINGS parameter sent by the server in the handshake is greater
than or equal to the stored value; if not, the client MUST terminate than or equal to the stored value; if not, the client MUST terminate
the connection with error H3_SETTINGS_ERROR. In all cases, the the connection with error H3_SETTINGS_ERROR. In all cases, the
maximum permitted value of the H3_DATAGRAM SETTINGS parameter is 1. maximum permitted value of the H3_DATAGRAM SETTINGS parameter is 1.
It is RECOMMENDED that implementations that support receiving HTTP It is RECOMMENDED that implementations that support receiving HTTP
Datagrams using QUIC always send the H3_DATAGRAM SETTINGS parameter Datagrams using QUIC always send the H3_DATAGRAM SETTINGS parameter
with a value of 1, even if the application does not intend to use with a value of 1, even if the application does not intend to use
HTTP Datagrams. This helps to avoid "sticking out"; see Section 6. HTTP Datagrams. This helps to avoid "sticking out"; see Section 4.
3.1.1. Note About Draft Versions 2.1.1.1. Note About Draft Versions
[[RFC editor: please remove this section before publication.]] [[RFC editor: please remove this section before publication.]]
Some revisions of this draft specification use a different value (the Some revisions of this draft specification use a different value (the
Identifier field of a Setting in the HTTP/3 SETTINGS frame) for the Identifier field of a Setting in the HTTP/3 SETTINGS frame) for the
H3_DATAGRAM Settings Parameter. This allows new draft revisions to H3_DATAGRAM Settings Parameter. This allows new draft revisions to
make incompatible changes. Multiple draft versions MAY be supported make incompatible changes. Multiple draft versions MAY be supported
by either endpoint in a connection. Such endpoints MUST send by sending multiple values for H3_DATAGRAM. Once SETTINGS have been
multiple values for H3_DATAGRAM. Once an endpoint has sent and sent and received, an implementation that supports multiple drafts
received SETTINGS, it MUST compute the intersection of the values it MUST compute the intersection of the values it has sent and received,
has sent and received, and then it MUST select and use the most and then it MUST select and use the most recent draft version from
recent draft version from the intersection set. This ensures that the intersection set. This ensures that both peers negotiate the
both endpoints negotiate the same draft version. same draft version.
4. Capsules 2.2. HTTP Datagrams using Capsules
When HTTP/3 Datagrams are unavailable or undesirable, HTTP Datagrams
can be sent using the Capsule Protocol, see Section 3.5.
3. Capsules
One mechanism to extend HTTP is to introduce new HTTP Upgrade Tokens
(see Section 16.7 of [HTTP]). In HTTP/1.x, these tokens are used via
the Upgrade mechanism (see Section 7.8 of [HTTP]). In HTTP/2 and
HTTP/3, these tokens are used via the Extended CONNECT mechanism (see
[EXT-CONNECT2] and [EXT-CONNECT3]).
This specification introduces the Capsule Protocol. The Capsule This specification introduces the Capsule Protocol. The Capsule
Protocol is a sequence of type-length-value tuples that new HTTP Protocol is a sequence of type-length-value tuples that definitions
Upgrade Tokens (see Section 16.7 of [HTTP]) can choose to use. It of new HTTP Upgrade Tokens can choose to use. It allows endpoints to
allows endpoints to reliably communicate request-related information reliably communicate request-related information end-to-end on HTTP
end-to-end on HTTP request streams, even in the presence of HTTP request streams, even in the presence of HTTP intermediaries. The
intermediaries. The Capsule Protocol can be used to exchange HTTP Capsule Protocol can be used to exchange HTTP Datagrams, which is
Datagrams when HTTP is running over a transport that does not support necessary when HTTP is running over a transport that does not support
the QUIC DATAGRAM frame. the QUIC DATAGRAM frame.
3.1. HTTP Data Streams
This specification defines the "data stream" of an HTTP request as This specification defines the "data stream" of an HTTP request as
the bidirectional stream of bytes that follow the headers in both the bidirectional stream of bytes that follows the header section of
directions. In HTTP/1.x, the data stream consists of all bytes on the request message and the final, successful (i.e., 2xx) response
the connection that follow the blank line that concludes either the message.
request header section, or the 2xx (Successful) response header
section. (Note that only a single HTTP request starting the capsule
protocol can be sent on HTTP/1.x connections.) In HTTP/2 and HTTP/3,
the data stream of a given HTTP request consists of all bytes sent in
DATA frames with the corresponding stream ID. The concept of a data
stream is particularly relevant for methods such as CONNECT where
there is no HTTP message content after the headers.
Note that use of the Capsule Protocol is not required to use HTTP In HTTP/1.x, the data stream consists of all bytes on the connection
Datagrams. If a new HTTP Upgrade Token is only defined over that follow the blank line that concludes either the request header
transports that support QUIC DATAGRAM frames, they might not need a section, or the response header section. As a result, only a single
stream encoding. Additionally, definitions of new HTTP Upgrade HTTP request starting the capsule protocol can be sent on HTTP/1.x
Tokens can use HTTP Datagrams with their own data stream protocol. connections.
However, new HTTP Upgrade Tokens that wish to use HTTP Datagrams
SHOULD use the Capsule Protocol unless they have a good reason not
to.
4.1. Capsule Protocol In HTTP/2 and HTTP/3, the data stream of a given HTTP request
consists of all bytes sent in DATA frames with the corresponding
stream ID.
Definitions of new HTTP Upgrade Tokens can state that their data The concept of a data stream is particularly relevant for methods
stream uses the Capsule Protocol. If they do so, that means that the such as CONNECT where there is no HTTP message content after the
contents of their data stream uses the following format (using the headers.
notation from the "Notational Conventions" section of [QUIC]):
Data streams can be prioritized using any means suited to stream or
request prioritization. For example, see Section 11 of [PRIORITY].
3.2. The Capsule Protocol
Definitions of new HTTP Upgrade Tokens can state that their
associated request's data stream uses the Capsule Protocol. If they
do so, that means that the contents of the associated request's data
stream uses the following format (using the notation from the
"Notational Conventions" section of [QUIC]):
Capsule Protocol { Capsule Protocol {
Capsule (..) ..., Capsule (..) ...,
} }
Figure 2: Capsule Protocol Stream Format Figure 2: Capsule Protocol Stream Format
Capsule { Capsule {
Capsule Type (i), Capsule Type (i),
Capsule Length (i), Capsule Length (i),
Capsule Value (..), Capsule Value (..),
} }
Figure 3: Capsule Format Figure 3: Capsule Format
Capsule Type: A variable-length integer indicating the Type of the Capsule Type: A variable-length integer indicating the Type of the
capsule. Endpoints that receive a capsule with an unknown Capsule capsule.
Type MUST silently skip over that capsule.
Capsule Length: The length of the Capsule Value field following this Capsule Length: The length of the Capsule Value field following this
field, encoded as a variable-length integer. Note that this field field, encoded as a variable-length integer. Note that this field
can have a value of zero. can have a value of zero.
Capsule Value: The payload of this capsule. Its semantics are Capsule Value: The payload of this capsule. Its semantics are
determined by the value of the Capsule Type field. determined by the value of the Capsule Type field.
Because new protocols or extensions may involve defining new capsule An intermediary can identify the use of the capsule protocol either
types, intermediaries that wish to allow for future extensibility through the presence of the Capsule-Protocol header field
SHOULD forward capsules unmodified. One exception to this rule is (Section 3.4) or by understanding the chosen HTTP Upgrade token.
the DATAGRAM capsule; see Section 4.4. An intermediary can identify
the use of the capsule protocol either through the presence of the Because new protocols or extensions might define new capsule types,
Capsule-Protocol header field (Section 4.3) or by understanding the intermediaries that wish to allow for future extensibility SHOULD
chosen HTTP Upgrade token. An intermediary that identifies the use forward capsules without modification, unless the definition of the
of the capsule protocol MAY convert between DATAGRAM capsules and Capsule Type in use specifies additional intermediary processing.
QUIC DATAGRAM frames when forwarding. Definitions of new Capsule One such Capsule Type is the DATAGRAM capsule; see Section 3.5. In
Types MAY specify optional custom intermediary processing. particular, intermediaries SHOULD forward Capsules with an unknown
Capsule Type without modification.
Endpoints which receive a Capsule with an unknown Capsule Type MUST Endpoints which receive a Capsule with an unknown Capsule Type MUST
silently drop that Capsule. silently drop that Capsule and skip over it to parse the next
Capsule.
By virtue of the definition of the data stream, the Capsule Protocol By virtue of the definition of the data stream, the Capsule Protocol
is not in use on responses unless the response includes a 2xx is not in use on responses unless the response includes a 2xx
(Successful) status code. (Successful) status code.
The Capsule Protocol MUST NOT be used with messages that contain The Capsule Protocol MUST NOT be used with messages that contain
Content-Length, Content-Type, or Transfer-Encoding header fields. Content-Length, Content-Type, or Transfer-Encoding header fields.
Additionally, HTTP status codes 204 (No Content), 205 (Reset Additionally, HTTP status codes 204 (No Content), 205 (Reset
Content), and 206 (Partial Content) MUST NOT be sent on responses Content), and 206 (Partial Content) MUST NOT be sent on responses
that use the Capsule Protocol. that use the Capsule Protocol. A receiver that observes a violation
of these requirements MUST treat the HTTP message as malformed.
4.2. Error Handling 3.3. Error Handling
When an error occurs processing the capsule protocol, the receiver When an error occurs in processing the Capsule Protocol, the receiver
MUST treat the message as malformed or incomplete, according to the MUST treat the message as malformed or incomplete, according to the
underlying transport protocol. For HTTP/3, the handling of malformed underlying transport protocol. For HTTP/3, the handling of malformed
messages is described in Section 4.1.3 of [H3]. For HTTP/2, the messages is described in Section 4.1.3 of [H3]. For HTTP/2, the
handling of malformed messages is described in Section 8.1.1 of [H2]. handling of malformed messages is described in Section 8.1.1 of [H2].
For HTTP/1.1, the handling of incomplete messages is described in For HTTP/1.1, the handling of incomplete messages is described in
Section 8 of [H1]. Section 8 of [H1].
Each capsule's payload MUST contain exactly the fields identified in Each capsule's payload MUST contain exactly the fields identified in
its description. A capsule payload that contains additional bytes its description. A capsule payload that contains additional bytes
after the identified fields or a capsule payload that terminates after the identified fields or a capsule payload that terminates
before the end of the identified fields MUST be treated as a before the end of the identified fields MUST be treated as a
malformed or incomplete message. In particular, redundant length malformed or incomplete message. In particular, redundant length
encodings MUST be verified to be self-consistent. encodings MUST be verified to be self-consistent.
When a stream carrying capsules terminates cleanly, if the last When a stream carrying capsules terminates cleanly, if the last
capsule on the stream was truncated, this MUST be treated as a capsule on the stream was truncated, this MUST be treated as a
malformed or incomplete message. malformed or incomplete message.
4.3. The Capsule-Protocol Header Field 3.4. The Capsule-Protocol Header Field
This document defines the "Capsule-Protocol" header field. It is an The "Capsule-Protocol" header field is an Item Structured Field, see
Item Structured Field, see Section 3.3 of [STRUCT-FIELD]; its value Section 3.3 of [STRUCT-FIELD]; its value MUST be a Boolean; any other
MUST be a Boolean. Its ABNF is: value type MUST be handled as if the field were not present by
recipients (for example, if this field is included multiple times,
its type will become a List and the field will therefore be ignored).
This document does not define any parameters for the Capsule-Protocol
header field value, but future documents might define parameters.
Receivers MUST ignore unknown parameters.
Capsule-Protocol = sf-item Endpoints indicate that the Capsule Protocol is in use on a data
stream by sending a Capsule-Protocol header field with a true value.
A Capsule-Protocol header field with a false value has the same
semantics as when the header is not present.
Endpoints indicate that the Capsule Protocol is in use on the data Intermediaries MAY use this header field to allow processing of HTTP
stream by sending the Capsule-Protocol header field with a value of Datagrams for unknown HTTP Upgrade Tokens; note that this is only
?1. A Capsule-Protocol header field with a value of ?0 has the same possible for HTTP Upgrade or Extended CONNECT.
semantics as when the header is not present. Intermediaries MAY use
this header field to allow processing of HTTP Datagrams for unknown
HTTP Upgrade Tokens; note that this is only possible for HTTP Upgrade
or Extended CONNECT.
The Capsule-Protocol header field MUST NOT be sent multiple times on The Capsule-Protocol header field MUST NOT be used on HTTP responses
a message. The Capsule-Protocol header field MUST NOT be used on with a status code outside the 2xx range.
HTTP responses with a status code different from 2xx (Successful).
This specification does not define any parameters for the Capsule-
Protocol header field value, but future documents MAY define
parameters. Receivers MUST ignore unknown parameters.
When using the Capsule Protocol, HTTP endpoints SHOULD send the
Capsule-Protocol header field to simplify intermediary processing.
Definitions of new HTTP Upgrade Tokens that use the Capsule Protocol Definitions of new HTTP Upgrade Tokens that use the Capsule Protocol
MAY use the Capsule-Protocol header field to simplify intermediary MAY alter this recommendation.
processing.
4.4. The DATAGRAM Capsule 3.5. The DATAGRAM Capsule
This document defines the DATAGRAM capsule type (see Section 7.4 for This document defines the DATAGRAM capsule type (see Section 5.4 for
the value of the capsule type). This capsule allows an endpoint to the value of the capsule type). This capsule allows HTTP Datagrams
send an HTTP Datagram on a stream using the Capsule Protocol. This to be sent on a stream using the Capsule Protocol. This is
is particularly useful when HTTP is running over a transport that particularly useful when HTTP is running over a transport that does
does not support the QUIC DATAGRAM frame. not support the QUIC DATAGRAM frame.
Datagram Capsule { Datagram Capsule {
Type (i) = DATAGRAM, Type (i) = DATAGRAM,
Length (i), Length (i),
HTTP Datagram Payload (..), HTTP Datagram Payload (..),
} }
Figure 4: DATAGRAM Capsule Format Figure 4: DATAGRAM Capsule Format
HTTP Datagram Payload: The payload of the datagram, whose semantics HTTP Datagram Payload: The payload of the datagram, whose semantics
are defined by individual applications. Note that this field can are defined by the extension that is using HTTP Datagrams. Note
be empty. that this field can be empty.
Datagrams sent using the DATAGRAM capsule have the same semantics as HTTP Datagrams sent using the DATAGRAM capsule have the same
datagrams sent in QUIC DATAGRAM frames. In particular, the semantics as those sent in QUIC DATAGRAM frames. In particular, the
restrictions on when it is allowed to send an HTTP Datagram and how restrictions on when it is allowed to send an HTTP Datagram and how
to process them from Section 3 also apply to HTTP Datagrams sent and to process them from Section 2.1 also apply to HTTP Datagrams sent
received using the DATAGRAM capsule. and received using the DATAGRAM capsule.
An intermediary can reencode HTTP Datagrams as it forwards them. In An intermediary can reencode HTTP Datagrams as it forwards them. In
other words, an intermediary MAY send a DATAGRAM capsule to forward other words, an intermediary MAY send a DATAGRAM capsule to forward
an HTTP Datagram which was received in a QUIC DATAGRAM frame, and an HTTP Datagram which was received in a QUIC DATAGRAM frame, and
vice versa. vice versa.
Note that while DATAGRAM capsules that are sent on a stream are Note that while DATAGRAM capsules that are sent on a stream are
reliably delivered in order, intermediaries can reencode DATAGRAM reliably delivered in order, intermediaries can reencode DATAGRAM
capsules into QUIC DATAGRAM frames when forwarding messages, which capsules into QUIC DATAGRAM frames when forwarding messages, which
could result in loss or reordering. could result in loss or reordering.
skipping to change at page 10, line 21 skipping to change at page 10, line 49
on that connection is too low), the intermediary SHOULD drop the HTTP on that connection is too low), the intermediary SHOULD drop the HTTP
Datagram instead of converting it to a DATAGRAM capsule. This Datagram instead of converting it to a DATAGRAM capsule. This
preserves the end-to-end unreliability characteristic that methods preserves the end-to-end unreliability characteristic that methods
such as Datagram Packetization Layer Path MTU Discovery (DPLPMTUD) such as Datagram Packetization Layer Path MTU Discovery (DPLPMTUD)
depend on [DPLPMTUD]. An intermediary that converts QUIC DATAGRAM depend on [DPLPMTUD]. An intermediary that converts QUIC DATAGRAM
frames to DATAGRAM capsules allows HTTP Datagrams to be arbitrarily frames to DATAGRAM capsules allows HTTP Datagrams to be arbitrarily
large without suffering any loss; this can misrepresent the true path large without suffering any loss; this can misrepresent the true path
properties, defeating methods such as DPLPMTUD. properties, defeating methods such as DPLPMTUD.
While DATAGRAM capsules can theoretically carry a payload of length While DATAGRAM capsules can theoretically carry a payload of length
2^62-1, most applications will have their own limits on what datagram 2^62-1, most HTTP extensions that use HTTP Datagrams will have their
payload sizes are practical. Implementations SHOULD take those own limits on what datagram payload sizes are practical.
limits into account when parsing DATAGRAM capsules: if an incoming Implementations SHOULD take those limits into account when parsing
DATAGRAM capsule has a length that is known to be so large as to not DATAGRAM capsules: if an incoming DATAGRAM capsule has a length that
be usable, the implementation SHOULD discard the capsule without is known to be so large as to not be usable, the implementation
buffering its contents into memory. SHOULD discard the capsule without buffering its contents into
memory.
5. Prioritization
Data streams (see Section 4.1) can be prioritized using any means
suited to stream or request prioritization. For example, see
Section 11 of [PRIORITY].
Prioritization of HTTP/3 datagrams is not defined in this document. Note that use of the Capsule Protocol is not required to use HTTP
Future extensions MAY define how to prioritize datagrams, and MAY Datagrams. If an HTTP extension that uses HTTP Datagrams is only
define signaling to allow endpoints to communicate their defined over transports that support QUIC DATAGRAM frames, it might
prioritization preferences. not need a stream encoding. Additionally, HTTP extensions can use
HTTP Datagrams with their own data stream protocol. However, new
HTTP extensions that wish to use HTTP Datagrams SHOULD use the
Capsule Protocol unless they have a good reason not to.
6. Security Considerations 4. Security Considerations
Since transmitting HTTP Datagrams using QUIC DATAGRAM frames requires Since transmitting HTTP Datagrams using QUIC DATAGRAM frames requires
sending an HTTP/3 Settings parameter, it "sticks out". In other sending an HTTP/3 Settings parameter, it "sticks out". In other
words, probing clients can learn whether a server supports HTTP words, probing clients can learn whether a server supports HTTP
Datagrams over QUIC DATAGRAM frames. As some servers might wish to Datagrams over QUIC DATAGRAM frames. As some servers might wish to
obfuscate the fact that they offer application services that use HTTP obfuscate the fact that they offer application services that use HTTP
datagrams, it's best for all implementations that support this datagrams, it's best for all implementations that support this
feature to always send this Settings parameter, see Section 3.1. feature to always send this Settings parameter, see Section 2.1.1.
Since use of the Capsule Protocol is restricted to new HTTP Upgrade Since use of the Capsule Protocol is restricted to new HTTP Upgrade
Tokens, it is not accessible from Web Platform APIs (such as those Tokens, it is not accessible from Web Platform APIs (such as those
commonly accessed via JavaScript in web browsers). commonly accessed via JavaScript in web browsers).
7. IANA Considerations 5. IANA Considerations
7.1. HTTP/3 SETTINGS Parameter 5.1. HTTP/3 SETTINGS Parameter
This document will request IANA to register the following entry in This document will request IANA to register the following entry in
the "HTTP/3 Settings" registry: the "HTTP/3 Settings" registry:
Value: 0xffd277 (note that this will switch to a lower value before Value: 0xffd277 (note that this will switch to a lower value before
publication) publication)
Setting Name: H3_DATAGRAM Setting Name: H3_DATAGRAM
Default: 0 Default: 0
Status: provisional (permanent if this document is approved) Status: provisional (permanent if this document is approved)
Specification: This Document Specification: This Document
Change Controller: IETF Change Controller: IETF
Contact: HTTP_WG; HTTP working group; ietf-http-wg@w3.org Contact: HTTP_WG; HTTP working group; ietf-http-wg@w3.org
7.2. HTTP/3 Error Code 5.2. HTTP/3 Error Code
This document will request IANA to register the following entry in This document will request IANA to register the following entry in
the "HTTP/3 Error Codes" registry: the "HTTP/3 Error Codes" registry:
Value: 0x4A1268 (note that this will switch to a lower value before Value: 0x4A1268 (note that this will switch to a lower value before
publication) publication)
Name: H3_DATAGRAM_ERROR Name: H3_DATAGRAM_ERROR
Description: Datagram or capsule protocol parse error Description: Datagram or capsule protocol parse error
Status: provisional (permanent if this document is approved) Status: provisional (permanent if this document is approved)
Specification: This Document Specification: This Document
Change Controller: IETF Change Controller: IETF
Contact: HTTP_WG; HTTP working group; ietf-http-wg@w3.org Contact: HTTP_WG; HTTP working group; ietf-http-wg@w3.org
7.3. HTTP Header Field Name 5.3. HTTP Header Field Name
This document will request IANA to register the following entry in This document will request IANA to register the following entry in
the "HTTP Field Name" registry: the "HTTP Field Name" registry:
Field Name: Capsule-Protocol Field Name: Capsule-Protocol
Template: None Template: None
Status: provisional (permanent if this document is approved) Status: provisional (permanent if this document is approved)
Reference: This document Reference: This document
Comments: None Comments: None
7.4. Capsule Types 5.4. Capsule Types
This document establishes a registry for HTTP capsule type codes. This document establishes a registry for HTTP capsule type codes.
The "HTTP Capsule Types" registry governs a 62-bit space. The "HTTP Capsule Types" registry governs a 62-bit space.
Registrations in this registry MUST include the following fields: Registrations in this registry MUST include the following fields:
Type: A name or label for the capsule type. Type: A name or label for the capsule type.
Value: The value of the Capsule Type field (see Section 4.1) is a Value: The value of the Capsule Type field (see Section 3.2) is a
62-bit integer. 62-bit integer.
Reference: An optional reference to a specification for the type. Reference: An optional reference to a specification for the type.
This field MAY be empty. This field MAY be empty.
Registrations follow the "First Come First Served" policy (see Registrations follow the "First Come First Served" policy (see
Section 4.4 of [IANA-POLICY]) where two registrations MUST NOT have Section 4.4 of [IANA-POLICY]) where two registrations MUST NOT have
the same Type. the same Type.
This registry initially contains the following entry: This registry initially contains the following entry:
skipping to change at page 12, line 45 skipping to change at page 13, line 24
publication) publication)
Reference: This document Reference: This document
Capsule types with a value of the form 41 * N + 23 for integer values Capsule types with a value of the form 41 * N + 23 for integer values
of N are reserved to exercise the requirement that unknown capsule of N are reserved to exercise the requirement that unknown capsule
types be ignored. These capsules have no semantics and can carry types be ignored. These capsules have no semantics and can carry
arbitrary values. These values MUST NOT be assigned by IANA and MUST arbitrary values. These values MUST NOT be assigned by IANA and MUST
NOT appear in the listing of assigned values. NOT appear in the listing of assigned values.
8. References 6. References
8.1. Normative References 6.1. Normative References
[DGRAM] Pauly, T., Kinnear, E., and D. Schinazi, "An Unreliable [DGRAM] Pauly, T., Kinnear, E., and D. Schinazi, "An Unreliable
Datagram Extension to QUIC", Work in Progress, Internet- Datagram Extension to QUIC", Work in Progress, Internet-
Draft, draft-ietf-quic-datagram-10, 4 February 2022, Draft, draft-ietf-quic-datagram-10, 4 February 2022,
<https://datatracker.ietf.org/doc/html/draft-ietf-quic- <https://datatracker.ietf.org/doc/html/draft-ietf-quic-
datagram-10>. datagram-10>.
[H1] Fielding, R. T., Nottingham, M., and J. Reschke, [H1] Fielding, R. T., Nottingham, M., and J. Reschke,
"HTTP/1.1", Work in Progress, Internet-Draft, draft-ietf- "HTTP/1.1", Work in Progress, Internet-Draft, draft-ietf-
httpbis-messaging-19, 12 September 2021, httpbis-messaging-19, 12 September 2021,
skipping to change at page 14, line 10 skipping to change at page 14, line 36
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/rfc/rfc8174>. May 2017, <https://www.rfc-editor.org/rfc/rfc8174>.
[STRUCT-FIELD] [STRUCT-FIELD]
Nottingham, M. and P-H. Kamp, "Structured Field Values for Nottingham, M. and P-H. Kamp, "Structured Field Values for
HTTP", RFC 8941, DOI 10.17487/RFC8941, February 2021, HTTP", RFC 8941, DOI 10.17487/RFC8941, February 2021,
<https://www.rfc-editor.org/rfc/rfc8941>. <https://www.rfc-editor.org/rfc/rfc8941>.
8.2. Informative References 6.2. Informative References
[DPLPMTUD] Fairhurst, G., Jones, T., Tüxen, M., Rüngeler, I., and T. [DPLPMTUD] Fairhurst, G., Jones, T., Tüxen, M., Rüngeler, I., and T.
Völker, "Packetization Layer Path MTU Discovery for Völker, "Packetization Layer Path MTU Discovery for
Datagram Transports", RFC 8899, DOI 10.17487/RFC8899, Datagram Transports", RFC 8899, DOI 10.17487/RFC8899,
September 2020, <https://www.rfc-editor.org/rfc/rfc8899>. September 2020, <https://www.rfc-editor.org/rfc/rfc8899>.
[EXT-CONNECT2]
McManus, P., "Bootstrapping WebSockets with HTTP/2",
RFC 8441, DOI 10.17487/RFC8441, September 2018,
<https://www.rfc-editor.org/rfc/rfc8441>.
[EXT-CONNECT3]
Hamilton, R., "Bootstrapping WebSockets with HTTP/3", Work
in Progress, Internet-Draft, draft-ietf-httpbis-h3-
websockets-04, 8 February 2022,
<https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-
h3-websockets-04>.
[PRIORITY] Oku, K. and L. Pardue, "Extensible Prioritization Scheme [PRIORITY] Oku, K. and L. Pardue, "Extensible Prioritization Scheme
for HTTP", Work in Progress, Internet-Draft, draft-ietf- for HTTP", Work in Progress, Internet-Draft, draft-ietf-
httpbis-priority-12, 17 January 2022, httpbis-priority-12, 17 January 2022,
<https://datatracker.ietf.org/doc/html/draft-ietf-httpbis- <https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-
priority-12>. priority-12>.
[RFC6455] Fette, I. and A. Melnikov, "The WebSocket Protocol",
RFC 6455, DOI 10.17487/RFC6455, December 2011,
<https://www.rfc-editor.org/rfc/rfc6455>.
Acknowledgments Acknowledgments
Portions of this document were previously part of the QUIC DATAGRAM Portions of this document were previously part of the QUIC DATAGRAM
frame definition itself, the authors would like to acknowledge the frame definition itself, the authors would like to acknowledge the
authors of that document and the members of the IETF MASQUE working authors of that document and the members of the IETF MASQUE working
group for their suggestions. Additionally, the authors would like to group for their suggestions. Additionally, the authors would like to
thank Martin Thomson for suggesting the use of an HTTP/3 SETTINGS thank Martin Thomson for suggesting the use of an HTTP/3 SETTINGS
parameter. Furthermore, the authors would like to thank Ben Schwartz parameter. Furthermore, the authors would like to thank Ben Schwartz
for writing the first proposal that used two layers of indirection. for writing the first proposal that used two layers of indirection.
The final design in this document came out of the HTTP Datagrams The final design in this document came out of the HTTP Datagrams
Design Team, whose members were Alan Frindell, Alex Chernyakhovsky, Design Team, whose members were Alan Frindell, Alex Chernyakhovsky,
Ben Schwartz, Eric Rescorla, Marcus Ihlar, Martin Thomson, Mike Ben Schwartz, Eric Rescorla, Marcus Ihlar, Martin Thomson, Mike
Bishop, Tommy Pauly, Victor Vasiliev, and the authors of this Bishop, Tommy Pauly, Victor Vasiliev, and the authors of this
document. document. The authors thank Mark Nottingham and Philipp Tiesel for
their helpful comments.
Authors' Addresses Authors' Addresses
David Schinazi David Schinazi
Google LLC Google LLC
1600 Amphitheatre Parkway 1600 Amphitheatre Parkway
Mountain View, California 94043, Mountain View, California 94043,
United States of America United States of America
Email: dschinazi.ietf@gmail.com Email: dschinazi.ietf@gmail.com
 End of changes. 68 change blocks. 
214 lines changed or deleted 259 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/