NAME
Unblock::HTTP3::Body::Reader - readable incoming HTTP/3 body stream
SYNOPSIS
my $body = $tx->response_body(
on_data => sub {
my ($body, $chunk) = @_;
process($chunk);
},
on_end => sub {
my ($body) = @_;
...
},
);
Or poll it:
while (defined(my $chunk = $body->next_chunk)) {
process($chunk);
}
DESCRIPTION
A Body::Reader exposes an incoming HTTP/3 body without buffering the complete body in the Request or Response object.
Consuming a chunk returns the corresponding QUIC receive credit. In callback mode, credit is returned after on_data returns.
Body::Reader objects are created by Unblock::HTTP3::Transaction. Applications do not construct them directly.
METHODS
next_chunk
Returns the next queued body chunk, or undef when no chunk is currently available.
pending_bytes
Returns the number of queued body bytes not yet consumed by the application.
is_complete
True after the peer has ended the body and all queued chunks have been consumed.
is_cancelled
True if the Transaction ended before the body reader completed normally.
SEE ALSO
Unblock::HTTP3::Transaction, Unblock::HTTP3::Body::Stream, Uniform::HTTP
AUTHOR
Joshua S. Day
LICENSE
This software is available under the MIT License.