Re: Requests from different IP addresses?
Gisle Aas (gisle@activestate.com)
12 Jan 2001 10:31:32 -0800
Stefan Kruger <stefan@inty.co.uk> writes:
> For a machine with several IP-addresses, is it possible
> to specify from which a HTTP::Request is sent?
You can set the (undocumented) variable
@LWP::Protocol::http::EXTRA_SOCK_OPTS to specify LocalAddr. This
variable contains additional parameters that are always passed to
IO::Socket::INET's constructor.
Something like this:
@LWP::Protocol::http::EXTRA_SOCK_OPTS = (LocalAddr => 'xxxxxxx');
# The normal drill
use LWP;
my $ua = LWP::UserAgent->new;
my $res = $ua->request(HTTP::Request->new(GET => "http://www.perl.org"));
print $res->as_string;
Regards,
Gisle
> We're trying to simulate a network environment where
> several users, each on their own IP-address, are accessing
> the web concurrently.