<?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.26 (Ruby 3.1.3) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-thomson-webtrans-session-limit-00" category="info" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.17.0 -->
  <front>
    <title abbrev="WebTransport Session Limits">Applying Per-Session Limits for WebTransport</title>
    <seriesInfo name="Internet-Draft" value="draft-thomson-webtrans-session-limit-00"/>
    <author fullname="Martin Thomson">
      <organization>Mozilla</organization>
      <address>
        <email>mt@lowentropy.net</email>
      </address>
    </author>
    <author fullname="Eric Kinnear">
      <organization>Apple Inc.</organization>
      <address>
        <email>ekinnear@apple.com</email>
      </address>
    </author>
    <date year="2023" month="April" day="01"/>
    <area>Applications and Real-Time</area>
    <workgroup>WebTransport</workgroup>
    <keyword>next generation</keyword>
    <keyword>unicorn</keyword>
    <keyword>sparkling distributed ledger</keyword>
    <abstract>
      <t>Limits to how a WebTransport session uses QUIC resources like streams or data
can help limit the effect that one WebTransport session has on other uses of the
same HTTP/3 connection.  This describes mechanisms for limiting the number of
streams and quantity of data that can be consumed by each WebTransport session.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://martinthomson.github.io/wt-session-limits/draft-thomson-webtrans-session-limit.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-thomson-webtrans-session-limit/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        WebTransport Working Group mailing list (<eref target="mailto:webtransport@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/webtransport/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/webtransport/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/martinthomson/wt-session-limits"/>.</t>
    </note>
  </front>
  <middle>
    <section anchor="introduction">
      <name>Introduction</name>
      <t>WebTransport in HTTP/3 <xref target="WTH3"/> provides applications with all the functionality
of QUIC <xref target="QUIC"/> streams.  In the case where a single connection includes a
WebTransport session that needs to coexist with other WebTransport sessions or
HTTP requests, the core draft does not offer any way to place limits on stream
usage.</t>
      <t>This document describes an additional layer of session-level flow control that
governs the creation of streams and sets a session-level limit on the amount of
data that can be exchanged in a session.</t>
      <t>This document does not define a framework for prioritizing the streams created
for a WebTransport session with other streams.</t>
      <t>Note that this document is intended as input for <xref target="WTH3"/>. Although it is
possible to define this as an extension to that protocol, integration of this
design is simpler; see <xref target="negotiation"/>.</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="protocol-definition">
      <name>Protocol Definition</name>
      <t>This document uses the following flow control capsules defined in <xref target="WTH2"/>:</t>
      <ul spacing="normal">
        <li>WT_MAX_DATA (<xref section="5.5" sectionFormat="of" target="WTH2"/>)</li>
        <li>WT_MAX_STREAMS (<xref section="5.7" sectionFormat="of" target="WTH2"/>)</li>
        <li>WT_DATA_BLOCKED (<xref section="5.8" sectionFormat="of" target="WTH2"/>)</li>
        <li>WT_STREAMS_BLOCKED (<xref section="5.10" sectionFormat="of" target="WTH2"/>)</li>
      </ul>
      <t>These capsules are unchanged, except that where the WebTransport over HTTP/2
capsules refer to streams that flow over the HTTP/2 stream containing the
entire WebTransport session, these capsules refer to separate limits as
described in subsequent sections.</t>
      <t>These capsules use the codepoints allocated in <xref target="WTH2"/>.</t>
      <section anchor="stream-limits">
        <name>Stream Limits</name>
        <t>The WT_MAX_STREAMS capsule establishes a limit on the number of streams within a
WebTransport session.  Like the QUIC MAX_STREAMS frame (<xref section="19.11" sectionFormat="of" target="QUIC"/>), this capsule has two types that provide separate limits for
unidirectional and bidirectional streams that are initiated by a peer.</t>
        <t>The session-level stream limit applies in addition to the QUIC MAX_STREAMS
frame, which provides a connection-level stream limit.  New streams can only be
created within the session if both the stream- and the connection-level limit
permit; see <xref section="4.6" sectionFormat="of" target="QUIC"/> for details on how QUIC stream limits are
applied.</t>
        <t>Unlike the WT_MAX_STREAMS capsule or the QUIC MAX_STREAMS frame, there is no
simple relationship between the value in this frame and stream IDs in QUIC
STREAM frames.  This especially applies if there are other users of streams on
the connection.</t>
        <t>The WT_STREAMS_BLOCKED capsule is sent to indicate that an endpoint was unable
to create a stream due to the session-level stream limit.</t>
      </section>
      <section anchor="data-limits">
        <name>Data Limits</name>
        <t>The WT_MAX_DATA capsule establishes a limit on the amount of data that can be
