<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.6.25 (Ruby 3.1.3) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-seemann-quic-reliable-stream-reset-01" category="info" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.16.0 -->
  <front>
    <title abbrev="QUIC Reliable Stream Reset">Reliable QUIC Stream Resets</title>
    <seriesInfo name="Internet-Draft" value="draft-seemann-quic-reliable-stream-reset-01"/>
    <author initials="M." surname="Seemann" fullname="Marten Seemann">
      <organization>Protocol Labs</organization>
      <address>
        <email>martenseemann@gmail.com</email>
      </address>
    </author>
    <date year="2023" month="March" day="06"/>
    <area>Transport</area>
    <workgroup>QUIC</workgroup>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <t>QUIC (<xref target="RFC9000"/>) defines a RESET_STREAM frame to reset a stream. When a
sender resets a stream, it stops retransmitting STREAM frames for this stream.
On the receiver side, there is no guarantee that any of the data sent on that
stream is delivered to the application.
This document defines a new QUIC frame, the RELIABLE_RESET_STREAM frame, that
resets a stream, while guaranteeing reliable delivery of stream data up to a
certain byte offset.</t>
    </abstract>
    <note removeInRFC="true">
      <name>Discussion Venues</name>
      <t>Discussion of this document takes place on the
    QUIC Working Group mailing list (quic@ietf.org),
    which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/quic/"/>.</t>
      <t>Source for this draft and an issue tracker can be found at
    <eref target="https://github.com/marten-seemann/draft-seemann-quic-reliable-stream-reset"/>.</t>
    </note>
  </front>
  <middle>
    <section anchor="introduction">
      <name>Introduction</name>
      <t>QUIC v1 (<xref target="RFC9000"/>) allows streams to be reset.  When a stream is
reset, the sender doesn't retransmit stream data for the respective stream.
On the receiver side, the QUIC stack is free to surface the stream reset to the
application immediately, even if it has already received stream data for that
stream.</t>
      <t>Applications running on top of QUIC might need to send an identifier at the
beginning of the stream in order to associate that stream with a specific
subpart of the application. For example, WebTransport
(<xref target="WEBTRANSPORT"/>) uses a variable-length-encoded
integer (as defined in QUIC v1) to transmit the ID of the WebTransport session to
the receiver.</t>
      <t>It is desirable that the receiver is able to associate incoming streams with
their respective subpart of the application, even if the QUIC stream is reset
before the identifier at the beginning of the stream was read.</t>
      <t>This document describes a QUIC extension defining a new frame type, the
RELIABLE_RESET_STREAM frame. This frame allows an endpoint to mark a portion at
the beginning of the stream which will then be guaranteed to be delivered to
receiver's application, even if the stream was reset.</t>
    </section>
    <section anchor="conventions-and-definitions">
      <name>Conventions and Definitions</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>
    </section>
    <section anchor="negotiating-extension-use">
      <name>Negotiating Extension Use</name>
      <t>Endpoints advertise their support of the extension described in this document by
sending the reliable_reset_stream (0x727273) transport parameter
(Section 7.4 of <xref target="RFC9000"/>) with an empty value. An implementation that
understands this transport parameter <bcp14>MUST</bcp14> treat the receipt of a non-empty
value as a connection error of type TRANSPORT_PARAMETER_ERROR.</t>
      <t>In order to allow reliable stream resets in 0-RTT packets, the client <bcp14>MUST</bcp14>
remember the value of this transport parameter.  If 0-RTT data is accepted by
the server, the server <bcp14>MUST</bcp14> not disable this extension on the resumed
connection.</t>
    </section>
    <section anchor="reliableresetstream-frame">
      <name>RELIABLE_RESET_STREAM Frame</name>
      <t>Conceptually, the RELIABLE_RESET_STREAM frame is a RESET_STREAM frame with an
