Mercurial > hg > nginx-tests
diff h2_ssl.t @ 1033:45c80276d691
Tests: unbreak for nginx built with OpenSSL without NPN/ALPN.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 14 Sep 2016 19:38:13 +0300 |
parents | 3c5d3b384d3f |
children | a034903de974 |
line wrap: on
line diff
--- a/h2_ssl.t +++ b/h2_ssl.t @@ -27,7 +27,9 @@ eval { require IO::Socket::SSL; }; plan(skip_all => 'IO::Socket::SSL not installed') if $@; my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2/) - ->has_daemon('openssl')->plan(1); + ->has_daemon('openssl'); + +$t->todo_alerts() unless $t->has_version('1.11.3'); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -79,20 +81,18 @@ open OLDERR, ">&", \*STDERR; close STDER $t->run(); open STDERR, ">&", \*OLDERR; +plan(skip_all => 'no ALPN/NPN negotiation') unless defined getconn(port(0)); +$t->plan(1); + ############################################################################### # client cancels 2nd stream after HEADERS has been created # while some unsent data was left in the SSL buffer # HEADERS frame may stuck in SSL buffer and won't be sent producing alert -SKIP: { my $s = getconn(port(0)); -skip 'OpenSSL ALPN/NPN support required', 1 unless defined $s; - ok($s, 'ssl connection'); -$t->todo_alerts() unless $t->has_version('1.11.3'); - my $sid = $s->new_stream({ path => '/tbig.html' }); select undef, undef, undef, 0.2; @@ -105,8 +105,6 @@ select undef, undef, undef, 0.2; $t->stop(); -} - ############################################################################### sub getconn { @@ -114,15 +112,19 @@ sub getconn { my $s; eval { - IO::Socket::SSL->can_alpn() or die; - $s = Test::Nginx::HTTP2->new($port, SSL => 1, alpn => 'h2'); + my $sock = Test::Nginx::HTTP2::new_socket($port, SSL => 1, + alpn => 'h2'); + $s = Test::Nginx::HTTP2->new($port, socket => $sock) + if $sock->alpn_selected(); }; return $s if defined $s; eval { - IO::Socket::SSL->can_npn() or die; - $s = Test::Nginx::HTTP2->new($port, SSL => 1, npn => 'h2'); + 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;