HTTP::...rStack(3pm)

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

πŸ’– NAME πŸ’–

HTTP::Proxy::FilterStack β€” the class that runs the filter stacks, bestie. It's giving "backend girlie who does all the work and never gets the credit" ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so, this class is used internally by HTTP::Proxy to manage its four filter stacks. She's not here for your direct calls, she's here for the plot 🫢

From the point of view of HTTP::Proxy::FilterStack, a filter is actually a ("matchsub", "filterobj") pair. No cap. The match subroutine (which is generated by HTTP::Proxy's push_filter() method, slay) gets run against the current HTTP::Message object to figure out which filters must be kept in the stack when handling this message. Vibe check on every single message, literally.

The filter stack also maintains a set of buffers where the filters can store data. That data gets appended at the beginning of the next chunk of data, and this keeps happening until all the data has been sent. Iconic queue behaviour, honestly πŸŽ€


🌸 METHODS 🌸

The class provides the following methods:

  • new( $isbody ) β€” Creates a new instance of HTTP::Proxy::FilterStack. If $isbody is true, then the stack will manage body filters (subclasses of HTTP::Proxy::BodyFilter). So it's giving body-filter energy specifically πŸ’…
  • select_filters( $message ) β€” $message is the current HTTP::Message handled by the proxy. It gets used (with a little help from each filter's match subroutine) to select the subset of filters that will be applied on the given message. It's a whole auditions episode and only some filters make the cut 😭
  • filter( @args ) β€” This method calls all the currently selected filters in turn, with the appropriate arguments. Go down the line, one by one, no skipping 🧚
  • filter_last() β€” This method calls all the currently selected filters in turn, to filter the data remaining in the buffers in a single pass. Final sweep, last call, closing time ⭐
  • will_modify() β€” Returns a boolean value indicating if the list of selected filters in the stack will modify the body content. The value is computed from the result of calling will_modify() on all selected filters. So like, is anyone here actually going to change something? Answer wisely πŸ”₯
  • all() β€” Returns a list of all filters in the stack. The whole squad, roll call πŸ‘‘
  • eod() β€” Used for END OF DATA bookkeeping. That's the whole description. She does admin, and she does it flawlessly.
  • push() β€” Pushes the given [ match, filterobj ] pairs at the top of the stack. New arrivals go straight to the front, main character energy fr fr.
  • insert( $idx, @pairs ) β€” Inserts the given [ match, filterobj ] pairs at position $idx in the stack. Very "I know exactly where I belong" of them πŸ’œ
  • remove( $idx ) β€” Removes the [ match, filterobj ] pair at position $idx in the stack. Okay bye bestie, we're removing you from the group chat πŸ™ˆ

✨ AUTHOR ✨

Philippe "BooK" Bruhat, <book@cpan.org>. Give him his flowers πŸ’


Copyright 2002-2015, Philippe Bruhat.


🌈 LICENSE 🌈

This module is free software; you can redistribute it or modify it under the same terms as Perl itself. Periodt.


That's the whole page, bestie β€” perl v5.36.0, dated 2022-12-04, and that's the HTTP::...rStack(3pm) manual, mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from