Bandit.HTTP2.Stream (Bandit v0.3.8) View Source

Carries out state management transitions per RFC7540§5.1. Anything having to do with the internal state of a stream is handled in this module. Note that sending of frames on behalf of a stream is a bit of a split responsibility: the stream itself may update state depending on the value of the end_stream flag (this is a stream concern and thus handled here), but the sending of the data over the wire is a connection concern as it must be serialized properly & is subject to flow control at a connection level

Link to this section Summary

Types

A description of a stream error

An HTTP/2 stream state

An HTTP/2 stream identifier

t()

A single HTTP/2 stream

Link to this section Types

Specs

error() :: {:stream, stream_id(), Bandit.HTTP2.Errors.error_code(), String.t()}

A description of a stream error

Specs

state() ::
  :reserved_local | :idle | :open | :local_closed | :remote_closed | :closed

An HTTP/2 stream state

Specs

stream_id() :: non_neg_integer()

An HTTP/2 stream identifier

Specs

t() :: %Bandit.HTTP2.Stream{
  pending_content_length: non_neg_integer() | nil,
  pid: pid() | nil,
  recv_window_size: non_neg_integer(),
  send_window_size: non_neg_integer(),
  state: state(),
  stream_id: stream_id()
}

A single HTTP/2 stream

Link to this section Functions

Link to this function

get_send_window_size(stream)

View Source

Specs

get_send_window_size(t()) :: non_neg_integer()

Specs

owner?(t(), pid()) :: :ok | {:error, :not_owner}

Specs

recv_data(t(), binary()) ::
  {:ok, t(), non_neg_integer()} | {:error, Bandit.HTTP2.Connection.error()}
Link to this function

recv_end_of_stream(stream, bool)

View Source

Specs

recv_end_of_stream(t(), boolean()) ::
  {:ok, t()} | {:error, Bandit.HTTP2.Connection.error()}
Link to this function

recv_headers(stream, trailers, arg3, peer, plug)

View Source

Specs

recv_headers(
  t(),
  Plug.Conn.headers(),
  boolean(),
  Plug.Conn.Adapter.peer_data(),
  Bandit.plug()
) :: {:ok, t()} | {:error, Bandit.HTTP2.Connection.error()} | {:error, error()}
Link to this function

recv_rst_stream(stream, error_code)

View Source

Specs

recv_rst_stream(t(), Bandit.HTTP2.Errors.error_code()) ::
  {:ok, t()} | {:error, Bandit.HTTP2.Connection.error()}
Link to this function

recv_window_update(stream, increment)

View Source

Specs

recv_window_update(t(), non_neg_integer()) ::
  {:ok, t()} | {:error, Bandit.HTTP2.Connection.error()} | {:error, error()}

Specs

send_data(t(), non_neg_integer()) ::
  {:ok, t()} | {:error, :insufficient_window_size} | {:error, :invalid_state}
Link to this function

send_end_of_stream(stream, bool)

View Source

Specs

send_end_of_stream(t(), boolean()) :: {:ok, t()} | {:error, :invalid_state}

Specs

send_headers(t()) :: {:ok, t()} | {:error, :invalid_state}
Link to this function

send_push_headers(stream, headers)

View Source

Specs

send_push_headers(t(), Plug.Conn.headers()) :: {:ok, t()} | {:error, error()}
Link to this function

start_push(stream, headers, peer, plug)

View Source

Specs

start_push(
  t(),
  Plug.Conn.headers(),
  Plug.Conn.Adapter.peer_data(),
  Bandit.plug()
) :: {:ok, t()}
Link to this function

stream_terminated(stream, reason)

View Source

Specs

stream_terminated(t(), term()) ::
  {:ok, t(), Bandit.HTTP2.Errors.error_code() | nil}
Link to this function

terminate_stream(stream, reason)

View Source

Specs

terminate_stream(t(), term()) :: :ok