comparison ssl.t @ 1675:0d1cec688111

Tests: logging ssl variables with lingering close.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 12 May 2021 12:50:55 +0300
parents 666d54ab5036
children 5ac6efbe5552
comparison
equal deleted inserted replaced
1674:55816c5fc861 1675:0d1cec688111
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(25); 34 ->has_daemon('openssl')->plan(26);
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
46 %%TEST_GLOBALS_HTTP%% 46 %%TEST_GLOBALS_HTTP%%
47 47
48 ssl_certificate_key localhost.key; 48 ssl_certificate_key localhost.key;
49 ssl_certificate localhost.crt; 49 ssl_certificate localhost.crt;
50 ssl_session_tickets off; 50 ssl_session_tickets off;
51
52 log_format ssl $ssl_protocol;
51 53
52 server { 54 server {
53 listen 127.0.0.1:8085 ssl; 55 listen 127.0.0.1:8085 ssl;
54 listen 127.0.0.1:8080; 56 listen 127.0.0.1:8080;
55 server_name localhost; 57 server_name localhost;
90 } 92 }
91 93
92 location /body { 94 location /body {
93 add_header X-Body $request_body always; 95 add_header X-Body $request_body always;
94 proxy_pass http://127.0.0.1:8080/; 96 proxy_pass http://127.0.0.1:8080/;
97
98 access_log %%TESTDIR%%/ssl.log ssl;
95 } 99 }
96 } 100 }
97 101
98 server { 102 server {
99 listen 127.0.0.1:8081; 103 listen 127.0.0.1:8081;
316 320
317 TODO: { 321 TODO: {
318 local $TODO = 'not yet' unless $t->has_version('1.19.5'); 322 local $TODO = 'not yet' unless $t->has_version('1.19.5');
319 323
320 is(get_ssl_shutdown(8085), 1, 'ssl shutdown on lingering close'); 324 is(get_ssl_shutdown(8085), 1, 'ssl shutdown on lingering close');
325
326 }
327
328 $t->stop();
329
330 TODO: {
331 local $TODO = 'not yet' if $t->has_version('1.19.5');
332
333 like($t->read_file('ssl.log'), qr/^(TLS|SSL)v(\d|\.)+$/m,
334 'log ssl variable on lingering close');
321 335
322 } 336 }
323 337
324 ############################################################################### 338 ###############################################################################
325 339