target = "https://www.rfc-editor.org/rfc/rfc9000#section-19.8" # 19.8. STREAM Frames # # STREAM frames implicitly create a stream and carry stream data. The # Type field in the STREAM frame takes the form 0b00001XXX (or the set # of values from 0x08 to 0x0f). The three low-order bits of the frame # type determine the fields that are present in the frame: # # * The OFF bit (0x04) in the frame type is set to indicate that there # is an Offset field present. When set to 1, the Offset field is # present. When set to 0, the Offset field is absent and the Stream # Data starts at an offset of 0 (that is, the frame contains the # first bytes of the stream, or the end of a stream that includes no # data). # # * The LEN bit (0x02) in the frame type is set to indicate that there # is a Length field present. If this bit is set to 0, the Length # field is absent and the Stream Data field extends to the end of # the packet. If this bit is set to 1, the Length field is present. # # * The FIN bit (0x01) indicates that the frame marks the end of the # stream. The final size of the stream is the sum of the offset and # the length of this frame. # # An endpoint MUST terminate the connection with error # STREAM_STATE_ERROR if it receives a STREAM frame for a locally # initiated stream that has not yet been created, or for a send-only # stream. # # STREAM frames are formatted as shown in Figure 32. # # STREAM Frame { # Type (i) = 0x08..0x0f, # Stream ID (i), # [Offset (i)], # [Length (i)], # Stream Data (..), # } # # Figure 32: STREAM Frame Format # # STREAM frames contain the following fields: # # Stream ID: A variable-length integer indicating the stream ID of the # stream; see Section 2.1. # # Offset: A variable-length integer specifying the byte offset in the # stream for the data in this STREAM frame. This field is present # when the OFF bit is set to 1. When the Offset field is absent, # the offset is 0. # # Length: A variable-length integer specifying the length of the # Stream Data field in this STREAM frame. This field is present # when the LEN bit is set to 1. When the LEN bit is set to 0, the # Stream Data field consumes all the remaining bytes in the packet. # # Stream Data: The bytes from the designated stream to be delivered. # # When a Stream Data field has a length of 0, the offset in the STREAM # frame is the offset of the next byte that would be sent. # # The first byte in the stream has an offset of 0. The largest offset # delivered on a stream -- the sum of the offset and data length -- # cannot exceed 2^62-1, as it is not possible to provide flow control # credit for that data. Receipt of a frame that exceeds this limit # MUST be treated as a connection error of type FRAME_ENCODING_ERROR or # FLOW_CONTROL_ERROR. [[spec]] level = "MUST" quote = ''' An endpoint MUST terminate the connection with error STREAM_STATE_ERROR if it receives a STREAM frame for a locally initiated stream that has not yet been created, or for a send-only stream. ''' [[spec]] level = "MUST" quote = ''' Receipt of a frame that exceeds this limit MUST be treated as a connection error of type FRAME_ENCODING_ERROR or FLOW_CONTROL_ERROR. '''