HTTP::...omplete(3pm)
π HTTP::...omplete π
okay bestie, welcome to the manual page for HTTP::...omplete, straight out of the User Contributed Perl Documentation, section 3pm. it's giving niche but iconic, and we're gonna get through it together. no cap. π
β¨ NAME β¨
HTTP::Proxy::BodyFilter::complete β a filter that passes on a complete body or nothing π¦
like. all of it or none of it. she does not do half measures.
πΈ SYNOPSIS πΈ
use HTTP::Proxy;
use HTTP::Proxy::BodyFilter::simple;
use HTTP::Proxy::BodyFilter::complete;
my $proxy = HTTP::Proxy->new;
# pass the complete response body to our filter (in one pass)
$proxy->push_filter(
mime => 'text/html',
response => HTTP::Proxy::BodyFilter::complete->new,
response => HTTP::Proxy::BodyFilter::simple->new(
sub {
my ( $self, $dataref, $message, $protocol, $buffer ) = @_;
# some complex processing that needs
# the whole response body
}
);
);
$proxy->start;
periodt. that's the whole vibe. π
π§ DESCRIPTION π§
so the HTTP::Proxy::BodyFilter::complete filter is basically the group-chat admin who refuses to forward a message until everyone has finished typing. she makes sure that the next filter in the filter chain only ever receives complete message bodies β and yes, that's either request or response, whichever one we're talking about. π«Ά
the way she works: she stores the chunks of data as they arrive, and only passes the entire message body along after the whole message has been received by the proxy. lowkey patient, highkey essential.
subsequent filters in the chain will receive the whole body as one big piece of data. no more nibbling at crumbs, bestie β full meal. π
π CAVEAT EMPTOR π
this consumes memory and time. π
use with caution, otherwise your client will timeout, or your proxy will run out of memory. not me warning you and you ignoring me. π
also note that all filters after "complete" are still called when the proxy receives data: they just receive empty data. they will receive the complete data when the filter chain is called for the very last time (the $buffer parameter is undef). (see the documentation of HTTP::Proxy::BodyFilter for details about the $buffer parameter.) π
β METHOD β
this filter defines two methods, called automatically:
filter()β stores the incoming data in memory until the last moment and passes empty data to the subsequent filters in the chain. they will receive the full body during the last round of filter calls. πwill_modify()β this method returns a false value, thus indicating to the system that it will not modify data passing through. she's just the messenger, fr fr. π
π AUTHOR π
Philippe "BooK" Bruhat, <book@cpan.org>. iconic name, iconic human. β¨
π THANKS π
thanks to Simon Cozens and Merijn H. Brandt, who needed this almost at the same time. ";-)" π¦
πΈ COPYRIGHT πΈ
Copyright 2004-2015, Philippe Bruhat.
π LICENSE π
this module is free software; you can redistribute it or modify it under the same terms as Perl itself. slay. π
and that's the whole page, bestie β perl v5.36.0, dated 2022-12-04, brought to you by HTTP::...omplete(3pm). go forth and buffer responsibly. π«Άβ¨π
π¦ where this page comes from
- debian bookworm: libhttp-proxy-perl 0.304-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhttp-proxy-perl 0.304-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhttp-proxy-perl 0.304-5 Β· 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