Module

whiplash/http2

src/whiplash/http2.pooka

HTTP/2, many streams down one connection (RFC 9113).

Two layers, both sans-IO. The frame codec reads and writes the ten frame types of section 6. The Connection above it keeps everything a server must agree on with its peer: settings, stream states, the HPACK contexts and both directions of flow control. Bytes go in with receive, events come out; responses go in with respond and send_data, and flush writes whatever the peer's windows allow.

Cleartext HTTP/2 with prior knowledge (h2c) and HTTP/2 over TLS chosen by ALPN look the same from here: both start with the client's preface.

API reference

function

preface

src/whiplash/http2.pooka:27
preface() -> BitArray
INFERREDfn() -> BitArray

The connection preface every client sends first (section 3.4).

enum

ErrorCode

src/whiplash/http2.pooka:32
enum ErrorCode

The error codes of section 7.

variant

NoError

src/whiplash/http2.pooka:33
ErrorCode.NoError
variant

ProtocolError

src/whiplash/http2.pooka:34
ErrorCode.ProtocolError
variant

InternalError

src/whiplash/http2.pooka:35
ErrorCode.InternalError
variant

FlowControlError

src/whiplash/http2.pooka:36
ErrorCode.FlowControlError
variant

SettingsTimeout

src/whiplash/http2.pooka:37
ErrorCode.SettingsTimeout
variant

StreamClosed

src/whiplash/http2.pooka:38
ErrorCode.StreamClosed
variant

FrameSizeError

src/whiplash/http2.pooka:39
ErrorCode.FrameSizeError
variant

RefusedStream

src/whiplash/http2.pooka:40
ErrorCode.RefusedStream
variant

Cancel

src/whiplash/http2.pooka:41
ErrorCode.Cancel
variant

CompressionError

src/whiplash/http2.pooka:42
ErrorCode.CompressionError
variant

ConnectError

src/whiplash/http2.pooka:43
ErrorCode.ConnectError
variant

EnhanceYourCalm

src/whiplash/http2.pooka:44
ErrorCode.EnhanceYourCalm
variant

InadequateSecurity

src/whiplash/http2.pooka:45
ErrorCode.InadequateSecurity
variant

Http11Required

src/whiplash/http2.pooka:46
ErrorCode.Http11Required
class

Setting

src/whiplash/http2.pooka:51
class Setting(id: Int, value: Int)

A setting's identifier and value (section 6.5.2, and RFC 8441's SETTINGS_ENABLE_CONNECT_PROTOCOL, 0x8).

field

id

src/whiplash/http2.pooka:51
id: Int
INFERREDInt
field

value

src/whiplash/http2.pooka:51
value: Int
INFERREDInt
constructor

new

src/whiplash/http2.pooka:51
INFERREDfn(Int, Int) -> whiplash/http2.Setting
class

Settings

src/whiplash/http2.pooka:54
class Settings(
  header_table_size: Int,
  enable_push: Bool,
  max_concurrent_streams: Int,
  initial_window_size: Int,
  max_frame_size: Int,
  max_header_list_size: Int,
  enable_connect_protocol: Bool
)

What one end announces in its SETTINGS frame.

field

header_table_size

src/whiplash/http2.pooka:55
header_table_size: Int
INFERREDInt
field

enable_push

src/whiplash/http2.pooka:56
enable_push: Bool
INFERREDBool
field

max_concurrent_streams

src/whiplash/http2.pooka:57
max_concurrent_streams: Int
INFERREDInt
field

initial_window_size

src/whiplash/http2.pooka:58
initial_window_size: Int
INFERREDInt
field

max_frame_size

src/whiplash/http2.pooka:59
max_frame_size: Int
INFERREDInt
field

max_header_list_size

src/whiplash/http2.pooka:60
max_header_list_size: Int
INFERREDInt
field

enable_connect_protocol

src/whiplash/http2.pooka:61
enable_connect_protocol: Bool
INFERREDBool
constructor

new

src/whiplash/http2.pooka:55
INFERREDfn(Int, Bool, Int, Int, Int, Int, Bool) -> whiplash/http2.Settings
class

Frame

src/whiplash/http2.pooka:65
class Frame

One frame (section 6).

class

Data

src/whiplash/http2.pooka:67
class Data(stream: Int, end_stream: Bool, data: BitArray) is Frame
field

stream

src/whiplash/http2.pooka:67
stream: Int
INFERREDInt
field

