[nginx-tests] Tests: removed remnants of NPN in tests.
Maxim Dounin
mdounin at mdounin.ru
Mon Aug 12 03:37:28 UTC 2024
details: http://freenginx.org/hg/nginx-tests/rev/d2d00eea7b3d
branches:
changeset: 1997:d2d00eea7b3d
user: Maxim Dounin <mdounin at mdounin.ru>
date: Fri Aug 09 05:18:52 2024 +0300
description:
Tests: removed remnants of NPN in tests.
NPN support was removed in nginx 1.21.4 (7934:61abb35bb8cf).
diffstat:
h2_ssl_proxy_cache.t | 11 +-----
h2_ssl_variables.t | 85 +++---------------------------------------------
lib/Test/Nginx/HTTP2.pm | 2 -
3 files changed, 7 insertions(+), 91 deletions(-)
diffs (175 lines):
diff --git a/h2_ssl_proxy_cache.t b/h2_ssl_proxy_cache.t
--- a/h2_ssl_proxy_cache.t
+++ b/h2_ssl_proxy_cache.t
@@ -92,7 +92,7 @@ open OLDERR, ">&", \*STDERR; close STDER
$t->run();
open STDERR, ">&", \*OLDERR;
-plan(skip_all => 'no ALPN/NPN negotiation') unless defined getconn(port(8080));
+plan(skip_all => 'no ALPN negotiation') unless defined getconn(port(8080));
$t->plan(1);
###############################################################################
@@ -129,15 +129,6 @@ sub getconn {
if $sock->alpn_selected();
};
- return $s if defined $s;
-
- eval {
- my $sock = Test::Nginx::HTTP2::new_socket($port, SSL => 1,
- npn => 'h2');
- $s = Test::Nginx::HTTP2->new($port, socket => $sock)
- if $sock->next_proto_negotiated();
- };
-
return $s;
}
diff --git a/h2_ssl_variables.t b/h2_ssl_variables.t
--- a/h2_ssl_variables.t
+++ b/h2_ssl_variables.t
@@ -24,7 +24,7 @@ select STDERR; $| = 1;
select STDOUT; $| = 1;
my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 rewrite socket_ssl/)
- ->has_daemon('openssl')->plan(8);
+ ->has_daemon('openssl')->plan(4);
$t->write_file_expand('nginx.conf', <<'EOF');
@@ -88,29 +88,13 @@ open STDERR, ">&", \*OLDERR;
my ($s, $sid, $frames, $frame);
-my $has_npn = eval { Test::Nginx::HTTP2::new_socket(port(8080), SSL => 1,
- npn => 'h2')->next_proto_negotiated() };
my $has_alpn = eval { Test::Nginx::HTTP2::new_socket(port(8080), SSL => 1,
alpn => 'h2')->alpn_selected() };
-# SSL/TLS connection, NPN
-
SKIP: {
-skip 'OpenSSL NPN support required', 1 unless $has_npn;
-
-$s = Test::Nginx::HTTP2->new(port(8080), SSL => 1, npn => 'h2');
-$sid = $s->new_stream({ path => '/h2' });
-$frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
+skip 'OpenSSL ALPN support required', 4 unless $has_alpn;
-($frame) = grep { $_->{type} eq "DATA" } @$frames;
-is($frame->{data}, 'h2', 'http variable - npn');
-
-}
-
-# SSL/TLS connection, ALPN
-
-SKIP: {
-skip 'OpenSSL ALPN support required', 1 unless $has_alpn;
+# SSL/TLS connection
$s = Test::Nginx::HTTP2->new(port(8080), SSL => 1, alpn => 'h2');
$sid = $s->new_stream({ path => '/h2' });
@@ -119,26 +103,7 @@ skip 'OpenSSL ALPN support required', 1
($frame) = grep { $_->{type} eq "DATA" } @$frames;
is($frame->{data}, 'h2', 'http variable - alpn');
-}
-
-# $server_protocol - SSL/TLS connection, NPN
-
-SKIP: {
-skip 'OpenSSL NPN support required', 1 unless $has_npn;
-
-$s = Test::Nginx::HTTP2->new(port(8080), SSL => 1, npn => 'h2');
-$sid = $s->new_stream({ path => '/sp' });
-$frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
-
-($frame) = grep { $_->{type} eq "DATA" } @$frames;
-is($frame->{data}, 'HTTP/2.0', 'server_protocol variable - npn');
-
-}
-
-# $server_protocol - SSL/TLS connection, ALPN
-
-SKIP: {
-skip 'OpenSSL ALPN support required', 1 unless $has_alpn;
+# $server_protocol
$s = Test::Nginx::HTTP2->new(port(8080), SSL => 1, alpn => 'h2');
$sid = $s->new_stream({ path => '/sp' });
@@ -147,26 +112,7 @@ skip 'OpenSSL ALPN support required', 1
($frame) = grep { $_->{type} eq "DATA" } @$frames;
is($frame->{data}, 'HTTP/2.0', 'server_protocol variable - alpn');
-}
-
-# $scheme - SSL/TLS connection, NPN
-
-SKIP: {
-skip 'OpenSSL NPN support required', 1 unless $has_npn;
-
-$s = Test::Nginx::HTTP2->new(port(8080), SSL => 1, npn => 'h2');
-$sid = $s->new_stream({ path => '/scheme' });
-$frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
-
-($frame) = grep { $_->{type} eq "DATA" } @$frames;
-is($frame->{data}, 'https', 'scheme variable - npn');
-
-}
-
-# $scheme - SSL/TLS connection, ALPN
-
-SKIP: {
-skip 'OpenSSL ALPN support required', 1 unless $has_alpn;
+# $scheme
$s = Test::Nginx::HTTP2->new(port(8080), SSL => 1, alpn => 'h2');
$sid = $s->new_stream({ path => '/scheme' });
@@ -175,26 +121,7 @@ skip 'OpenSSL ALPN support required', 1
($frame) = grep { $_->{type} eq "DATA" } @$frames;
is($frame->{data}, 'https', 'scheme variable - alpn');
-}
-
-# $https - SSL/TLS connection, NPN
-
-SKIP: {
-skip 'OpenSSL NPN support required', 1 unless $has_npn;
-
-$s = Test::Nginx::HTTP2->new(port(8080), SSL => 1, npn => 'h2');
-$sid = $s->new_stream({ path => '/https' });
-$frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
-
-($frame) = grep { $_->{type} eq "DATA" } @$frames;
-is($frame->{data}, 'on', 'https variable - npn');
-
-}
-
-# $https - SSL/TLS connection, ALPN
-
-SKIP: {
-skip 'OpenSSL ALPN support required', 1 unless $has_alpn;
+# $https
$s = Test::Nginx::HTTP2->new(port(8080), SSL => 1, alpn => 'h2');
$sid = $s->new_stream({ path => '/https' });
diff --git a/lib/Test/Nginx/HTTP2.pm b/lib/Test/Nginx/HTTP2.pm
--- a/lib/Test/Nginx/HTTP2.pm
+++ b/lib/Test/Nginx/HTTP2.pm
@@ -532,7 +532,6 @@ sub unpack_length {
sub new_socket {
my ($port, %extra) = @_;
- my $npn = $extra{'npn'};
my $alpn = $extra{'alpn'};
my $s;
@@ -550,7 +549,6 @@ sub new_socket {
IO::Socket::SSL->start_SSL($s,
SSL_version => 'SSLv23',
SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(),
- SSL_npn_protocols => $npn ? [ $npn ] : undef,
SSL_alpn_protocols => $alpn ? [ $alpn ] : undef,
SSL_error_trap => sub { die $_[1] }
) if $extra{'SSL'};
More information about the nginx-devel
mailing list