An Offset Extension Frame For HTTP/3 Data
Internet-Draft draft-hurst-quic-http-data-offset-frame-02
Sam Hurst
BBC Research & Development
sam.hurst@bbc.co.uk
General
Internet-Draft
This document specifies an optional extension frame type for HTTP/3 that extends the functionality of the DATA frame type to include an offset for the HTTP message payload. This is useful in situations where the HTTP/3 exchange is taking place over an unreliable transport mechanism.
Introduction
HTTP/3 [RFC9114] supports the transfer of HTTP semantics over the QUIC transport protocol [RFC9000]. In a conventional HTTP/3 message exchange, messages consist of a header field section sent as a single HEADERS frame, an optional HTTP message payload sent as a series of DATA frames, followed optionally by a trailer field section sent as a single HEADERS frame. Each DATA frame does not describe its position within the HTTP message payload; rather this is calculated from the position within the QUIC stream minus the overhead from HTTP/3 frame headers and the contents of the header field section.
In the case where the message exchange is taking place across a partially reliable or unreliable profile of [RFC9000], packet loss could result in a lack of synchronisation in the receiver between the perceived HTTP/3 DATA frame offset and the QUIC STREAM frame offset, potentially resulting in a corrupt HTTP representation at the receiver.
In addition, there are other use cases, such as HTTP multipart range requests, where the HTTP/3 payload offset has no direct mapping to the value calculated by the method described above.
This document introduces an extension frame type DATA_WITH_OFFSET which can be used to explicitly signal the offset in the original representation of the data being conveyed within the frame.
Conventions and Terminology
The 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 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
This document uses the variable-length integer encoding from [RFC9000]. The packet and frame diagrams in this document use the bespoke format specified in [RFC9000].
DATA_WITH_OFFSET Extension Frame
Based on the DATA frame defined in [RFC9114], the DATA_WITH_OFFSET frame conveys arbitrary, variable-length sequences of bytes at a defined offset of an HTTP representation. By carrying an explicit payload offset in the HTTP/3 frame header, the HTTP message payload offset is decoupled from the QUIC STREAM frame header offset value. The additional payload offset field takes the form of a variable-length integer, as shown in Figure 1 below.
DATA_WITH_OFFSET Frame

DATA_WITH_OFFSET Frame {
  Type (i) = 0xd00,
  Length (i),
  Offset (i),
  Data (..),
}

If its peer has indicated support for the DATA_WITH_OFFSET extension frame type (as described in Section 5 below) a sender MAY choose to use either DATA frames or DATA_WITH_OFFSET frames to transmit an HTTP representation. Senders MUST NOT mix the use of DATA and DATA_WITH_OFFSET frames on the same QUIC stream (i.e. in the same HTTP message).
- Author's Note: The author welcomes comments about relaxation of the requirement to not mix the usage of DATA and DATA_WITH_OFFSET frames in the same HTTP message.
[RFC9114] defines three stream types: control stream, request stream and push stream. The DATA_WITH_OFFSET frame is only permitted to appear on request streams and push streams. A DATA_WITH_OFFSET frame MUST NOT appear on control streams. If a DATA_WITH_OFFSET frame is received on a control stream, the recipient MUST respond with a connection error of type H3_FRAME_UNEXPECTED, as described in [RFC9114].
The purpose of the DATA_WITH_OFFSET frame is only to assist in locating a particular slice of data carried as part of an HTTP message payload, and not as a means to send data out of order. Senders MUST send data in order, i.e. with increasing values in the Offset field. In cases where the underlying transport does not guarantee in-order delivery of HTTP/3 frames, the receiver MUST be prepared to deal with out-of-order reception of DATA_WITH_OFFSET frames.
Realising HTTP Multipart Range Responses With HTTP/3 Binary Framing
HTTP Range Requests, described in [RFC9110], is an optional feature of HTTP that allows a client to request transfer of one or more subranges of a given representation. Despite the move to binary framing for HTTP in [RFC7540] and subsequently [RFC9114], multiple part HTTP Range Requests still rely on textual encoding - including boundary strings - which is inefficient. These boundary strings then preface additional HTTP headers for each body part, which always carry a Content-Range field, and may additionally carry a Content-Type field which is likely to be repeated across every body part. It is not possible to compress these headers using [RFC9204].
By using the DATA_WITH_OFFSET frame described in Section 3, the network efficiency of multiple part range requests is improved by no longer needing to encode a boundary string into the representation response. Instead, the offset of each part of a representation is simply encoded in the header of a fresh HTTP DATA_WITH_OFFSET frame.
Response Headers
[RFC9110] specifies how a server may respond to an HTTP multipart range request using the 206 (Partial Content) status code. The response message carries a Content-Type response header indicating the multipart/byteranges media type with its required boundary parameter. This boundary parameter allows each body part to carry its own header area containing a Content-Range header to describe what range of the selected representation this body part conveys, as well as a Content-Type header (if applicable) which describes the actual media type of the selected representation.
(Note that section 14.2 of [RFC9110] describes several reasons why a server may choose to deliver a different selection of parts than what the client originally requested.)
Because a selected representation may only contain a single Content-Type header field with a single value, repeating this header field in every body part is highly inefficient. Moreover, the unbounded length of the boundary parameter further reduces transmission efficiency.
This specification modifies the syntax of the Content-Range header and explicitly defines it as a list-based field as per section 5.6.1 of [RFC9110] that is carried in the first HEADERS block sent as part of an HTTP/3 response. In addition, when used on the same QUIC stream as DATA_WITH_OFFSET frames, this specification permits the Content-Range and Content-Type HTTP headers to appear in the HEADERS frame of a 206 (Partial Content) response, enabling it to indicate the MIME media type of the whole representation without needing to duplicate it for each body part.
ABNF for extended Content-Range