end_stream

src/whiplash/http2.pooka:67
end_stream: Bool
INFERREDBool
field

data

src/whiplash/http2.pooka:67
data: BitArray
INFERREDBitArray
constructor

new

src/whiplash/http2.pooka:67
INFERREDfn(Int, Bool, BitArray) -> whiplash/http2.Data
class

Headers

src/whiplash/http2.pooka:69
class Headers(
  stream: Int,
  end_stream: Bool,
  end_headers: Bool,
  block: BitArray
) is Frame
field

stream

src/whiplash/http2.pooka:70
stream: Int
INFERREDInt
field

end_stream

src/whiplash/http2.pooka:71
end_stream: Bool
INFERREDBool
field

end_headers

src/whiplash/http2.pooka:72
end_headers: Bool
INFERREDBool
field

block

src/whiplash/http2.pooka:73
block: BitArray
INFERREDBitArray
constructor

new

src/whiplash/http2.pooka:70
INFERREDfn(Int, Bool, Bool, BitArray) -> whiplash/http2.Headers
class

Priority

src/whiplash/http2.pooka:76
class Priority(stream: Int, depends_on: Int, exclusive: Bool, weight: Int) is Frame
field

stream

src/whiplash/http2.pooka:76
stream: Int
INFERREDInt
field

depends_on

src/whiplash/http2.pooka:76
depends_on: Int
INFERREDInt
field

exclusive

src/whiplash/http2.pooka:76
exclusive: Bool
INFERREDBool
field

weight

src/whiplash/http2.pooka:76
weight: Int
INFERREDInt
constructor

new

src/whiplash/http2.pooka:76
INFERREDfn(Int, Int, Bool, Int) -> whiplash/http2.Priority
class

RstStream

src/whiplash/http2.pooka:78
class RstStream(stream: Int, code: ErrorCode) is Frame
field

stream

src/whiplash/http2.pooka:78
stream: Int
INFERREDInt
field

code

src/whiplash/http2.pooka:78
code: ErrorCode
constructor

new

src/whiplash/http2.pooka:78
class

SettingsFrame

src/whiplash/http2.pooka:80
class SettingsFrame(ack: Bool, settings: List(Setting)) is Frame
field

ack

src/whiplash/http2.pooka:80
ack: Bool
INFERREDBool
field

settings

src/whiplash/http2.pooka:80
settings: List(Setting)
constructor

new

src/whiplash/http2.pooka:80
class

PushPromise

src/whiplash/http2.pooka:82
class PushPromise(
  stream: Int,
  promised: Int,
  end_headers: Bool,
  block: BitArray
) is Frame
field

stream

src/whiplash/http2.pooka:83
stream: Int
INFERREDInt
field

promised

src/whiplash/http2.pooka:84
promised: Int
INFERREDInt
field

end_headers

src/whiplash/http2.pooka:85
end_headers: Bool
INFERREDBool
field

block

src/whiplash/http2.pooka:86
block: BitArray
INFERREDBitArray
constructor

new

src/whiplash/http2.pooka:83
INFERREDfn(Int, Int, Bool, BitArray) -> whiplash/http2.PushPromise
class

Ping

src/whiplash/http2.pooka:89
class Ping(ack: Bool, opaque: BitArray) is Frame
field

ack

src/whiplash/http2.pooka:89
ack: Bool
INFERREDBool
field

opaque

src/whiplash/http2.pooka:89
opaque: BitArray
INFERREDBitArray
constructor

new

src/whiplash/http2.pooka:89
INFERREDfn(Bool, BitArray) -> whiplash/http2.Ping
class

Goaway

src/whiplash/http2.pooka:91
class Goaway(last_stream: Int, code: ErrorCode, debug: BitArray) is Frame
field

last_stream

src/whiplash/http2.pooka:91
last_stream: Int
INFERREDInt
field

code

src/whiplash/http2.pooka:91
code: ErrorCode
field

debug

src/whiplash/http2.pooka:91
debug: BitArray
INFERREDBitArray
constructor

new

src/whiplash/http2.pooka:91
INFERREDfn(Int, whiplash/http2.ErrorCode, BitArray) -> whiplash/http2.Goaway
class

WindowUpdate

src/whiplash/http2.pooka:93
class WindowUpdate(stream: Int, increment: Int) is Frame
field

stream

src/whiplash/http2.pooka:93
stream: Int
INFERREDInt
field

increment

