Mercurial > hg > nginx-tests
annotate stream_ssl_variables.t @ 1933:9bafe7cddd3c
Tests: improved QUIC key update tests with old keys.
On unsuccessful protection removal, it is now retried with old keys.
Otherwise, old keys are removed to ensure they're no longer in use.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 21 Aug 2023 17:26:47 +0400 |
parents | 884e898b9fe7 |
children | c924ae8d7104 |
rev | line source |
---|---|
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for stream ssl module with variables. |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use Test::Nginx::Stream qw/ stream /; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 ############################################################################### |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
26 my $t = Test::Nginx->new() |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
27 ->has(qw/stream stream_ssl stream_return socket_ssl_sni/) |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 ->has_daemon('openssl'); |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 $t->write_file_expand('nginx.conf', <<'EOF'); |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 %%TEST_GLOBALS%% |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 daemon off; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 events { |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 } |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 stream { |
1609
f3ba4c74de31
Tests: added TEST_GLOBALS_STREAM variable support.
Andrei Belov <defan@nginx.com>
parents:
1535
diff
changeset
|
40 %%TEST_GLOBALS_STREAM%% |
f3ba4c74de31
Tests: added TEST_GLOBALS_STREAM variable support.
Andrei Belov <defan@nginx.com>
parents:
1535
diff
changeset
|
41 |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 ssl_certificate_key localhost.key; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 ssl_certificate localhost.crt; |
1447
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
44 ssl_session_cache builtin; |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
967
diff
changeset
|
47 listen 127.0.0.1:8080; |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
48 listen 127.0.0.1:8443 ssl; |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 return $ssl_session_reused:$ssl_session_id:$ssl_cipher:$ssl_protocol; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 } |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 server { |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
53 listen 127.0.0.1:8444 ssl; |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 return $ssl_server_name; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 } |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 } |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 EOF |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 $t->write_file('openssl.conf', <<EOF); |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 [ req ] |
1488
dbce8fb5f5f8
Tests: align with OpenSSL security level 2.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1448
diff
changeset
|
62 default_bits = 2048 |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 encrypt_key = no |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 distinguished_name = req_distinguished_name |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 [ req_distinguished_name ] |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 EOF |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 my $d = $t->testdir(); |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 foreach my $name ('localhost') { |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 system('openssl req -x509 -new ' |
1220
0af58b78df35
Tests: removed single quotes from system() calls.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1116
diff
changeset
|
72 . "-config $d/openssl.conf -subj /CN=$name/ " |
0af58b78df35
Tests: removed single quotes from system() calls.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1116
diff
changeset
|
73 . "-out $d/$name.crt -keyout $d/$name.key " |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 . ">>$d/openssl.out 2>&1") == 0 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 or die "Can't create certificate for $name: $!\n"; |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 } |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 |
1447
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
78 $t->run()->plan(6); |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 ############################################################################### |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
82 my $s; |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 |
1235
3fc6817cd84a
Tests: explicit peer port in stream tests now required.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1220
diff
changeset
|
84 is(stream('127.0.0.1:' . port(8080))->read(), ':::', 'no ssl'); |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
86 $s = stream( |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
87 PeerAddr => '127.0.0.1:' . port(8443), |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
88 SSL => 1, |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
89 SSL_session_cache_size => 100 |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
90 ); |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
91 like($s->read(), qr/^\.:(\w{64})?:[\w-]+:(TLS|SSL)v(\d|\.)+$/, |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 'ssl variables'); |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 |
1845
65b1dd07c0e4
Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1835
diff
changeset
|
94 TODO: { |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
95 local $TODO = 'no TLSv1.3 sessions, old Net::SSLeay' |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
96 if $Net::SSLeay::VERSION < 1.88 && test_tls13(); |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
97 local $TODO = 'no TLSv1.3 sessions, old IO::Socket::SSL' |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
98 if $IO::Socket::SSL::VERSION < 2.061 && test_tls13(); |
1845
65b1dd07c0e4
Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1835
diff
changeset
|
99 local $TODO = 'no TLSv1.3 sessions in LibreSSL' |
65b1dd07c0e4
Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1835
diff
changeset
|
100 if $t->has_module('LibreSSL') && test_tls13(); |
65b1dd07c0e4
Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1835
diff
changeset
|
101 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
102 $s = stream( |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
103 PeerAddr => '127.0.0.1:' . port(8443), |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
104 SSL => 1, |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
105 SSL_reuse_ctx => $s->socket() |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
106 ); |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
107 like($s->read(), qr/^r:(\w{64})?:[\w-]+:(TLS|SSL)v(\d|\.)+$/, |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 'ssl variables - session reused'); |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 |
1845
65b1dd07c0e4
Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1835
diff
changeset
|
110 } |
65b1dd07c0e4
Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1835
diff
changeset
|
111 |
1447
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
112 SKIP: { |
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
113 skip 'no sni', 3 unless $t->has_module('sni'); |
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
114 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
115 $s = stream( |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
116 PeerAddr => '127.0.0.1:' . port(8444), |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
117 SSL => 1, |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
118 SSL_session_cache_size => 100, |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
119 SSL_hostname => 'example.com' |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
120 ); |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
121 is($s->read(), 'example.com', 'ssl server name'); |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
123 $s = stream( |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
124 PeerAddr => '127.0.0.1:' . port(8444), |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
125 SSL => 1, |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
126 SSL_reuse_ctx => $s->socket(), |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
127 SSL_hostname => 'example.com' |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
128 ); |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
129 is($s->read(), 'example.com', 'ssl server name - reused'); |
1447
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
130 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
131 $s = stream( |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
132 PeerAddr => '127.0.0.1:' . port(8444), |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
133 SSL => 1 |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
134 ); |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
135 is($s->read(), '', 'ssl server name empty'); |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 |
1447
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
137 } |
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
138 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
139 undef $s; |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
140 |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 ############################################################################### |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
142 |
1845
65b1dd07c0e4
Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1835
diff
changeset
|
143 sub test_tls13 { |
1870
884e898b9fe7
Tests: unbreak stream_ssl_variables.t with old IO::Socket::SSL.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1863
diff
changeset
|
144 my $s = stream(PeerAddr => '127.0.0.1:' . port(8443), SSL => 1); |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
145 $s->read() =~ /TLSv1.3/; |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 } |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
147 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
148 ############################################################################### |