<?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.17 (Ruby 3.1.2) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-seemann-quic-reliable-stream-reset-00" category="info" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.14.2 -->
  <front>
    <title abbrev="QUIC Reliable Stream Reset">Reliable QUIC Stream Resets</title>
    <seriesInfo name="Internet-Draft" value="draft-seemann-quic-reliable-stream-reset-00"/>
    <author initials="M." surname="Seemann" fullname="Marten Seemann">
      <organization>Protocol Labs</organization>
      <address>
        <email>martenseemann@gmail.com</email>
      </address>
    </author>
    <date year="2022" month="September" day="09"/>
    <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>Application 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 QUIC varint to encode the
ID of the WebTransport session.</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.2 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 iniator <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 to be 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">
            <organization>Facebook</organization>
          </author>
          <author fullname="Eric Kinnear">
            <organization>Apple Inc.</organization>
          </author>
          <author fullname="Victor Vasiliev">
            <organization>Google</organization>
          </author>
          <date day="6" month="July" year="2022"/>
          <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-03"/>
      </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
ur6VMhVa978WKurnYUvf0hb4DVv6wyGLhJMrk29HXOmlYUxl+Yi7vLDubDh8
NzxjAr4f8XkutM1M7tjG5A+r3BTZiDRlD3ILS/GIX2kncw1SL/B4xqwTOr4X
idGg0lZaZlORu/uvhXHSjrg2LFMj/oszUY9bkJzLpYWnbYoPvzImCrc2+Yjx
PuPwT2nYdDPgd94sWvPm3oBYqVsvTL4SWv0mnDJ6xD/mBk4xCb8WC0vv4UuV
jHhKOwNQ/1jh4iAyKWPa5ClsfpQjQARwqX+xfr/PQYzLRQRGkj9Onp7+MLs8
fzccDp+fX/FYLpWWlgs+m9xN5vd389lkfMOXOWjLneGEPbz1rhjwz2vQXjAr
dSxz/9ZWr3tcOXg0mYU3Dr2QKueUXvGmWMtBR+7WypZS2VTDbwmbIgma59yq
WPZwKZccPtOGrwoB8pwEpdYCFNJbbpa0KRYOzpfacaPpJfNScWMMTAJ5MkZT
8GORZYmKCOoBm6MKQMQixd01ElpuPLFJXdID0Lm+Gn+4ntzvw9Tzp+5hsVkr
oH2lO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