Using QUIC Datagrams with HTTP/3Google LLC1600 Amphitheatre ParkwayMountain View, California 94043United States of Americadschinazi.ietf@gmail.comCloudflarelucaspardue.24.7@gmail.comInternet-DraftThe QUIC DATAGRAM extension provides application protocols running over QUIC
with a mechanism to send unreliable data while leveraging the security and
congestion-control properties of QUIC. However, QUIC DATAGRAM frames do not
provide a means to demultiplex application contexts. This document defines how
to use QUIC DATAGRAM frames when the application protocol running over QUIC is
HTTP/3 by adding an identifier at the start of the frame payload. This allows
HTTP messages to convey related information using unreliable DATAGRAM frames,
ensuring those frames are properly associated with an HTTP message.Discussion of this work is encouraged to happen on the MASQUE IETF mailing list
(masque@ietf.org) or on the GitHub repository which
contains the draft: .IntroductionThe QUIC DATAGRAM extension provides
application protocols running over QUIC with
a mechanism to send unreliable data while leveraging the security and
congestion-control properties of QUIC. However, QUIC DATAGRAM frames do not
provide a means to demultiplex application contexts. This document defines how
to use QUIC DATAGRAM frames when the application protocol running over QUIC is
HTTP/3 by adding an identifier at the start of the
frame payload. This allows HTTP messages to convey related information using
unreliable DATAGRAM frames, ensuring those frames are properly associated with
an HTTP message.This design mimics the use of Stream Types in HTTP/3, which provide a
demultiplexing identifier at the start of each unidirectional stream.Discussion of this work is encouraged to happen on the MASQUE IETF mailing list
(masque@ietf.org) or on the GitHub repository which
contains the draft: .Conventions and DefinitionsThe key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in BCP 14
when, and only when, they appear in all capitals, as shown here.Flow IdentifiersFlow identifiers represent bidirectional flows of datagrams within a single QUIC
connection. These are conceptually similar to streams in the sense that they
allow multiplexing of application data. Flows lack any of the ordering
or reliability guarantees of streams.Beyond this, a sender SHOULD ensure that DATAGRAM frames within a single flow
are transmitted in order relative to one another. If multiple DATAGRAM frames
can be packed into a single QUIC packet, the sender SHOULD group them by flow
identifier to promote fate-sharing within a specific flow and improve the
ability to process batches of datagram messages efficiently on the receiver.Flow Identifier AllocationImplementations of HTTP/3 that support the DATAGRAM extension MUST provide a
flow identifier allocation service. That service will allow applications
co-located with HTTP/3 to request a unique flow identifier that they can
subsequently use for their own purposes. The HTTP/3 implementation will then
parse the flow identifier of incoming DATAGRAM frames and use it to deliver the
frame to the appropriate application.Even-numbered flow identifiers are client-initiated, while odd-numbered flow
identifiers are server-initiated. This means that an HTTP/3 client
implementation of the flow identifier allocation service MUST only provide
even-numbered identifiers, while a server implementation MUST only provide
odd-numbered identifiers. Note that, once allocated, any flow identifier can be
used by both client and server - only allocation carries separate namespaces to
avoid requiring synchronization.The flow allocation service SHOULD also provide a mechanism for applications
to indicate they have completed their usage of a flow identifier and will no
longer be using that flow identifier, this process is called "retiring" a flow
identifier. Applications MUST NOT retire a flow identifier until after they
have received confirmation that the peer has also stopped using that flow
identifier. The flow identifier allocation service MAY reuse previously
retired flow identifiers once they have ascertained that there are no packets
with DATAGRAM frames using that flow identifier still in flight. Reusing flow
identifiers can improve performance by transmitting the flow identifier using
a shorter variable-length integer encoding.HTTP/3 DATAGRAM Frame FormatWhen used with HTTP/3, the Datagram Data field of QUIC DATAGRAM frames uses the
following format (using the notation from the "Notational Conventions" section
of ):
Flow Identifier:
A variable-length integer indicating the Flow Identifier of the datagram (see
).
HTTP/3 Datagram Payload:
The payload of the datagram, whose semantics are defined by individual
applications. Note that this field can be empty.
Endpoints MUST treat receipt of a DATAGRAM frame whose payload is too short to
parse the flow identifier as an HTTP/3 connection error of type
H3_GENERAL_PROTOCOL_ERROR.The H3_DATAGRAM HTTP/3 SETTINGS ParameterImplementations of HTTP/3 that support this mechanism can indicate 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 be either 0 or 1. A value
of 0 indicates that this mechanism is 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.An endpoint that sends the H3_DATAGRAM SETTINGS parameter with a value of 1
MUST send the max_datagram_frame_size QUIC Transport Parameter .
An endpoint that receives the H3_DATAGRAM SETTINGS parameter with a value of 1
on a QUIC connection that did not also receive the max_datagram_frame_size
QUIC Transport Parameter MUST terminate the connection with error
H3_SETTINGS_ERROR.When clients use 0-RTT, they MAY store the value of the server's H3_DATAGRAM
SETTINGS parameter. Doing so allows the client to use HTTP/3 datagrams in 0-RTT
packets. When servers decide to accept 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 where they sent them the NewSessionTicket message. If a client
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 SETTINGS parameter sent
by the server in the handshake is greater than or equal to the stored value; if
not, the client MUST terminate the connection with error H3_SETTINGS_ERROR. In
all cases, the maximum permitted value of the H3_DATAGRAM SETTINGS parameter is
1.Datagram-Flow-Id Header Field Definition"Datagram-Flow-Id" is a List Structured
Field , whose members MUST
all be Items of type Integer. Its ABNF is:The "Datagram-Flow-Id" header field is used to associate one or more datagram
flow identifiers with an HTTP message. As a simple example using a single
identifier, the definition of an HTTP method could instruct the client to use
its flow identifier allocation service to allocate a new flow identifier, and
then the client will add the "Datagram-Flow-Id" header field to its request to
communicate that value to the server. In this example, the resulting header
field could look like:List members are flow identifier elements, which can be named or unnamed.
One element in the list is allowed to be unnamed, but all but one elements
MUST carry a name. The name of an element is encoded in the key of the first
parameter of that element (parameters are defined in Section 3.1.2 of
). Each name MUST NOT appear more than once in the list. The
value of the first parameter of each named element (whose corresponding key
conveys the element name) MUST be of type Boolean and equal to true. The value
of the first parameter of the unnamed element MUST NOT be of type Boolean. The
ordering of the list does not carry any semantics. For example, an HTTP method
that wishes to use four datagram flow identifiers for the lifetime of its
request stream could look like this:In this example, 42 is the unnamed flow identifier, 44 represents the name
"ecn-ect0", 46 represents "ecn-ect1", and 48 represents "ecn-ce". Note that,
since the list ordering does not carry semantics, this example can be
equivalently encoded as:Even if a sender attempts to communicate the meaning of a flow identifier
before it uses it in an HTTP/3 datagram, it is possible that its peer will
receive an HTTP/3 datagram with a flow identifier that it does not know as it
has not yet received the corresponding "Datagram-Flow-Id" header field. (For
example, this could happen if the QUIC STREAM frame that contains the
"Datagram-Flow-Id" header field is reordered and arrives afer the DATAGRAM
frame.) Endpoints MUST NOT treat that scenario as an error; they MUST either
silently discard the datagram or buffer it until they receive the
"Datagram-Flow-Id" header field.Distinct HTTP requests MAY refer to the same flow identifier in their
respective "Datagram-Flow-Id" header fields.Note that integer structured fields can only encode values up to 10^15-1,
therefore the maximum possible value of an element of the "Datagram-Flow-Id"
header field is lower then the theoretical maximum value of a flow identifier
which is 2^62-1 due to the QUIC variable length integer encoding. If the flow
identifier allocation service of an endpoint runs out of values lower than
10^15-1, the endpoint MUST fail the flow identifier allocation. An HTTP
message that carries a "Datagram-Flow-Id" header field with a flow identifier
value above 10^15-1 is malformed (see Section 8.1.2.6 of ).HTTP IntermediariesHTTP/3 DATAGRAM flow identifiers are specific to a given HTTP/3 connection.
However, in some cases, an HTTP request may travel across multiple HTTP
connections if there are HTTP intermediaries involved; see Section 2.3 of
.If an intermediary has sent the H3_DATAGRAM SETTINGS parameter with a value of 1
on its client-facing connection, it MUST inspect all HTTP requests from that
connection and check for the presence of the "Datagram-Flow-Id" header field. If
the HTTP method of the request is not supported by the intermediary, it MUST
remove the "Datagram-Flow-Id" header field before forwarding the request. If the
intermediary supports the method, it MUST either remove the header field or
adhere to the requirements leveraged by that method on intermediaries.If an intermediary has sent the H3_DATAGRAM SETTINGS parameter with a value of 1
on its server-facing connection, it MUST inspect all HTTP responses from that
connection and check for the presence of the "Datagram-Flow-Id" header field. If
the HTTP method of the request is not supported by the intermediary, it MUST
remove the "Datagram-Flow-Id" header field before forwarding the response. If
the intermediary supports the method, it MUST either remove the header field or
adhere to the requirements leveraged by that method on intermediaries.If an intermediary processes distinct HTTP requests that refer to the same flow
identifier in their respective "Datagram-Flow-Id" header fields, it MUST ensure
that those requests are routed to the same backend.Security ConsiderationsThis document does not have additional security considerations beyond those
defined in and .IANA ConsiderationsHTTP SETTINGS ParameterThis document will request IANA to register the following entry in the
"HTTP/3 Settings" registry:HTTP Header FieldThis document will request IANA to register the "Datagram-Flow-Id"
header field in the "Permanent Message Header Field Names"
registry maintained at
<>.Normative ReferencesAn Unreliable Datagram Extension to QUICThis document defines an extension to the QUIC transport protocol to add support for sending and receiving unreliable datagrams over a QUIC connection. Discussion of this work is encouraged to happen on the QUIC IETF mailing list quic@ietf.org (mailto:quic@ietf.org) or on the GitHub repository which contains the draft: https://github.com/quicwg/ datagram (https://github.com/quicwg/datagram).QUIC: A UDP-Based Multiplexed and Secure TransportThis document defines the core of the QUIC transport protocol. QUIC provides applications with flow-controlled streams for structured communication, low-latency connection establishment, and network path migration. QUIC includes security measures that ensure confidentiality, integrity, and availability in a range of deployment circumstances. Accompanying documents describe the integration of TLS for key negotiation, loss detection, and an exemplary congestion control algorithm. DO NOT DEPLOY THIS VERSION OF QUIC DO NOT DEPLOY THIS VERSION OF QUIC UNTIL IT IS IN AN RFC. This verion is still a work in progress. For trial deployments, please use earlier versions. Note to Readers Discussion of this draft takes place on the QUIC working group mailing list (quic@ietf.org (mailto:quic@ietf.org)), which is archived at https://mailarchive.ietf.org/arch/search/?email_list=quic Working Group information can be found at https://github.com/quicwg; source code and issues list for this draft can be found at https://github.com/quicwg/base-drafts/labels/-transport.Hypertext Transfer Protocol Version 3 (HTTP/3)The QUIC transport protocol has several features that are desirable in a transport for HTTP, such as stream multiplexing, per-stream flow control, and low-latency connection establishment. This document describes a mapping of HTTP semantics over QUIC. This document also identifies HTTP/2 features that are subsumed by QUIC, and describes how HTTP/2 extensions can be ported to HTTP/3. DO NOT DEPLOY THIS VERSION OF HTTP DO NOT DEPLOY THIS VERSION OF HTTP/3 UNTIL IT IS IN AN RFC. This version is still a work in progress. For trial deployments, please use earlier versions. Note to Readers Discussion of this draft takes place on the QUIC working group mailing list (quic@ietf.org), which is archived at https://mailarchive.ietf.org/arch/search/?email_list=quic. Working Group information can be found at https://github.com/quicwg; source code and issues list for this draft can be found at https://github.com/quicwg/base-drafts/labels/-http.Key words for use in RFCs to Indicate Requirement LevelsIn many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.Ambiguity of Uppercase vs Lowercase in RFC 2119 Key WordsRFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.Structured Field Values for HTTPThis document describes a set of data types and associated algorithms that are intended to make it easier and safer to define and handle HTTP header and trailer fields, known as "Structured Fields", "Structured Headers", or "Structured Trailers". It is intended for use by specifications of new HTTP fields that wish to use a common syntax that is more restrictive than traditional HTTP field values.Hypertext Transfer Protocol Version 2 (HTTP/2)This specification describes an optimized expression of the semantics of the Hypertext Transfer Protocol (HTTP), referred to as HTTP version 2 (HTTP/2). HTTP/2 enables a more efficient use of network resources and a reduced perception of latency by introducing header field compression and allowing multiple concurrent exchanges on the same connection. It also introduces unsolicited push of representations from servers to clients.This specification is an alternative to, but does not obsolete, the HTTP/1.1 message syntax. HTTP's existing semantics remain unchanged.Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and RoutingThe Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems. This document provides an overview of HTTP architecture and its associated terminology, defines the "http" and "https" Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations.AcknowledgmentsThe DATAGRAM flow identifier was previously part of the DATAGRAM frame
definition itself, the author would like to acknowledge the authors of
that document and the members of the IETF MASQUE working group for their
suggestions. Additionally, the author would like to thank Martin Thomson
for suggesting the use of an HTTP/3 SETTINGS parameter.