diff ssl_curve.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 58951cf933e1
children 6bafe9419126
line wrap: on
line diff
--- a/ssl_curve.t
+++ b/ssl_curve.t
@@ -75,43 +75,6 @@ foreach my $name ('localhost') {
 
 ###############################################################################
 
-like(get('/curve'), qr/^prime256v1 /m, 'ssl curve');
+like(http_get('/curve', SSL => 1), qr/^prime256v1 /m, 'ssl curve');
 
 ###############################################################################
-
-sub get {
-	my ($uri, $port, $ctx) = @_;
-	my $s = get_ssl_socket($port) or return;
-	my $r = http_get($uri, socket => $s);
-	$s->close();
-	return $r;
-}
-
-sub get_ssl_socket {
-	my ($port, $ctx) = @_;
-	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_error_trap => sub { die $_[1] },
-		);
-		alarm(0);
-	};
-	alarm(0);
-
-	if ($@) {
-		log_in("died: $@");
-		return undef;
-	}
-
-	return $s;
-}
-
-###############################################################################