Content-Range       = 1#range-item
range-item          = range-unit SP
                      ( range-resp / unsatisfied-range )

range-resp          = incl-range "/" ( complete-length / "*" )
incl-range          = first-pos "-" last-pos
unsatisfied-range   = "*/" complete-length

complete-length     = 1*DIGIT

Range-Response header example

:status = 206
content-type = video/mp4
content-range = bytes 10000-17999/18879543, bytes 24000-41999/18879543

Implementations advertising support for the DATA_WITH_OFFSET frame as described in Section 5 MUST be able to consume this overloaded form of the Content-Range HTTP response header.
A server MAY continue to use the method described in [RFC9110] even if a client has expressed support for the DATA_WITH_OFFSET frame.
- Author's Note: Is it possibly worth splitting this out into its own HTTP setting value?
Usage of DATA_WITH_OFFSET frame with HTTP Range Responses
The DATA_WITH_OFFSET frame may be used in conjunction with HTTP Range Requests, as described in [RFC9110]. When carrying data for a byte range response, the Offset field in the frame header MUST reflect the starting byte position of the frame's payload in the HTTP representation and not the offset within the HTTP/3 exchange. For example, for an HTTP/3 range request made with a request header of range: bytes=1000-1999, the first DATA_WITH_OFFSET frame in the response MUST carry the value 1000 in the Offset field of the frame header.
For HTTP response messages carrying a set of byte ranges, a DATA_WITH_OFFSET frame MUST NOT carry data for more than one contiguous byte range within that set. An individual byte range MAY be carried over multiple instances of the DATA_WITH_OFFSET frame.
Negotiating Support For The DATA_WITH_OFFSET Frame
The DATA_WITH_OFFSET frame described in Section 3 is an optional extension to the regular HTTP/3 protocol specification and, as such, usage of the frame type must be negotiated as described in section 9 of [RFC9114]. For a conventional HTTP/3 connection, this is done using HTTP/3 SETTINGS frames carried on the control streams.
This specification defines the following setting:
SETTINGS_ENABLE_DATA_WITH_OFFSET_FRAME (0xd00):
A boolean value with a default value of 0 (false). Any non-zero value is true.
- Author's Note: It is intended that the value of the H3 SETTINGS frame should mirror the value of the frame to indicate which version of the DATA_WITH_OFFSET frame it understands, should subsequent revisions of this draft change the frame type.
An endpoint that implements this specification SHOULD send a SETTINGS_ENABLE_DATA_WITH_OFFSET_FRAME setting at the beginning of the connection to indicate that it is able to process DATA_WITH_OFFSET frames from its peer.
An endpoint MUST NOT send a DATA_WITH_OFFSET frame unless it has received a positive (i.e. non-zero) SETTINGS_ENABLE_DATA_WITH_OFFSET_FRAME setting from its peer.
Security Considerations
This document introduces no new security considerations beyond those discussed in [RFC9114].
IANA Considerations
This specification registers a new frame type in the "HTTP/3 Frame Type" registry ([RFC9114]).
Registered HTTP/3 Frame Type
Frame Type | Value | Specification
DATA_WITH_OFFSET | 0xd00 | Section 3
- Author's Note: The final, intended value of the frame type is 0xd0f, but in order to allow for this extension to naturally evolve and allow for the frame format to change, it starts at 0xd00 and subsequent revisions of this extension can take incrementally higher frame type values between 0xd00 and 0xd0e.
This specification registers a new setting in the "HTTP/3 Settings" registry ([RFC9114]).
Registered HTTP/3 Settings
Setting | Value | Specification | Default
SETTINGS_ENABLE_DATA_WITH_OFFSET_FRAME | 0xd00 | Section 5 | 0
References
Normative References
[RFC9114]

HTTP/3
M. Bishop, Ed.
June 2022
RFC 9114
DOI 10.17487/RFC9114
[RFC9000]

QUIC: A UDP-Based Multiplexed and Secure Transport
J. Iyengar, Ed.
M. Thomson, Ed.
May 2021
RFC 9000
DOI 10.17487/RFC9000
[RFC2119]

Key words for use in RFCs to Indicate Requirement Levels
S. Bradner
March 1997
BCP 14
RFC 2119
DOI 10.17487/RFC2119
[RFC8174]

Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words
B. Leiba
May 2017
BCP 14
RFC 8174
DOI 10.17487/RFC8174
[RFC9110]

HTTP Semantics
R. Fielding, Ed.
M. Nottingham, Ed.
J. Reschke, Ed.
June 2022
STD 97
RFC 9110
DOI 10.17487/RFC9110
[RFC7540]

Hypertext Transfer Protocol Version 2 (HTTP/2)
M. Belshe
R. Peon
M. Thomson, Ed.
May 2015
RFC 7540
DOI 10.17487/RFC7540
Informative References
[RFC9204]

QPACK: Field Compression for HTTP/3
C. Krasic
M. Bishop
A. Frindell, Ed.
June 2022
RFC 9204
DOI 10.17487/RFC9204
Acknowledgements
The author would like to thank the following for their contributions to the design described in the present document: Lucas Pardue, Richard Bradbury and David Waring.
I am also grateful for Chris Poole's helpful review comments.
Changelog
- RFC Editor's Note: Please remove this section prior to publication of a final version of this document.
Changes since draft-hurst-quic-http-data-offset-frame-01
- Update HTTP/3 reference to the published [RFC9114]
- Update QPACK reference to the published [RFC9204]
- Update httpbis-semantics reference to the published [RFC9110]
Changes since draft-hurst-quic-http-data-offset-frame-00
- Update reference to QUIC transport I-D to [RFC9000].
- Update reference to draft-ietf-httpbis-semantics I-D.