NAME
Unblock::HTTP3::Capsule::Parser - incremental RFC 9297 Capsule parser
SYNOPSIS
my $parser = Unblock::HTTP3::Capsule::Parser->new;
$parser->feed($bytes);
while (my $capsule = $parser->next_capsule) {
...
}
$parser->finish;
DESCRIPTION
The parser accepts arbitrary chunks from an HTTP data stream. Capsule type, length, and value fields may be split across input chunks.
With no callbacks, complete Unblock::HTTP3::Capsule objects are queued for next_capsule.
Handlers can be registered for specific Capsule Types. An on_capsule callback can be used as a catch-all. Unknown unregistered types are skipped. GREASE Capsule Types are ignored and cannot be assigned application semantics.
CONSTRUCTOR
new
Useful options are:
handlers-
Hash reference mapping Capsule Types to callbacks.
on_capsule-
Catch-all callback for complete Capsules.
max_capsule_size-
Maximum retained Capsule Value size. The default is 4 MiB.
METHODS
feed
Adds bytes to the incremental parser.
Returns the Parser.
next_capsule
Returns the next queued Unblock::HTTP3::Capsule, or undef.
finish
Marks the input stream complete.
A truncated final Capsule is rejected.
is_finished
True after a clean finish.
SEE ALSO
Unblock::HTTP3::Capsule, Unblock::HTTP3::Capsule::Stream
AUTHOR
Joshua S. Day
LICENSE
This software is available under the MIT License.