sent within a WebTransport session.  This limit counts all data that is sent on
streams of the corresponding type, excluding the stream header (see Sections <xref target="WTH3" section="4.2" sectionFormat="bare"/> and <xref target="WTH3" section="4.2" sectionFormat="bare"/> of <xref target="WTH3"/>).  The stream header is excluded from this limit so that
this limit does not prevent the sending of information that is essential in
linking new streams to a specific WebTransport session.</t>
        <t>Implementing WT_MAX_DATA requires that the QUIC stack provide the WebTransport
implementation with information about the final size of streams; see <xref section="4.5" sectionFormat="of" target="QUIC"/>.</t>
        <t>The WT_DATA_BLOCKED capsule is sent to indicate that an endpoint was unable to
send data due to a limit set by the WT_MAX_DATA capsule.</t>
        <t>Because WebTransport over HTTP/3 uses a native QUIC stream for each WebTransport
stream, per-stream data limits are provided by QUIC natively.  The
WT_MAX_STREAM_DATA and WT_STREAM_DATA_BLOCKED capsules are not used and so are
prohibited.  Endpoints <bcp14>MUST</bcp14> treat receipt of a WT_MAX_STREAM_DATA or a
WT_STREAM_DATA_BLOCKED capsule as a session error.</t>
      </section>
    </section>
    <section anchor="negotiation">
      <name>Negotiation</name>
      <t>If the use of flow control capsules are merged into the main specification
<xref target="WTH3"/>, their use will be negotiated along with the use of WebTransport over
HTTP/3.  This is the simplest approach.</t>
      <t>Alternatively, if this remains as an optional extension, new HTTP/3 settings
will be needed to negotiate the use of these features.  In the abstract, we
could define settings that carry initial values for the three variables that are
controlled by the session-level flow control capsules defined here.  The
presence of any of those settings would indicate that these limits will be
respected if the capsule is sent.</t>
      <t>Both peers need to indicate the setting before these capsules apply.  If only
one peer advertises any of these settings, that might indicate that they are
willing to receive and respect session-level flow control capsules.  However,
such an endpoint cannot know when to start applying the limit.</t>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>Aside from new exposure to the usual programming errors arising from increased
protocol complexity, it is believed that the introduction of these capabilities
only improves security as it provides better control over endpoint resource
allocation.</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="WTH3">
        <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="13" month="March" 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-05"/>
      </reference>
      <reference anchor="WTH2">
        <front>
          <title>WebTransport over HTTP/2</title>
          <author fullname="Alan Frindell" initials="A." surname="Frindell">
            <organization>Facebook Inc.</organization>
          </author>
          <author fullname="Eric Kinnear" initials="E." surname="Kinnear">
            <organization>Apple Inc.</organization>
          </author>
          <author fullname="Tommy Pauly" initials="T." surname="Pauly">
            <organization>Apple Inc.</organization>
          </author>
          <author fullname="Martin Thomson" initials="M." surname="Thomson">
            <organization>Mozilla</organization>
          </author>
          <author fullname="Victor Vasiliev" initials="V." surname="Vasiliev">
            <organization>Google</organization>
          </author>
          <author fullname="Guowu Xie" initials="G." surname="Xie">
            <organization>Facebook Inc.</organization>
          </author>
          <date day="13" month="March" year="2023"/>
          <abstract>
            <t>   WebTransport defines a set of low-level communications features
   designed for client-server interactions that are initiated by Web
   clients.  This document describes a protocol that can provide many of
   the capabilities of WebTransport over HTTP/2.  This protocol enables
   the use of WebTransport when a UDP-based protocol is not available.

            </t>
          </abstract>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-ietf-webtrans-http2-05"/>
      </reference>
      <reference anchor="QUIC">
        <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="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:
H4sIAAAAAAAAA51Z23LbOBJ9x1dglZfJlCTHTrIz8V4qiu1MXONL1lYqO7W1
lYJISEKZBDgAaUVx5V/2W+bL5nSDpEhJTqX2JZYooK+nu08zo9FIlKbM9LEc
TIoiWxu7kO+1H93qEIyz8sLkpgxy7rz8qGdTr2wonC8HQs1mXt/jWvex7F8b
iESVeuH8+lgaO3dCpC6xKoe21Kt5OSqXLg/OjlZ6VpKMUYj3RxndHz17JkI1
yw0/K9cF7p2fTd9K+USqLDgoNzbVhcY/thwM5eB88gZ/YOvg/Gb6diBslc+0
PxYpzDgWibNB21CFY1n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