add insecure option for http backend

This commit is contained in:
garnier-quentin 2020-12-16 11:44:33 +01:00
parent 54cf21ae3e
commit a2e8c7c08b
3 changed files with 13 additions and 0 deletions

View File

@ -355,6 +355,10 @@ sub request {
if (defined($options{request}->{cacert_file}) && $options{request}->{cacert_file} ne '') {
$self->curl_setopt(option => $self->{constant_cb}->(name => 'CURLOPT_CAINFO'), parameter => $options{request}->{cacert_file});
}
if (defined($options{request}->{insecure})) {
$self->curl_setopt(option => $self->{constant_cb}->(name => 'CURLOPT_SSL_VERIFYPEER'), parameter => 0);
$self->curl_setopt(option => $self->{constant_cb}->(name => 'CURLOPT_SSL_VERIFYHOST'), parameter => 0);
}
$self->set_auth(%options);
$self->set_proxy(%options);

View File

@ -70,6 +70,10 @@ sub check_options {
push @{$options{request}->{ssl_opt}}, 'SSL_ca_file => "' . $options{request}->{cacert_file} . '"'
if (defined($options{request}->{cacert_file}));
}
if ($options{request}->{insecure}) {
push @{$options{request}->{ssl_opt}}, 'SSL_verify_mode => SSL_VERIFY_NONE';
}
my $append = '';
foreach (@{$options{request}->{ssl_opt}}) {
if ($_ ne '') {

View File

@ -33,6 +33,7 @@ sub new {
'http-peer-addr:s' => { name => 'http_peer_addr' },
'proxyurl:s' => { name => 'proxyurl' },
'proxypac:s' => { name => 'proxypac' },
'insecure' => { name => 'insecure' },
'http-backend:s' => { name => 'http_backend', default => 'lwp' },
});
$options{options}->add_help(package => __PACKAGE__, sections => 'HTTP GLOBAL OPTIONS');
@ -247,6 +248,10 @@ Proxy URL
Proxy pac file (can be an url or local file)
=item B<--insecure>
Insecure SSL connections.
=item B<--http-backend>
Set the backend used (Default: 'lwp')