Fix #825
This commit is contained in:
parent
924d6c9378
commit
d9f58759ac
|
@ -47,6 +47,7 @@ sub new {
|
|||
"proxyurl:s" => { name => 'proxyurl' },
|
||||
"proxypac:s" => { name => 'proxypac' },
|
||||
"timeout:s" => { name => 'timeout' },
|
||||
"ssl-opt:s@" => { name => 'ssl_opt' },
|
||||
"ssl:s" => { name => 'ssl' },
|
||||
"command:s" => { name => 'command' },
|
||||
"arg:s@" => { name => 'arg' },
|
||||
|
@ -218,9 +219,9 @@ Proxy pac file (can be an url or local file)
|
|||
|
||||
Threshold for HTTP timeout (Default: 5)
|
||||
|
||||
=item B<--ssl>
|
||||
=item B<--ssl-opt>
|
||||
|
||||
Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
||||
Set SSL Options (--ssl-opt="SSL_version => TLSv1" --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE").
|
||||
|
||||
=item B<--command>
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ sub new {
|
|||
"timeout:s" => { name => 'timeout' },
|
||||
"no-follow" => { name => 'no_follow', },
|
||||
"ssl:s" => { name => 'ssl', },
|
||||
"ssl-opt:s@" => { name => 'ssl_opt' },
|
||||
"cert-file:s" => { name => 'cert_file' },
|
||||
"key-file:s" => { name => 'key_file' },
|
||||
"cacert-file:s" => { name => 'cacert_file' },
|
||||
|
@ -216,9 +217,9 @@ Threshold for HTTP timeout (Default: 5)
|
|||
|
||||
Do not follow http redirect
|
||||
|
||||
=item B<--ssl>
|
||||
=item B<--ssl-opt>
|
||||
|
||||
Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
||||
Set SSL Options (--ssl-opt="SSL_version => TLSv1" --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE").
|
||||
|
||||
=item B<--cert-file>
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ sub new {
|
|||
"header:s@" => { name => 'header' },
|
||||
"get-param:s@" => { name => 'get_param' },
|
||||
"timeout:s" => { name => 'timeout', default => 10 },
|
||||
"ssl-opt:s@" => { name => 'ssl_opt' },
|
||||
"ssl:s" => { name => 'ssl', },
|
||||
"cert-file:s" => { name => 'cert_file' },
|
||||
"key-file:s" => { name => 'key_file' },
|
||||
|
@ -409,9 +410,9 @@ Specify password for basic authentification (Mandatory if --credentials is speci
|
|||
|
||||
Threshold for HTTP timeout (Default: 10)
|
||||
|
||||
=item B<--ssl>
|
||||
=item B<--ssl-opt>
|
||||
|
||||
Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
||||
Set SSL Options (--ssl-opt="SSL_version => TLSv1" --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE").
|
||||
|
||||
=item B<--cert-file>
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@ sub new {
|
|||
"proxypac:s" => { name => 'proxypac' },
|
||||
"timeout:s" => { name => 'timeout' },
|
||||
"no-follow" => { name => 'no_follow', },
|
||||
"ssl:s" => { name => 'ssl' },
|
||||
"ssl:s" => { name => 'ssl' },
|
||||
"ssl-opt:s@" => { name => 'ssl_opt' },
|
||||
"cert-file:s" => { name => 'cert_file' },
|
||||
"key-file:s" => { name => 'key_file' },
|
||||
"cacert-file:s" => { name => 'cacert_file' },
|
||||
|
@ -202,9 +203,9 @@ Threshold for HTTP timeout (Default: 5)
|
|||
|
||||
Do not follow http redirect
|
||||
|
||||
=item B<--ssl>
|
||||
=item B<--ssl-opt>
|
||||
|
||||
Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
||||
Set SSL Options (--ssl-opt="SSL_version => TLSv1" --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE").
|
||||
|
||||
=item B<--cert-file>
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ sub new {
|
|||
"proxypac:s" => { name => 'proxypac' },
|
||||
"header:s@" => { name => 'header' },
|
||||
"timeout:s" => { name => 'timeout', default => 10 },
|
||||
"ssl-opt:s@" => { name => 'ssl_opt' },
|
||||
"ssl:s" => { name => 'ssl', },
|
||||
"cert-file:s" => { name => 'cert_file' },
|
||||
"key-file:s" => { name => 'key_file' },
|
||||
|
@ -436,9 +437,9 @@ Specify password for basic authentification (Mandatory if --credentials is speci
|
|||
|
||||
Threshold for HTTP timeout (Default: 10)
|
||||
|
||||
=item B<--ssl>
|
||||
=item B<--ssl-opt>
|
||||
|
||||
Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
||||
Set SSL Options (--ssl-opt="SSL_version => TLSv1" --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE").
|
||||
|
||||
=item B<--cert-file>
|
||||
|
||||
|
|
|
@ -121,6 +121,29 @@ sub check_options {
|
|||
$options{request}->{$_} =~ s/%\{http_code\}/\$response->code/g;
|
||||
}
|
||||
}
|
||||
|
||||
$self->{ssl_context} = '';
|
||||
if (!defined($options{request}->{ssl_opt})) {
|
||||
$options{request}->{ssl_opt} = [];
|
||||
}
|
||||
if (defined($options{request}->{ssl}) && $options{request}->{ssl} ne '') {
|
||||
push @{$options{request}->{ssl_opt}}, 'SSL_version => ' . $options{request}->{ssl};
|
||||
}
|
||||
if (defined($options{request}->{cert_file}) && !defined($options{request}->{cert_pkcs12})) {
|
||||
push @{$options{request}->{ssl_opt}}, 'SSL_use_cert => 1';
|
||||
push @{$options{request}->{ssl_opt}}, 'SSL_cert_file => "' . $options{request}->{cert_file} . '"';
|
||||
push @{$options{request}->{ssl_opt}}, 'SSL_key_file => "' . $options{request}->{key_file} . '"'
|
||||
if (defined($options{request}->{key_file}));
|
||||
push @{$options{request}->{ssl_opt}}, 'SSL_ca_file => "' . $options{request}->{cacert_file} . '"'
|
||||
if (defined($options{request}->{cacert_file}));
|
||||
}
|
||||
my $append = '';
|
||||
foreach (@{$options{request}->{ssl_opt}}) {
|
||||
if ($_ ne '') {
|
||||
$self->{ssl_context} .= $append . $_;
|
||||
$append = ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub get_port {
|
||||
|
@ -256,20 +279,8 @@ sub request {
|
|||
$ENV{HTTPS_PKCS12_PASSWORD} = $request_options->{cert_pwd};
|
||||
}
|
||||
|
||||
my $ssl_context;
|
||||
if (defined($request_options->{ssl}) && $request_options->{ssl} ne '') {
|
||||
$ssl_context = { SSL_version => $request_options->{ssl} };
|
||||
}
|
||||
if (defined($request_options->{cert_file}) && !defined($request_options->{cert_pkcs12})) {
|
||||
$ssl_context = {} if (!defined($ssl_context));
|
||||
$ssl_context->{SSL_use_cert} = 1;
|
||||
$ssl_context->{SSL_cert_file} = $request_options->{cert_file};
|
||||
$ssl_context->{SSL_key_file} = $request_options->{key_file} if (defined($request_options->{key_file}));
|
||||
$ssl_context->{SSL_ca_file} = $request_options->{cacert_file} if (defined($request_options->{cacert_file}));
|
||||
}
|
||||
|
||||
if (defined($ssl_context)) {
|
||||
my $context = new IO::Socket::SSL::SSL_Context(%{$ssl_context});
|
||||
if (defined($self->{ssl_context}) && $self->{ssl_context} ne '') {
|
||||
my $context = new IO::Socket::SSL::SSL_Context(eval $self->{ssl_context});
|
||||
IO::Socket::SSL::set_default_context($context);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue