Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > e0f0961b75b8c06a97c13e17e9f38b60 > files > 31

perl-HTTP-Proxy-0.304.0-5.mga7.noarch.rpm

#!/usr/bin/perl -w
use HTTP::Proxy;
use HTTP::Proxy::HeaderFilter::simple;

# call this proxy as
# eg/switch.pl proxy http://proxy1:port/,http://proxy2:port/
my %args = @ARGV;
my @proxy = split/,/, $args{proxy};
my $proxy = HTTP::Proxy->new(@ARGV);

$proxy->push_filter(
    request => HTTP::Proxy::HeaderFilter::simple->new(
        sub {
            shift->proxy->agent->proxy( http => $proxy[ rand @proxy ] );
        }
    )
);

$proxy->start;