Skip to content

Commit

Permalink
WIP TestCase: pass SSL_options to Net::DAVTalk
Browse files Browse the repository at this point in the history
  • Loading branch information
elliefm committed Jan 22, 2025
1 parent 025c3ff commit 00263cb
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions cassandane/Cassandane/Cyrus/TestCase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ package Cassandane::Cyrus::TestCase;
use strict;
use warnings;
use attributes;
use Cwd qw(abs_path);
use Data::Dumper;
use Scalar::Util qw(refaddr);
use List::Util qw(uniq);
use Digest::file qw(digest_file_hex);
use File::Temp qw(tempfile);
use File::Path qw(rmtree);
use File::Temp qw(tempfile);
use List::Util qw(uniq);
use Scalar::Util qw(refaddr);

use lib '.';
use base qw(Cassandane::Unit::TestCase);
Expand Down Expand Up @@ -800,21 +801,20 @@ sub _setup_http_service_objects
$service ||= $self->{instance}->get_service("https");
return if !$service;

my $ca_file = abs_path("data/certs/cacert.pem");

my %common_args = (
user => 'cassandane',
password => 'pass',
host => $service->host(),
port => $service->port(),
scheme => ($service->is_ssl() ? 'https' : 'http'),
SSL_options => {
SSL_ca_file => $ca_file,
SSL_verifycn_scheme => 'none',
},
);

# XXX HTTP::Tiny 0.8.3 and later have SSL_verify enabled by default, but
# XXX Net::DAVTalk doesn't provide any way for us to supply our CA file,
# XXX making setup fail with certificate verify errors.
# XXX HTTP::Tiny 0.86 and later lets us set this environment variable
# XXX to restore the old default
local $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = 1;

if ($self->{instance}->{config}->get_bit('httpmodules', 'carddav')) {
require Net::CardDAVTalk;
$self->{carddav} = Net::CardDAVTalk->new(
Expand All @@ -834,6 +834,8 @@ sub _setup_http_service_objects
"cassandane\@example.com");
}
if ($self->{instance}->{config}->get_bit('httpmodules', 'jmap')) {
# XXX would be nice if Mail::JMAPTalk would pass through SSL_options
# XXX to its HTTP::Tiny constructor too...
require Mail::JMAPTalk;
$ENV{DEBUGJMAP} = 1;
$self->{jmap} = Mail::JMAPTalk->new(
Expand Down

0 comments on commit 00263cb

Please sign in to comment.