NAME

Linux::Event::HTTP::Body::Stream - writable streaming HTTP body producer

DESCRIPTION

Applications obtain a Body::Stream from a Transaction. They do not construct it directly.

Client request body:

my $body = $operation->request_body;

Server response body:

my $body = $conn->transaction->response_body(
    on_drain  => sub ($body) { ... },
    on_cancel => sub ($body) { ... },
);

Write more bytes with:

my $can_continue = $body->write($bytes);

A false return means the bytes were accepted, but production should pause until on_drain runs.

Finish with:

$body->complete;

or provide final bytes:

$body->complete($final_bytes);

on_cancel runs if the exchange ends before production completes.

The same producer API is used by HTTP/1 and HTTP/2. Protocol-specific framing and flow control remain below this object.

SEE ALSO

Linux::Event::HTTP::Transaction, Linux::Event::HTTP::Client, Linux::Event::HTTP::Server.