Hello
I need to run scripts through a proxy on Windows machines. I usually do this:
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request;
print "Connecting...\n";
my $ua = LWP::UserAgent->new( );
$ua->proxy(['http', 'https'], 'http://127.0.0.1:8888/');
my $url="https://www.google.com";
my $req = HTTP::Request->new(GET => $url);
my $response = $ua->request($req);
if ($response->is_success) {
print "OK CONNECTION!\n";
}
else{
print "NO CONNECTION!\n";
}
This works fine. However, I would like to autodetect the proxy. The only thing I found so far is LWP::UserAgent::ProxyAny;. Changing the script to:
use strict;
use warnings;
use LWP::UserAgent::ProxyAny;
use HTTP::Request;
print "Connecting...\n";
my $ua = LWP::UserAgent::ProxyAny->new;
$ua->env_proxy;
my $url="https://www.google.com";
my $req = HTTP::Request->new(GET => $url);
my $response = $ua->request($req);
if ($response->is_success) {
print "OK CONNECTION!\n";
}
else{
print "NO CONNECTION!\n";
}
I go through the proxy. If I look inside $ua I found my proxy. HOWEVER, the module is 15 years old, and normally I have lots of doubts in using modules that never get updated. So, before using it in production I would like to have some feedbacks from people using it and know possible problems I could face (and of course I am interested in alternatives, if any). Thank you.