[PATCH 18 of 20] Tests: cleaned up ssl_ocsp.t

Maxim Dounin mdounin at mdounin.ru
Sat Mar 18 14:15:13 UTC 2023


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1679148851 -10800
#      Sat Mar 18 17:14:11 2023 +0300
# Node ID c140f78fbc8f62c9694d3b969d1309570a96f2e7
# Parent  fc68109603c10abff643444b39cf52daa240a3e2
Tests: cleaned up ssl_ocsp.t.

Fixed verbose logging, added $SIG{PIPE} handling to avoid hangs if
the server closes connection, fixed SKIP message for BoringSSL.

diff --git a/ssl_ocsp.t b/ssl_ocsp.t
--- a/ssl_ocsp.t
+++ b/ssl_ocsp.t
@@ -43,7 +43,8 @@ plan(skip_all => 'Net::SSLeay with OpenS
 
 my $t = Test::Nginx->new()->has(qw/http http_ssl sni/)->has_daemon('openssl');
 
-plan(skip_all => 'no OCSP stapling') if $t->has_module('BoringSSL');
+plan(skip_all => 'no OCSP support in BoringSSL')
+	if $t->has_module('BoringSSL');
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -416,9 +417,11 @@ sub get {
 	my $cipher = Net::SSLeay::get_cipher($ssl);
 	Test::Nginx::log_core('||', "cipher: $cipher");
 	my $host = $extra{sni} ? $extra{sni} : 'localhost';
+	local $SIG{PIPE} = 'IGNORE';
+	log_out("GET /serial HTTP/1.0\nHost: $host\n\n");
 	Net::SSLeay::write($ssl, "GET /serial HTTP/1.0\nHost: $host\n\n");
 	my $r = Net::SSLeay::read($ssl);
-	Test::Nginx::log_core($r);
+	log_in($r);
 	$s->close();
 	return $r unless wantarray();
 	return ($s, $ssl);
@@ -496,6 +499,7 @@ sub http_daemon {
 		my $resp;
 
 		while (<$client>) {
+			Test::Nginx::log_core('||', $_);
 			$headers .= $_;
 			last if (/^\x0d?\x0a?$/);
 		}


More information about the nginx-devel mailing list