Mercurial > hg > nginx-tests
diff stream_ssl_preread_alpn.t @ 1864:46351d990aee
Tests: simplified stream SSL tests with IO::Socket::SSL.
The stream SSL tests which previously used IO::Socket::SSL were converted
to use infrastructure in Test::Nginx::Stream where appropriate.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 18 May 2023 18:07:15 +0300 |
parents | cdcd75657e52 |
children |
line wrap: on
line diff
--- a/stream_ssl_preread_alpn.t +++ b/stream_ssl_preread_alpn.t @@ -114,25 +114,12 @@ get_ssl(8081, ''); sub get_ssl { my ($port, @alpn) = @_; - my $s = stream('127.0.0.1:' . port($port)); - eval { - local $SIG{ALRM} = sub { die "timeout\n" }; - local $SIG{PIPE} = sub { die "sigpipe\n" }; - alarm(8); - IO::Socket::SSL->start_SSL($s->{_socket}, - SSL_alpn_protocols => [ @alpn ], - SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(), - SSL_error_trap => sub { die $_[1] } - ); - alarm(0); - }; - alarm(0); - - if ($@) { - log_in("died: $@"); - return undef; - } + my $s = stream( + PeerAddr => '127.0.0.1:' . port($port), + SSL => 1, + SSL_alpn_protocols => [ @alpn ] + ); return $s->read(); }