Mercurial > hg > nginx-tests
diff ssl_crl.t @ 1866:a797d7428fa5
Tests: simplified http SSL tests with IO::Socket::SSL.
The http SSL tests which previously used IO::Socket::SSL were converted
to use improved IO::Socket::SSL infrastructure in Test::Nginx.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 18 May 2023 18:07:19 +0300 |
parents | cdcd75657e52 |
children | 0b5ec15c62ed |
line wrap: on
line diff
--- a/ssl_crl.t +++ b/ssl_crl.t @@ -162,37 +162,12 @@ like(get(8082, 'end'), qr/FAILED/, 'crl sub get { my ($port, $cert) = @_; - my $s = get_ssl_socket($port, $cert) or return; - http_get('/t', socket => $s); -} - -sub get_ssl_socket { - my ($port, $cert) = @_; - my ($s); - - eval { - local $SIG{ALRM} = sub { die "timeout\n" }; - local $SIG{PIPE} = sub { die "sigpipe\n" }; - alarm(8); - $s = IO::Socket::SSL->new( - Proto => 'tcp', - PeerAddr => '127.0.0.1', - PeerPort => port($port), - SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(), - SSL_cert_file => "$d/$cert.crt", - SSL_key_file => "$d/$cert.key", - SSL_error_trap => sub { die $_[1] } - ); - alarm(0); - }; - alarm(0); - - if ($@) { - log_in("died: $@"); - return undef; - } - - return $s; + http_get( + '/t', PeerAddr => '127.0.0.1:' . port($port), + SSL => 1, + SSL_cert_file => "$d/$cert.crt", + SSL_key_file => "$d/$cert.key" + ); } ###############################################################################