richill has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks I'm trying to set up http::recorder to automate some tests I'm using the instructions here
http://www.perl.com/pub/a/2004/06/04/recorder.html#config

I'm running this code as recorder.pl

#!/usr/bin/perl use HTTP::Proxy; use HTTP::Recorder; my $proxy = HTTP::Proxy->new(); # create a new HTTP::Recorder object my $agent = new HTTP::Recorder; # set the log file (optional) $agent->file("/tmp/myfile"); # set HTTP::Recorder as the agent for the proxy $proxy->agent( $agent ); # start the proxy $proxy->start(); 1;

But this line confuses me.

Then, instruct your favorite web browser (firefox) to use your new pro +xy for HTTP traffic.

Do I change the manual proxy configuration for HTTP from localhost:8118

to  /some_file_path/recorder.pl

I hope you can help with this because it's totally baffling me and taken up loads of time for what seems to be easy.

Replies are listed 'Best First'.
Re: HTTP Recorder and proxies
by planetscape (Chancellor) on Aug 21, 2006 at 01:09 UTC

    I use these tools (HTTP::Recorder, HTTP::Proxy) all the time. In my case, I run the script you refer to above under Cygwin, and use Netscape for my browser.

    To change the proxy configuration, I follow these steps:

    1. Goto Tools | Options... | General | Connection Settings...
    2. Check "Manual proxy configuration"
    3. HTTP Proxy = localhost
    4. Port = 8080
    5. Click "OK"

    The steps for Firefox should be virtually identical.

    Update: BTW, the script should be running before you set up your browser to use the proxy, and should run for the duration of your tests, to insure that all steps are recorded.

    HTH,

    planetscape
Re: HTTP Recorder and proxies
by Fletch (Bishop) on Aug 21, 2006 at 01:10 UTC

    According to the HTTP::Proxy documentation, it will by default listen on port 8080. So you'd set your web browser to proxy through http://localhost:8080/.

    Now if you're already behind a proxy (which I think is what you're implying) then you may be in for more headaches. I think that HTTP::Proxy should honor the http_proxy environment variable for connecting up-stream (since it sits on top of LWP itself; i.e. have export http_proxy=http://localhost:8118/ in the environment from which you run your proxy script). Someone more familiar with it may chime in about that, but I'd guess it would work.