comparison ssl.t @ 1723:3581dc3c1937

Tests: added ssl test for "unexpected eof while reading". See for details: http://mailman.nginx.org/pipermail/nginx/2020-March/059162.html
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 11 Aug 2021 11:55:51 +0300
parents 00c08f068f79
children b27bcded6449
comparison
equal deleted inserted replaced
1722:122002b19416 1723:3581dc3c1937
29 plan(skip_all => 'IO::Socket::SSL not installed') if $@; 29 plan(skip_all => 'IO::Socket::SSL not installed') if $@;
30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); }; 30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); };
31 plan(skip_all => 'IO::Socket::SSL too old') if $@; 31 plan(skip_all => 'IO::Socket::SSL too old') if $@;
32 32
33 my $t = Test::Nginx->new()->has(qw/http http_ssl rewrite proxy/) 33 my $t = Test::Nginx->new()->has(qw/http http_ssl rewrite proxy/)
34 ->has_daemon('openssl')->plan(26); 34 ->has_daemon('openssl')->plan(28);
35 35
36 $t->write_file_expand('nginx.conf', <<'EOF'); 36 $t->write_file_expand('nginx.conf', <<'EOF');
37 37
38 %%TEST_GLOBALS%% 38 %%TEST_GLOBALS%%
39 39
314 $req x= 1000; 314 $req x= 1000;
315 315
316 my $r = http($req, socket => $s) || ""; 316 my $r = http($req, socket => $s) || "";
317 is(() = $r =~ /(200 OK)/g, 1000, 'pipelined requests'); 317 is(() = $r =~ /(200 OK)/g, 1000, 'pipelined requests');
318 318
319 # OpenSSL 3.0 error "unexpected eof while reading" seen as a critical error
320
321 ok(get_ssl_socket(8085), 'ssl unexpected eof');
322
319 # close_notify is sent before lingering close 323 # close_notify is sent before lingering close
320 324
321 is(get_ssl_shutdown(8085), 1, 'ssl shutdown on lingering close'); 325 is(get_ssl_shutdown(8085), 1, 'ssl shutdown on lingering close');
322 326
323 $t->stop(); 327 $t->stop();
328 332
329 like($t->read_file('ssl.log'), qr/^(TLS|SSL)v(\d|\.)+$/m, 333 like($t->read_file('ssl.log'), qr/^(TLS|SSL)v(\d|\.)+$/m,
330 'log ssl variable on lingering close'); 334 'log ssl variable on lingering close');
331 335
332 } 336 }
337
338 like(`grep -F '[crit]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no crit');
333 339
334 ############################################################################### 340 ###############################################################################
335 341
336 sub get { 342 sub get {
337 my ($uri, $port, $ctx) = @_; 343 my ($uri, $port, $ctx) = @_;