Mercurial > hg > nginx-tests
annotate stream_ssl_variables.t @ 1983:c7315caf2110
Tests: optimized processing of large QUIC packets with padding.
Path MTU discovery packets might contain a lot of padding, and creating
a copy of the whole buffer for each PADDING frame, which is just one
byte with type 0, consumes lots of resources. This was seen to result
in flapping of at least h3_keepalive.t and h3_ssl_early_data.t tests.
Fix is to copy at most 8 bytes for parse_int() calls when parsing
frame types.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 03 Jun 2024 04:17:28 +0300 |
parents | c924ae8d7104 |
children |
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(); |
1966
c924ae8d7104
Tests: session reuse handling with Net::SSLeay with LibreSSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1870
diff
changeset
|
101 local $TODO = 'no TLSv1.3 sessions in Net::SSLeay (LibreSSL)' |
c924ae8d7104
Tests: session reuse handling with Net::SSLeay with LibreSSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1870
diff
changeset
|
102 if Net::SSLeay::constant("LIBRESSL_VERSION_NUMBER") && 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
|
103 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
104 $s = stream( |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
105 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
|
106 SSL => 1, |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
107 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
|
108 ); |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
109 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
|
110 'ssl variables - session reused'); |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 |
1845
65b1dd07c0e4
Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1835
diff
changeset
|
112 } |
65b1dd07c0e4
Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1835
diff
changeset
|
113 |
1447
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
114 SKIP: { |
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
115 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
|
116 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
117 $s = stream( |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
118 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
|
119 SSL => 1, |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
120 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
|
121 SSL_hostname => 'example.com' |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
122 ); |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
123 is($s->read(), 'example.com', 'ssl server name'); |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
125 $s = stream( |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
126 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
|
127 SSL => 1, |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
128 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
|
129 SSL_hostname => 'example.com' |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
130 ); |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
131 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
|
132 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
133 $s = stream( |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
134 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
|
135 SSL => 1 |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
136 ); |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
137 is($s->read(), '', 'ssl server name empty'); |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 |
1447
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
139 } |
e1c64ee44212
Tests: added $ssl_server_name tests with SSL session reuse.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
140 |
1863
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
141 undef $s; |
dbb7561a9441
Tests: reworked stream SSL tests to use IO::Socket::SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1845
diff
changeset
|
142 |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 ############################################################################### |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
144 |
1845
65b1dd07c0e4
Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1835
diff
changeset
|
145 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
|
146 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
|
147 $s->read() =~ /TLSv1.3/; |
967
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
148 } |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
149 |
eb111c5f7556
Tests: stream ssl tests with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
150 ############################################################################### |