NAME
Unblock::HTTP2::Stream - one HTTP/2 stream
DESCRIPTION
A Stream represents one multiplexed HTTP/2 request/response exchange.
request() returns the Uniform request. response() returns the Uniform response once one is available.
STREAMING BODIES
For a streaming local body:
$stream->write($chunk);
$stream->end($last_chunk);
write() always accepts the bytes. A false return means the cooperative high-water mark was reached. Wait for on_drain before producing more.
Incoming body bytes are consumed automatically after the body callback returns.
For manual receive flow control:
$stream->auto_consume(0);
$stream->consume($bytes_processed);
unconsumed_bytes() reports body bytes still waiting for stream-level credit.
SERVER RESPONSES
A server Stream can send an informational response with:
$stream->inform($response);
The final response uses:
$stream->respond($response);
Pass stream_body => 1 to respond() to produce the response body with write() and end().
RESETS
cancel() sends the standard HTTP/2 CANCEL reset.
reset($error_code) sends an explicit RST_STREAM reason.
The Stream preserves:
error
error_code
error_name
reset_by_peer
These facts are exposed for higher-level retry and policy decisions.
PRIORITY
Client Streams can use update_priority($field_value) to send an RFC 9218 PRIORITY_UPDATE after the peer has enabled modern priorities.
STATE
Useful state accessors include:
id
state
is_complete
is_cancelled
is_terminal
HTTP/2 half-close is preserved. One direction may finish before the full Stream becomes terminal.
SEE ALSO
Unblock::HTTP2, Unblock::HTTP2::Client, Unblock::HTTP2::Server
LICENSE
MIT License.