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:
parent
c909c07561
commit
3c4321327c
1 changed files with 11 additions and 1 deletions
|
@ -91,8 +91,18 @@ if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
|
|||
}
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => $timeout);
|
||||
|
||||
my $defaultAgent = $ua->agent;
|
||||
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'}));
|
||||
if ($response->is_success) {
|
||||
next;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue