X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fnntpd-tls.t;h=0b6afcefdff750ec189947a9697505922dbb404f;hb=96a8b8832d791d53e05f235b5bc2492daab5f60a;hp=49b31221f02c6cf0ec19af788010c864ba857984;hpb=f97f84ecbe02223af61fc5ea5074a90b1194cdd2;p=public-inbox.git diff --git a/t/nntpd-tls.t b/t/nntpd-tls.t index 49b31221..0b6afcef 100644 --- a/t/nntpd-tls.t +++ b/t/nntpd-tls.t @@ -20,7 +20,7 @@ my $cert = 'certs/server-cert.pem'; my $key = 'certs/server-key.pem'; unless (-r $key && -r $cert) { plan skip_all => - "certs/ missing for $0, run ./create-certs.perl in certs/"; + "certs/ missing for $0, run $^X ./create-certs.perl in certs/"; } use_ok 'PublicInbox::TLS'; @@ -29,12 +29,15 @@ require './t/common.perl'; require PublicInbox::InboxWritable; require PublicInbox::MIME; require PublicInbox::SearchIdx; +my $need_zlib; +eval { require Compress::Raw::Zlib } or + $need_zlib = 'Compress::Raw::Zlib missing'; my $version = 2; # v2 needs newer git require_git('2.6') if $version >= 2; my $tmpdir = tempdir('pi-nntpd-tls-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $err = "$tmpdir/stderr.log"; my $out = "$tmpdir/stdout.log"; -my $mainrepo = "$tmpdir"; +my $inboxdir = "$tmpdir"; my $pi_config = "$tmpdir/pi_config"; my $group = 'test-nntpd-tls'; my $addr = $group . '@example.com'; @@ -49,7 +52,7 @@ END { }; my $ibx = PublicInbox::Inbox->new({ - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'nntpd-tls', version => $version, -primary_address => $addr, @@ -61,7 +64,7 @@ $ibx->init_inbox(0); open my $fh, '>', $pi_config or die "open: $!\n"; print $fh < [qw(1 1 n)] }; # start negotiating a slow TLS connection - my $slow = IO::Socket::INET->new( - Proto => 'tcp', - PeerAddr => $nntps_addr, - Type => SOCK_STREAM, - Blocking => 0, - ); + my $slow = tcp_connect($nntps, Blocking => 0); $slow = IO::Socket::SSL->start_SSL($slow, SSL_startHandshake => 0, %o); my $slow_done = $slow->connect_SSL; diag('W: connect_SSL early OK, slow client test invalid') if $slow_done; @@ -234,6 +232,14 @@ sub get_capa { die "unexpected: $!" unless defined($r); die 'unexpected EOF' if $r == 0; } until $capa =~ /\.\r\n\z/; + + my $deflate_capa = qr/\r\nCOMPRESS DEFLATE\r\n/; + if ($need_zlib) { + unlike($capa, $deflate_capa, + 'COMPRESS DEFLATE NOT advertised '.$need_zlib); + } else { + like($capa, $deflate_capa, 'COMPRESS DEFLATE advertised'); + } $capa; }