NAME
Unblock::HTTP2::Transaction - one HTTP/2 request/response transaction
DESCRIPTION
A Transaction represents one HTTP request/response exchange carried by one multiplexed HTTP/2 stream.
request() returns the Uniform request. response() returns the Uniform response once one is available.
STREAMING BODIES
For a streaming local body:
$transaction->write($chunk);
$transaction->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:
$transaction->auto_consume(0);
$transaction->consume($bytes_processed);
unconsumed_bytes() reports body bytes still waiting for stream-level credit.
SERVER RESPONSES
A server Transaction can send an informational response with:
$transaction->inform($response);
The final response uses:
$transaction->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 Transaction preserves:
error
error_code
error_name
reset_by_peer
These facts are exposed for higher-level retry and policy decisions.
PRIORITY
Client Transactions 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:
stream_id
state
is_complete
is_cancelled
is_terminal
HTTP/2 half-close is preserved. One direction may finish before the full Transaction becomes terminal.
SEE ALSO
Unblock::HTTP2, Unblock::HTTP2::Client, Unblock::HTTP2::Server
LICENSE
MIT License.