Add possibility to specify ssl version refs #6199

This commit is contained in:
Kevin Duret 2015-03-12 11:54:23 +01:00
parent ba0d1e79ea
commit 44040e9573
5 changed files with 28 additions and 0 deletions

View File

@ -61,6 +61,7 @@ sub new {
"proxyurl:s" => { name => 'proxyurl' },
"expected-string:s" => { name => 'expected_string' },
"timeout:s" => { name => 'timeout', default => '3' },
"ssl:s" => { name => 'ssl', },
});
return $self;
}
@ -158,6 +159,10 @@ Specify password for basic authentification (Mandatory if --credentials is speci
Threshold for HTTP timeout
=item B<--ssl>
Specify SSL version (example : 'sslv3', 'tlsv1'...)
=item B<--expected-string>
Specify String to check on the Webpage

View File

@ -67,6 +67,7 @@ sub new {
"expected-string:s" => { name => 'expected_string' },
"header:s@" => { name => 'header' },
"timeout:s" => { name => 'timeout', default => 10 },
"ssl:s" => { name => 'ssl', },
"warning-numeric:s" => { name => 'warning_numeric' },
"critical-numeric:s" => { name => 'critical_numeric' },
@ -419,6 +420,10 @@ Specify password for basic authentification (Mandatory if --credentials is speci
Threshold for HTTP timeout (Default: 10)
=item B<--ssl>
Specify SSL version (example : 'sslv3', 'tlsv1'...)
=item B<--header>
Set HTTP headers (Multiple option)

View File

@ -63,6 +63,7 @@ sub new {
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout', default => '3' },
"ssl:s" => { name => 'ssl', },
});
return $self;
}
@ -173,6 +174,10 @@ Proxy URL if any
Threshold for HTTP timeout
=item B<--ssl>
Specify SSL version (example : 'sslv3', 'tlsv1'...)
=item B<--warning>
Threshold warning in seconds (Webpage response time)

View File

@ -67,6 +67,7 @@ sub new {
"expected-string:s" => { name => 'expected_string' },
"header:s@" => { name => 'header' },
"timeout:s" => { name => 'timeout', default => 10 },
"ssl:s" => { name => 'ssl', },
"warning-numeric:s" => { name => 'warning_numeric' },
"critical-numeric:s" => { name => 'critical_numeric' },
@ -433,6 +434,10 @@ Specify password for basic authentification (Mandatory if --credentials is speci
Threshold for HTTP timeout (Default: 10)
=item B<--ssl>
Specify SSL version (example : 'sslv3', 'tlsv1'...)
=item B<--header>
Set HTTP headers (Multiple option)

View File

@ -116,6 +116,14 @@ sub connect {
if (defined($self->{option_results}->{proxyurl})) {
$ua->proxy(['http', 'https'], $self->{option_results}->{proxyurl});
}
if (defined($self->{option_results}->{ssl}) && $self->{option_results}->{ssl} ne '') {
use IO::Socket::SSL;
my $context = new IO::Socket::SSL::SSL_Context(
SSL_version => $self->{option_results}->{ssl},
);
IO::Socket::SSL::set_default_context($context);
}
$response = $ua->request($req);