A new filter for HTTP::Proxy!

BooK on 2004-03-15T15:36:46

The next version of HTTP::Proxy will include a shiny new filter named HTTP::Proxy::BodyFilter::save. It can be used to save the files you want while you browse them. Here's a short example:

use HTTP::Proxy;
use HTTP::Proxy::BodyFilter::save;

my $proxy = HTTP::Proxy->new;
$proxy->logmask( shift );

# save RFC files as we browse them
$proxy->push_filter(
    path => qr!/rfc\d+.txt!,
    mime => 'text/plain',
    response => HTTP::Proxy::BodyFilter::save->new(
        template => '%f',  # %f is the filename
        prefix   => 'rfc', # prefix is a directory
        multiple => 0,
        keep_old => 1,
    )
);

$proxy->start;

Now, every time I browse a page that matches m!/rfc\d+\.txt!, the RFC file is automatically saved in the rfc/ directory. Cool.