diff ssl_client_escaped_cert.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
line wrap: on
line diff
--- a/ssl_client_escaped_cert.t
+++ b/ssl_client_escaped_cert.t
@@ -91,31 +91,12 @@ is($escaped, $cert, 'ssl_client_escaped_
 
 sub cert {
 	my ($uri) = @_;
-	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(8443),
-			SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(),
-			SSL_cert_file => "$d/localhost.crt",
-			SSL_key_file => "$d/localhost.key",
-			SSL_error_trap => sub { die $_[1] },
-		);
-		alarm(0);
-	};
-	alarm(0);
-
-	if ($@) {
-		log_in("died: $@");
-		return undef;
-	}
-
-	http_get($uri, socket => $s);
+	return http_get(
+		$uri,
+		SSL => 1,
+		SSL_cert_file => "$d/localhost.crt",
+		SSL_key_file => "$d/localhost.key"
+	);
 }
 
 ###############################################################################