src/whiplash/http2.pooka:93
increment: Int
INFERREDInt
constructor

new

src/whiplash/http2.pooka:93
INFERREDfn(Int, Int) -> whiplash/http2.WindowUpdate
class

Continuation

src/whiplash/http2.pooka:95
class Continuation(stream: Int, end_headers: Bool, block: BitArray) is Frame
field

stream

src/whiplash/http2.pooka:95
stream: Int
INFERREDInt
field

end_headers

src/whiplash/http2.pooka:95
end_headers: Bool
INFERREDBool
field

block

src/whiplash/http2.pooka:95
block: BitArray
INFERREDBitArray
constructor

new

src/whiplash/http2.pooka:95
INFERREDfn(Int, Bool, BitArray) -> whiplash/http2.Continuation
class

Unknown

src/whiplash/http2.pooka:98
class Unknown(kind: Int, flags: Int, stream: Int, payload: BitArray) is Frame

A frame of a type this end does not know, which it must ignore.

field

kind

src/whiplash/http2.pooka:98
kind: Int
INFERREDInt
field

flags

src/whiplash/http2.pooka:98
flags: Int
INFERREDInt
field

stream

src/whiplash/http2.pooka:98
stream: Int
INFERREDInt
field

payload

src/whiplash/http2.pooka:98
payload: BitArray
INFERREDBitArray
constructor

new

src/whiplash/http2.pooka:98
INFERREDfn(Int, Int, Int, BitArray) -> whiplash/http2.Unknown
class

Http2Error

src/whiplash/http2.pooka:101
class Http2Error(code: ErrorCode, message: String)

A connection error: the connection ends with GOAWAY and this code.

field

code

src/whiplash/http2.pooka:101
code: ErrorCode
field

message

src/whiplash/http2.pooka:101
message: String
INFERREDString
constructor

new

src/whiplash/http2.pooka:101
class

Event

src/whiplash/http2.pooka:104
class Event

What the peer did, as the server sees it.

class

Request

src/whiplash/http2.pooka:107
class Request(stream: Int, fields: List(hpack.Field), end_stream: Bool) is Event

A request's header fields, decoded and checked (section 8.3.1).

field

stream

src/whiplash/http2.pooka:107
stream: Int
INFERREDInt
field

fields

src/whiplash/http2.pooka:107
fields: List(hpack.Field)
INFERREDList(whiplash/hpack.Field)
field

end_stream

src/whiplash/http2.pooka:107
end_stream: Bool
INFERREDBool
constructor

new

src/whiplash/http2.pooka:107
INFERREDfn(Int, List(whiplash/hpack.Field), Bool) -> whiplash/http2.Request
class

Body

src/whiplash/http2.pooka:110
class Body(stream: Int, data: BitArray, end_stream: Bool) is Event

Part of a request's body.

field

stream

src/whiplash/http2.pooka:110
stream: Int
INFERREDInt
field

data

src/whiplash/http2.pooka:110
data: BitArray
INFERREDBitArray
field

end_stream

src/whiplash/http2.pooka:110
end_stream: Bool
INFERREDBool
constructor

new

src/whiplash/http2.pooka:110
INFERREDfn(Int, BitArray, Bool) -> whiplash/http2.Body
class

RequestTrailers

src/whiplash/http2.pooka:113
class RequestTrailers(stream: Int, fields: List(hpack.Field)) is Event

Trailer fields, ending the request.

field

stream

src/whiplash/http2.pooka:113
stream: Int
INFERREDInt
field

fields

src/whiplash/http2.pooka:113
fields: List(hpack.Field)
INFERREDList(whiplash/hpack.Field)
constructor

new

src/whiplash/http2.pooka:113
class

StreamReset

src/whiplash/http2.pooka:116
class StreamReset(stream: Int, code: ErrorCode) is Event

The peer reset a stream, or this end did because it was malformed.

field

stream

src/whiplash/http2.pooka:116
stream: Int
INFERREDInt
field

code

src/whiplash/http2.pooka:116
code: ErrorCode
constructor

new

src/whiplash/http2.pooka:116
class

SettingsAcknowledged

src/whiplash/http2.pooka:121
class SettingsAcknowledged is Event

The peer acknowledged our SETTINGS. The runtime owns the deadline; the protocol reports the acknowledgement only after the entire frame is valid. https://www.rfc-editor.org/rfc/rfc9113.html#section-6.5.3

class

