From e0d67937abbf17439cdab997133a8e02cb808bae Mon Sep 17 00:00:00 2001 From: Colin Gagnaire Date: Wed, 16 Oct 2019 08:59:42 +0200 Subject: [PATCH] make proxyurl easier to set --- centreon/plugins/backend/http/lwp.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/centreon/plugins/backend/http/lwp.pm b/centreon/plugins/backend/http/lwp.pm index 6b2111bcb..87b3eef5c 100644 --- a/centreon/plugins/backend/http/lwp.pm +++ b/centreon/plugins/backend/http/lwp.pm @@ -106,7 +106,11 @@ sub set_proxy { } } if (defined($options{request}->{proxyurl}) && $options{request}->{proxyurl} ne '') { - $self->{ua}->proxy(['http', 'https'], $options{request}->{proxyurl}); + my $proxyurl = $options{request}->{proxyurl}; + if ($options{request}->{proto} eq "https" || $options{request}->{full_url} =~ /^https/) { + $proxyurl = 'connect://' . $2 if ($proxyurl =~ /^(http|https):\/\/(.*)/); + } + $self->{ua}->proxy(['http', 'https'], $proxyurl); } }