added Reliable Size field.</t>
      <artwork><![CDATA[
RELIABLE_RESET_STREAM Frame {
  Type (i) = 0x72,
  Stream ID (i),
  Application Protocol Error Code (i),
  Final Size (i),
  Reliable Size (i),
}
]]></artwork>
      <t>RELIABLE_RESET_STREAM frames contain the following fields:</t>
      <t>Stream ID:  A variable-length integer encoding of the stream ID of
      the stream being terminated.</t>
      <t>Application Protocol Error Code:  A variable-length integer
    containing the application protocol error code (see Section 20.2)
    that indicates why the stream is being closed.</t>
      <t>Final Size:  A variable-length integer indicating the final size of
    the stream by the RESET_STREAM sender, in units of bytes; see
    (Section 4.5 of <xref target="RFC9000"/>).</t>
      <t>Reliable Size:  A variable-length integer indicating the amount of
    data that needs to be delivered to the application before the
    error code can be surfaced, in units of bytes.</t>
      <t>If the Reliable Size is larger than the Final Size, the receiver <bcp14>MUST</bcp14> close the
connection with a connection error of type FRAME_ENCODING_ERROR.</t>
      <t>Semantically, a RESET_STREAM frame is equivalent to a RELIABLE_RESET_STREAM
frame with the Reliable Size set to 0.</t>
      <t>RELIABLE_RESET_STREAM frames are ack-eliciting. When lost, they <bcp14>MUST</bcp14> be
retransmitted, unless a RESET_STREAM frame or another RELIABLE_RESET_STREAM
frame was sent for the same stream (see <xref target="multiple-frames"/>).</t>
    </section>
    <section anchor="resetting-streams">
      <name>Resetting Streams</name>
      <t>When resetting a stream, the node has the choice between using a RESET_STREAM
frame and a RELIABLE_RESET_STREAM frame. When using a RESET_STREAM frame, the
behavior is unchanged from the behavior described in (<xref target="RFC9000"/>).</t>
      <t>The initiator <bcp14>MUST</bcp14> guarantee reliable delivery of stream data of at least
Reliable Size bytes.  If STREAM frames containing data up to that byte offset
are lost, the initiator <bcp14>MUST</bcp14> retransmit this data,  as described in
(Section 13.3 of <xref target="RFC9000"/>). Data sent beyond that byte offset <bcp14>SHOULD NOT</bcp14> be
retransmitted.</t>
      <t>A receiver that delivers stream data to the application as an ordered byte
stream <bcp14>MUST</bcp14> deliver all bytes up to the Reliable Size before surfacing the
stream reset error.  As described in (Section 3.2 of <xref target="RFC9000"/>), it <bcp14>MAY</bcp14>
deliver data beyond that offset to the application.</t>
      <section anchor="multiple-frames">
        <name>Multiple RELIABLE_RESET_STREAM / RESET_STREAM frames</name>
        <t>The initiator <bcp14>MAY</bcp14> send multiple RELIABLE_RESET_STREAM frames for the same
stream in order to reduce the Reliable Size.  It <bcp14>MAY</bcp14> also send a RESET_STREAM
frame, which is equivalent to sending a RELIABLE_RESET_STREAM frame with a
Reliable Size of 0.</t>
        <t>When sending multiple frames for the same stream, the initiator <bcp14>MUST NOT</bcp14> increase
the Reliable Size.  When receiving a RELIABLE_RESET_STREAM frame with a lower
Reliable Size, the receiver only needs to deliver data up the lower Reliable
Size to the application before surfacing the stream reset error.
It <bcp14>MUST NOT</bcp14> expect the delivery of any data beyond
that byte offset.</t>
        <t>Reordering of packets might lead to a RELIABLE_RESET_STREAM frame with a higher
Reliable Size being received after a RELIABLE_RESET_STREAM frame with a lower
Reliable Size.  The receiver <bcp14>MUST</bcp14> ignore any RELIABLE_RESET_STREAM frame that
increases the Reliable Size.</t>
        <t>When sending another RELIABLE_RESET_STREAM or RESET_STREAM frame for the same
stream, the initiator <bcp14>MUST NOT</bcp14> change the Application Error Code or the Final
Size. If the receiver detects a change in those fields, it <bcp14>MUST</bcp14> close the
connection with a connection error of type STREAM_STATE_ERROR.</t>
      </section>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>TODO Security</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>Normative References</name>
      <reference anchor="RFC9000">
        <front>
          <title>QUIC: A UDP-Based Multiplexed and Secure Transport</title>
          <author fullname="J. Iyengar" initials="J." role="editor" surname="Iyengar">
            <organization/>
          </author>
          <author fullname="M. Thomson" initials="M." role="editor" surname="Thomson">
            <organization/>
          </author>
          <date month="May" year="2021"/>
          <abstract>
            <t>This 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.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9000"/>
        <seriesInfo name="DOI" value="10.17487/RFC9000"/>
      </reference>
      <reference anchor="WEBTRANSPORT">
        <front>
          <title>WebTransport over HTTP/3</title>
          <author fullname="Alan Frindell" initials="A." surname="Frindell">
            <organization>Facebook</organization>
          </author>
          <author fullname="Eric Kinnear" initials="E." surname="Kinnear">
            <organization>Apple Inc.</organization>
          </author>
          <author fullname="Victor Vasiliev" initials="V." surname="Vasiliev">
            <organization>Google</organization>
          </author>
          <date day="24" month="January" year="2023"/>
          <abstract>
            <t>   WebTransport [OVERVIEW] is a protocol framework that enables clients
   constrained by the Web security model to communicate with a remote
   server using a secure multiplexed transport.  This document describes
   a WebTransport protocol that is based on HTTP/3 [HTTP3] and provides
   support for unidirectional streams, bidirectional streams and
   datagrams, all multiplexed within the same HTTP/3 connection.

            </t>
          </abstract>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-ietf-webtrans-http3-04"/>
      </reference>
      <reference anchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner">
            <organization/>
          </author>
          <date month="March" year="1997"/>
          <abstract>
            <t>In 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.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba">
            <organization/>
          </author>
          <date month="May" year="2017"/>
          <abstract>
            <t>RFC 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.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
    </references>
    <section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA51Y3W4buxG+51Ow9sVxCkmVnRRp1KaoYss9BmwrlRUEwcGB
Qe1SEuFdcrPkWtExnGfps/TJOjPk/klrpT3xRVbc5XDmm2/+2O/3mVMukSN+
NJOJEotE8n99ujrndy6XIuUzaaWzR0wsFrl8hK/oZfVp86sjFptIixRkxblY
ur6VMhVa978WKurnYUvf0hb4DVv6w1MWCSdXJt+OuNJLw5jK8hF3eWHd2XD4
bnjGBHw/4vNcaJuZ3LGNyR9WuSmyEWnKHuQWluIRv9JO5hqkXuDxjFkndHwv
EqNBpa20zKYid/dfC+OkHXFtWKZG/Bdnoh63IDmXSwtP2xQffmVMFG5t8hHj
fcbhn9Kw6WbA77xZtObNvQGxUrdemHwltPpNOGX0iH/MDZxiEn4tFpbew5cq
GfGUdgag/rHCxUFkUsa0yVPY/ChHgAjgUv9i/X6fgxiXiwiMJH+cPD39YXZ5
/m44HD4/v+KxXCotLRd8NrmbzO/v5rPJ+IYvc9CWO8MJe3jrXTHgn9egvWBW
6ljm/q2tXve4cvBoMgtvHHohVc4pveJNsZaDjtytlS2lsqmG3xI2RRI0z7lV
sezhUi45fKYNXxUC5DkJSq0FKKS33CxpUywcnC+140bTS+al4sYYmATyZIym
4MciyxIVEdQD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