POE::F...PChunk(3pm)

πŸ“¦
version 0.949 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

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::Filter
  • POE

πŸ’€ 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