PeerGoaway

src/whiplash/http2.pooka:124
class PeerGoaway(last_stream: Int, code: ErrorCode) is Event

The peer is going away.

field

last_stream

src/whiplash/http2.pooka:124
last_stream: Int
INFERREDInt
field

code

src/whiplash/http2.pooka:124
code: ErrorCode
constructor

new

src/whiplash/http2.pooka:124
enum

StreamState

src/whiplash/http2.pooka:127
enum StreamState

The state of one stream (section 5.1).

variant

Idle

src/whiplash/http2.pooka:128
StreamState.Idle
variant

Open

src/whiplash/http2.pooka:129
StreamState.Open
variant

HalfClosedRemote

src/whiplash/http2.pooka:130
StreamState.HalfClosedRemote
variant

HalfClosedLocal

src/whiplash/http2.pooka:131
StreamState.HalfClosedLocal
variant

Closed

src/whiplash/http2.pooka:132
StreamState.Closed
class

Stream

src/whiplash/http2.pooka:137
class Stream(
  id: Int,
  state: StreamState,
  send_window: Int,
  receive_window: Int,
  pending: BitArray,
  pending_end: Bool,
  expected: Int,
  received: Int
)

One stream: its state, both windows, data waiting for window, and the request's declared and received body lengths (-1 when undeclared).

field

id

src/whiplash/http2.pooka:138
id: Int
INFERREDInt
field

state

src/whiplash/http2.pooka:139
state: StreamState
field

send_window

src/whiplash/http2.pooka:140
send_window: Int
INFERREDInt
field

receive_window

src/whiplash/http2.pooka:141
receive_window: Int
INFERREDInt
field

pending

src/whiplash/http2.pooka:142
pending: BitArray
INFERREDBitArray
field

pending_end

src/whiplash/http2.pooka:143
pending_end: Bool
INFERREDBool
field

expected

src/whiplash/http2.pooka:144
expected: Int
INFERREDInt
field

received

src/whiplash/http2.pooka:145
received: Int
INFERREDInt
constructor

new

src/whiplash/http2.pooka:138
INFERREDfn(Int, whiplash/http2.StreamState, Int, Int, BitArray, Bool, Int, Int) -> whiplash/http2.Stream
class

Connection

src/whiplash/http2.pooka:152
class Connection(
  local: Settings,
  remote: Settings,
  decoder: hpack.Decoder,
  encoder: hpack.Encoder,
  streams: Dict(Int, Stream),
  last_stream: Int,
  send_window: Int,
  receive_window: Int,
  buffer: BitArray,
  phase: Int,
  headers_in_progress: Option(#(Int, BitArray, Bool)),
  closed: List(Int),
  queue: List(Int),
  going_away: Bool,
  manual_credit: Bool,
  pending_credit: Dict(Int, Int),
  priorities: Dict(Int, #(Int, Bool))
)

One connection, from the server's side. phase is 0 before the client's preface, 1 until its first SETTINGS, then 2. closed holds the ranges of client identifiers skipped over, as low/high pairs: every other identifier up to last_stream was used and is now closed or open.

field

local

src/whiplash/http2.pooka:153
local: Settings
field

remote

src/whiplash/http2.pooka:154
remote: Settings
field

decoder

src/whiplash/http2.pooka:155
decoder: hpack.Decoder
field

encoder

src/whiplash/http2.pooka:156
encoder: hpack.Encoder
field

streams

src/whiplash/http2.pooka:157
streams: Dict(Int, Stream)
INFERRED$package/pooka_stdlib/pooka/dict.Dict(Int, whiplash/http2.Stream)
field

last_stream

src/whiplash/http2.pooka:158
last_stream: Int
INFERREDInt
field

send_window

src/whiplash/http2.pooka:159
send_window: Int
INFERREDInt
field

receive_window

src/whiplash/http2.pooka:160
receive_window: Int
INFERREDInt
field

buffer

src/whiplash/http2.pooka:161
buffer: BitArray
INFERREDBitArray
field

phase

src/whiplash/http2.pooka:162
phase: Int
INFERREDInt
field

headers_in_progress

src/whiplash/http2.pooka:163
headers_in_progress: Option(#(Int, BitArray, Bool))
INFERREDOption(#(Int, BitArray, Bool))
field

closed

src/whiplash/http2.pooka:164
closed: List(Int)
INFERREDList(Int)
field

queue

src/whiplash/http2.pooka:165
queue: List(Int)
INFERREDList(Int)
field

going_away

src/whiplash/http2.pooka:166
going_away: Bool
INFERREDBool
field

manual_credit

src/whiplash/http2.pooka:167
manual_credit: Bool
INFERREDBool
field

pending_credit

src/whiplash/http2.pooka:168
pending_credit: Dict(Int, Int)
INFERRED$package/pooka_stdlib/pooka/dict.Dict(Int, Int)
field

priorities

src/whiplash/http2.pooka:169
priorities: Dict(Int, #(Int, Bool))
INFERRED$package/pooka_stdlib/pooka/dict.Dict(Int, #(Int, Bool))
constructor

new

src/whiplash/http2.pooka:153
INFERREDfn(whiplash/http2.Settings, whiplash/http2.Settings, whiplash/hpack.Decoder, whiplash/hpack.Encoder, $package/pooka_stdlib/pooka/dict.Dict(Int, whiplash/http2.Stream), Int, Int, Int, BitArray, Int, Option(#(Int, BitArray, Bool)), List(Int), List(Int), Bool, Bool, $package/pooka_stdlib/pooka/dict.Dict(Int, Int), $package/pooka_stdlib/pooka/dict.Dict(Int, #(Int, Bool))) -> whiplash/http2.Connection
function

default_settings

src/whiplash/http2.pooka:174
default_settings() -> Settings
INFERREDfn() -> whiplash/http2.Settings

The defaults of section 6.5.2: 4096, push on, no stream limit, 65535, 16384, no header list limit.

function

server_settings

src/whiplash/http2.pooka:180
server_settings() -> Settings
INFERREDfn() -> whiplash/http2.Settings

Settings for a server: no push, 100 concurrent streams, extended CONNECT for WebSockets over HTTP/2.

function

error_code

src/whiplash/http2.pooka:191
error_code(code: ErrorCode) -> Int
INFERREDfn(whiplash/http2.ErrorCode) -> Int

An error code's number on the wire.

function

code_of

src/whiplash/http2.pooka:212
code_of(value: Int) -> ErrorCode
INFERREDfn(Int) -> whiplash/http2.ErrorCode

The error code for a number. Unknown codes mean INTERNAL_ERROR (section 7).

function

encode_frame

src/whiplash/http2.pooka:234
encode_frame(frame: Frame) -> BitArray
INFERREDfn(whiplash/http2.Frame) -> BitArray

The bytes of one frame.

function

decode_frame

src/whiplash/http2.pooka:320
decode_frame(bytes: BitArray, max_frame_size: Int) -> Result(
  Option(#(Frame, BitArray)),
  Http2Error
)
INFERREDfn(BitArray, Int) -> Result(Option(#(whiplash/http2.Frame, BitArray)), whiplash/http2.Http2Error)

One frame from the front of the bytes, and the bytes after it. Ok(None) when the frame has not fully arrived. Frames over max_frame_size are a FRAME_SIZE_ERROR.

function

server

src/whiplash/http2.pooka:525
server(settings: Settings) -> #(Connection, BitArray)

A server's connection, and the SETTINGS frame to send at once.

function

connection_window

src/whiplash/http2.pooka:574
connection_window() -> Int
INFERREDfn() -> Int

The connection-level receive window this end keeps open: 1 MiB, refilled whenever half of it has been used. Each stream still has its own window.

function

after_preface

src/whiplash/http2.pooka:580
after_preface(connection: Connection) -> Connection

A server's connection after an HTTP/1.1 upgrade or ALPN, when the preface has already been read by someone else.

function

receive

src/whiplash/http2.pooka:588
receive(connection: Connection, bytes: BitArray) -> Result(
  #(List(Event), BitArray, Connection),
  #(Http2Error, BitArray)
)
INFERREDfn(whiplash/http2.Connection, BitArray) -> Result(#(List(whiplash/http2.Event), BitArray, whiplash/http2.Connection), #(whiplash/http2.Http2Error, BitArray))

Feed bytes from the peer. Returns the events, the bytes to write back (SETTINGS and PING acknowledgements, RST_STREAM, WINDOW_UPDATE), and the connection. A connection error carries the GOAWAY to write before closing.

function

respond

src/whiplash/http2.pooka:1460
respond(
  connection: Connection,
  stream: Int,
  status: Int,
  headers: List(hpack.Field),
  end_stream: Bool
) -> #(BitArray, Connection)
INFERREDfn(whiplash/http2.Connection, Int, Int, List(whiplash/hpack.Field), Bool) -> #(BitArray, whiplash/http2.Connection)

Respond on a stream: a HEADERS frame, and CONTINUATION frames if the block is larger than the peer's frame size.

function

send_data

src/whiplash/http2.pooka:1512
send_data(
  connection: Connection,
  stream: Int,
  data: BitArray,
  end_stream: Bool
) -> Connection
INFERREDfn(whiplash/http2.Connection, Int, BitArray, Bool) -> whiplash/http2.Connection

Queue body bytes on a stream. Nothing is written until flush.

function

flush

src/whiplash/http2.pooka:1549
flush(connection: Connection) -> #(BitArray, Connection)

Write every queued byte the windows allow, as DATA frames no larger than the peer's frame size, by RFC 9218 priority: lower urgency first; within an urgency, non-incremental streams one after another in identifier order, then incremental streams sharing what is left a frame at a time. Without priorities every stream has urgency 3, non-incremental.

function

flush_parts

src/whiplash/http2.pooka:1556
flush_parts(connection: Connection) -> #(List(BitArray), Connection)
INFERREDfn(whiplash/http2.Connection) -> #(List(BitArray), whiplash/http2.Connection)

flush, as parts to write in order (frame headers and slices of the queued data), so a socket can send them without copying the data again.

function

priority

src/whiplash/http2.pooka:1576
priority(connection: Connection, stream: Int) -> #(Int, Bool)
INFERREDfn(whiplash/http2.Connection, Int) -> #(Int, Bool)

The urgency (0 to 7) and incremental flag of a stream.

function

respond_with_body

src/whiplash/http2.pooka:1825
respond_with_body(
  connection: Connection,
  stream: Int,
  status: Int,
  headers: List(hpack.Field),
  body: BitArray,
  has_body: Bool
) -> #(BitArray, Connection)
INFERREDfn(whiplash/http2.Connection, Int, Int, List(whiplash/hpack.Field), BitArray, Bool) -> #(BitArray, whiplash/http2.Connection)

A whole response at once: HEADERS, then as much of the body as the windows allow, the rest queued for flush. A HEAD or bodyless response passes an empty body and has_body False.

function

respond_queued

src/whiplash/http2.pooka:1853
respond_queued(
  connection: Connection,
  stream: Int,
  status: Int,
  headers: List(hpack.Field),
  body: BitArray,
  has_body: Bool
) -> #(BitArray, Connection)
INFERREDfn(whiplash/http2.Connection, Int, Int, List(whiplash/hpack.Field), BitArray, Bool) -> #(BitArray, whiplash/http2.Connection)

HEADERS now, and the body queued for the next flush_parts, which sends it as slices without copying it. The returned bytes must be written before what that flush returns.

function

reset

src/whiplash/http2.pooka:1877
reset(connection: Connection, stream: Int, code: ErrorCode) -> #(
  BitArray,
  Connection
)

Reset a stream.

function

goaway

src/whiplash/http2.pooka:1889
goaway(connection: Connection, code: ErrorCode) -> #(BitArray, Connection)

Start a graceful shutdown: GOAWAY with the last stream accepted, so the ones in flight may finish (section 6.8).

function

is_idle

src/whiplash/http2.pooka:1897
is_idle(connection: Connection) -> Bool
INFERREDfn(whiplash/http2.Connection) -> Bool

Whether no stream is open, so a connection that is going away may close.

function

manual_flow_control

src/whiplash/http2.pooka:2287
manual_flow_control(connection: Connection) -> Connection

Opt into application-controlled stream credit before the first receive. Connection credit stays automatic, so one slow stream cannot stop other streams. Consume each delivered DATA payload, or reset its stream.

function

pending_input

src/whiplash/http2.pooka:2292
pending_input(connection: Connection, stream: Int) -> Int
INFERREDfn(whiplash/http2.Connection, Int) -> Int
function

consume

src/whiplash/http2.pooka:2299
consume(connection: Connection, stream: Int, count: Int) -> Result(
  #(BitArray, Connection),
  String
)
INFERREDfn(whiplash/http2.Connection, Int, Int) -> Result(#(BitArray, whiplash/http2.Connection), String)

Return stream credit only after the application takes ownership of bytes. Padding is consumed automatically; do not count it again. Closed/reset streams need no further stream window, but their accounting is still freed.