From 3c4321327c1af2fe65f209738d92dfaeb0607c8e Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sun, 13 Feb 2022 19:24:19 +0100 Subject: [PATCH] Use user-agent and proxy for http_request_time autoconf Otherwise autoconf might not succeed. --- plugins/http/http_request_time | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/http/http_request_time b/plugins/http/http_request_time index cb8bebfc..7aa7df3a 100755 --- a/plugins/http/http_request_time +++ b/plugins/http/http_request_time @@ -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;