POE::F...PChunk(3pm)
okay bestie, sit down, we're doing HTTP chunk parsing today and honestly? it's giving main character energy.
Before we even get to the β¨officialβ¨ stuff, here's the literal code-flavoured intro from the top of the file β copied exactly, no edits, no cap, because we do not touch regexes with our bare hands:
my $TEXT = qr/[^[:cntrl:]]/o; my $qdtext = qr/[^[:cntrl:]\"]/o; #<any TEXT
except <">> my $quoted_pair = qr/\\[[:ascii:]]/o; my $quoted_string =
qr/\"(?:$qdtext|$quoted_pair)\"/o; my $separators = "[^()<>@,;:\\"\/\[\]\?={}
\t"; my $notoken = qr/(?:[[:cntrl:]$separators]/o;
my $chunk_ext_name = $token; my $chunk_ext_val =
qr/(?:$token|$quoted_string)/o;
my $chunk_extension = qr/(?:;$chunk_ext_name(?:$chunk_ext_val)?)/o;
sub put {
die "not implemented yet"; }
π NAME π
POE::Filter::HTTPChunk β the non-blocking, incremental HTTP chunk parser. It eats chunks a lil bit at a time and never blocks. Periodt.
πΈ VERSION πΈ
version 0.949 π
β¨ SYNOPSIS β¨
Heads up bestie: this is not a complete program. It's a vibe sample.
# Not a complete program.
use POE::Filter::HTTPChunk;
use POE::Wheel::ReadWrite;
sub setup_io {
$_[HEAP]->{io_wheel} = POE::Wheel::ReadWrite->new(
Filter => POE::Filter::HTTPChunk->new(),
# See POE::Wheel::ReadWrite for other required parameters.
);
}
π¦ DESCRIPTION π¦
This filter parses HTTP chunks straight out of a data stream. It's the lowkey backbone β POE::Component::Client::HTTP leans on it to do the bulk of the low-level HTTP parsing. She's not the star of the show, she's the stage crew that makes the show happen. Iconic behaviour honestly. π
π CONSTRUCTOR π
π«Ά new
new takes no parameters β zero, nada, nothing β and hands you back a shiny new POE::Filter::HTTPChunk object, ready to use immediately. So slay.
π METHODS π
POE::Filter::HTTPChunk supports the following methods. Most of them adhere to the standard POE::Filter API. And if you want the full lore on that API, the documentation for POE::Filter explains it in more detail. Go read it, bestie, iykyk.
β get_one_start ARRAYREF
Hand it an arrayref containing zero or more raw data chunks. Those chunks get added to the filter's input buffer. Then the filter will attempt to parse that data when get_one() is called. It's giving "queue it up and deal with it later."
$filter_httpchunk->get_one_start(\@stream_data);
β get_one
Parse a single HTTP chunk out of the filter's input buffer. Data gets into that buffer via the get_one_start() method. Returns an arrayref containing zero or one parsed HTTP chunk. Zero or one. Not more. We are not greedy here. π
$ret_arrayref = $filter_httpchunk->get_one();
β get_pending
Returns an arrayref of stream data that's currently pending parsing. Why do you care? Because it's used to seamlessly transfer unparsed data between an old filter and a new filter when a wheel's filter gets changed. Like passing the aux cord mid-song without anyone noticing. π§
$pending_arrayref = $filter_httpchunk->get_pending();
π SEE ALSO π
POE::FilterPOE
π BUGS π
None are known at this time. (Not me manifesting zero bugs. We love a clean slate. β¨)
π AUTHOR & COPYRIGHTS π
POE::Filter::HTTPChunk is...
- Copyright 2005-2006 Martijn van Beers
- Copyright 2006 Rocco Caputo
All rights are reserved. POE::Filter::HTTPChunk is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
π CONTACT π
Rocco may be contacted by e-mail via <mailto:rcaputo@cpan.org>, and Martijn may be contacted by email via <mailto:martijn@cpan.org>.
The preferred way to report bugs or requests is through RT though. See <http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-Client-HTTP> or mail <mailto:bug-POE-Component-Client-HTTP@rt.cpan.org>
For questions, try the POE mailing list (poe@perl.org)
and that's the whole page, bestie π this was perl v5.36.0, dated 2022-11-19, from the POE::F...PChunk(3pm) man page β thanks for reading the whole thing, you're literally the moment πβ¨
π¦ where this page comes from
- debian bookworm: libpoe-component-client-http-perl 0.949-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libpoe-component-client-http-perl 0.949-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libpoe-component-client-http-perl 0.949-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libpoe-component-client-http-perl 0.949-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libpoe-component-client-http-perl 0.949-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms