changeset 1637:da52525f49d1

Tests: avoid ssl_certificate.t hang on SIGPIPE. It could stuck in SSL shutdown after abrupt connection termination by nginx. A similar change is applied to stream_ssl_certificate.t for consistency.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 29 Dec 2020 20:21:18 +0300
parents 2d371452658c
children 6128590b0d46
files ssl_certificate.t stream_ssl_certificate.t
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ssl_certificate.t
+++ b/ssl_certificate.t
@@ -198,6 +198,9 @@ ok(Net::SSLeay::ERR_peek_error(), 'no ce
 sub get {
 	my ($host, $port, $ctx) = @_;
 	my ($s, $ssl) = get_ssl_socket($host, $port, $ctx) or return;
+
+	local $SIG{PIPE} = 'IGNORE';
+
 	Net::SSLeay::write($ssl, 'GET / HTTP/1.0' . CRLF . CRLF);
 	my $r = Net::SSLeay::read($ssl);
 	Net::SSLeay::shutdown($ssl);
--- a/stream_ssl_certificate.t
+++ b/stream_ssl_certificate.t
@@ -175,6 +175,9 @@ ok(Net::SSLeay::ERR_peek_error(), 'no ce
 sub get {
 	my ($host, $port, $ctx) = @_;
 	my ($s, $ssl) = get_ssl_socket($host, $port, $ctx) or return;
+
+	local $SIG{PIPE} = 'IGNORE';
+
 	my $r = Net::SSLeay::read($ssl);
 	Net::SSLeay::shutdown($ssl);
 	$s->close();