Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

cog (4665)

Journal of cog (4665)

Thursday October 28, 2004
04:52 AM

Firefox and proxies

[ #21562 ]
You wouldn't happen to know of a quick way to switch between two different proxies all day long, would you? :-|
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • #!/usr/bin/perl -w
    use HTTP::Proxy;
    use HTTP::Proxy::HeaderFilter::simple;

    my @proxy = qw( http://localhost:8080/ http://proxy2:8080/ );
    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;

    • Given that I did not mention any fishnets, no, I didn't know you would answer it O:-)

      Anyway, your code seems really useful for several things... but it was not what I was looking for (unless I implement that somewhere within Firefox...)

      What I had in mind was a button (maybe in the toolbar or something) that, on a click, would alternate between two different proxies I happen to use ("Edit -> Preferences -> Connection Settings -> Copy&Paste what I need" just seems to tedious...)
  • There's nothing like thinking out loud in your journal :-)

    Thanks to Danius, I have now installed SwitchProxy [nettripper.com].

    Hurrah! :-D