NAME
Browsermob::Server - Perl client to control the Browsermob Proxy server
VERSION
version 0.04
SYNOPSIS
my $server = Browsermob::Server->new(
path => '/path/to/browsermob-proxy'
);
$server->start;
my $proxy = $server->create_proxy;
print $proxy->port;
$proxy->create_har('Test');
# generate traffic across your port
$proxy->har; # returns a HAR
Alternatively, assuming there's a BMP server on 63636 for example,
my $server = Browsermob::Server->new(
port => 63636
);
my $proxy = $server->create_proxy;
DESCRIPTION
This class provides a way to control the Browsermob Proxy server within Perl. There are only a few public methods for starting and stopping the server. You also have the option of instantiating a server object and pointing it towards an existing BMP server on localhost, and just using it to avoid having to pass the server_port arg when instantiating new proxies.
ATTRIBUTES
path
The path to the browsermob_proxy binary. If you aren't planning to call start
, this is optional.
port
The port on which the proxy server should run. This is not the port that you should have other clients connect.
METHODS
start
Start a browsermob proxy on port
. Starting the server does not create any proxies.
stop
Stop the forked browsermob-proxy server. This does not work all the time, although the server seems to get GC'd all on its own, even after ignoring a SIGTERM
.
create_proxy
After starting the server, or connecting to an existing one, use create_proxy
to get a proxy that you can use with your tests. No proxies actually exist until you call create_proxy; starting the server does not create a proxy.
my $proxy = $bmp->create_proxy; # returns a Browsermob::Proxy object
my $proxy = $bmp->create_proxy(port => 1337);
get_proxies
Get a list of currently registered proxies.
my $proxy_aref = $bmp->get_proxies->{proxyList};
print scalar @$proxy_aref;
SEE ALSO
Please see those modules/websites for more information related to this module.
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/gempesaw/Browsermob-Proxy/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
Daniel Gempesaw <gempesaw@gmail.com>