From 461a09a8a2663dca96f1f8049a14f825dd4e3cfa Mon Sep 17 00:00:00 2001 From: qgarnier Date: Thu, 3 Jun 2021 11:02:05 +0200 Subject: [PATCH] fix(protocol/http): response mode - extra time option with lwp backend (#2848) --- centreon-plugins/apps/protocols/http/mode/response.pm | 4 ++++ centreon-plugins/centreon/plugins/backend/http/lwp.pm | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/centreon-plugins/apps/protocols/http/mode/response.pm b/centreon-plugins/apps/protocols/http/mode/response.pm index c13f7f580..4c93b3cfe 100644 --- a/centreon-plugins/apps/protocols/http/mode/response.pm +++ b/centreon-plugins/apps/protocols/http/mode/response.pm @@ -184,6 +184,10 @@ sub manage_selection { if (defined($self->{option_results}->{extra_stats})) { my $times = $self->{http}->get_times(); + if (!defined($times)) { + $self->{output}->add_option_msg(short_msg => 'Unsupported --extra-stats option for current http backend. Please try with curl backend.'); + $self->{output}->option_exit(); + } $self->{global} = { %$times, %{$self->{global}} }; } } diff --git a/centreon-plugins/centreon/plugins/backend/http/lwp.pm b/centreon-plugins/centreon/plugins/backend/http/lwp.pm index d47ee3052..93490d897 100644 --- a/centreon-plugins/centreon/plugins/backend/http/lwp.pm +++ b/centreon-plugins/centreon/plugins/backend/http/lwp.pm @@ -348,7 +348,7 @@ sub get_certificate { return ('socket', $con); } -sub get_time { +sub get_times { my ($self, %options) = @_; return undef;