[HTTP-Recorder] Using http-recorder with a proxy in my company

Tom tom at cumbriankitchen.co.uk
Wed Jul 14 07:21:53 EDT 2004


Thanks Richard - script is pretty similar to my old one. file was a 
method of the agent in a previous version, and that's where I was all wrong!
Tom
Lippmann, Richard wrote:

>I thought it's a good idea to use HTTP::Recorder with my company's proxy.
>But it was not so easy to set it up. So I wrote this script which could help
>you, too, to do your next job faster.
>
>Greetings, 
>Horshack
>
>==
>
>
>#!/usr/bin/perl
>my $version = "0.01";
>print "This is $0 V$version\n";
># Take the newest version from
>#
>http://search.cpan.org/CPAN/authors/id/L/LE/LEIRA/HTTP-Recorder-0.03_01.tar.
>gz
>use HTTP::Recorder "0.03_01";
>use HTTP::Proxy;
>
># Set everything to undef if you have no proxy-servers
># in your organisation
>my %whoami = (
>        # listen to every network interface on this machine:
>	# host => undef,
>	# host => "127.0.0.1",
>        # listen only to network interface 10.1.1.5
>	host => "10.95.81.5",
>        # which is the port I shall listen
>        port => "3128",
>);
>
># this is for forwarding all requests to my proxy in the company
>my %proxy = (
>        host => "http://proxy.zdf:3128",
>        user => undef,
>        pass => undef,
>);
>
># set HTTP::Recorder as the agent
>my $agent = HTTP::Recorder->new(
>        # Log to a file
>        # file => "/tmp/tmpfile",
>        file => "proxy.log",
>        showwindow => 1);
>
># Set my own proxy to forward requests
>$agent->proxy( "http", $proxy{host} )
>        if $proxy{host};
>$request->proxy_authorization_basic( @proxy{ qw/user pass/ } )
>        if $proxy{user};
>
>my $proxy = HTTP::Proxy->new;
>$proxy->agent( $agent );
>$proxy->port( $whoami{port} )
>        if $whoami{port};
>
># Set how I get soon from my users
>if ( $whoami{host} ) {
>        # My interface to be reached
>        $proxy->host( $whoami{host} );
>}
># My port to be reached
>$proxy->port( $whoami{port} );
>
># you may need to set the host
>
>print "Your proxy-server in your web-browser shall be:\n";
>printf "\t%s:%s\n",
>	$whoami{host} ? $whoami{host} : "the_host_i_run",
>	$whoami{port} ? $whoami{port} : 8080;
>
>print "Navigate to http://http-recorder/ to download the script\n";
>print "\twhich has been generated\n";
>
>
># Endless loop
>$proxy->start();
>_______________________________________________
>HTTP-Recorder mailing list
>HTTP-Recorder at lists.bestpractical.com
>http://lists.bestpractical.com/cgi-bin/mailman/listinfo/http-recorder
>
>
>  
>



More information about the HTTP-Recorder mailing list