1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Use user-agent and proxy for http_request_time autoconf

Otherwise autoconf might not succeed.
This commit is contained in:
Christian Weiske 2022-02-13 19:24:19 +01:00 committed by Lars Kruse
parent c909c07561
commit 3c4321327c

View file

@ -91,8 +91,18 @@ if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
} }
my $ua = LWP::UserAgent->new(timeout => $timeout); my $ua = LWP::UserAgent->new(timeout => $timeout);
my $defaultAgent = $ua->agent;
foreach my $url (keys %URLS) { foreach my $url (keys %URLS) {
if ($URLS{$url}{agent}) {
$ua->agent($URLS{$url}{agent});
} else {
$ua->agent($defaultAgent);
}
if ($URLS{$url}{proxy}) {
$ua->proxy(['http', 'ftp'], $URLS{$url}{proxy});
} else {
$ua->proxy(['http', 'ftp'], undef);
}
my $response = $ua->request(HTTP::Request->new('GET',$URLS{$url}{'url'})); my $response = $ua->request(HTTP::Request->new('GET',$URLS{$url}{'url'}));
if ($response->is_success) { if ($response->is_success) {
next; next;