Mercurial > hg > nginx-tests
annotate h3_ssl_session_reuse.t @ 1905:f35824e75b66
Tests: fixed reading QUIC streams on Perl < 5.24.
The parse_stream() routine has had a missing explicit return if there were no
streams received. In Perl < 5.24 this used to return no value, or an empty
array in the list context. In modern Perl this returns an empty value, or an
array of 1 element, which made the check for last index of the returned array
work rather by accident.
The fix is to return explicitly and to check the array size in callers instead.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 06 Jun 2023 18:50:07 +0400 |
parents | 8b74936ff2ac |
children | d329b05e20fa |
rev | line source |
---|---|
1885
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for TLS session resumption with HTTP/3. |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use Test::Nginx::HTTP3; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 ############################################################################### |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 |
1896
8b74936ff2ac
Tests: added has_feature() test for CryptX.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1885
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http http_v3 cryptx/) |
1885
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 ->has_daemon('openssl')->plan(8) |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 ->write_file_expand('nginx.conf', <<'EOF'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 %%TEST_GLOBALS%% |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 daemon off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 events { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 http { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 %%TEST_GLOBALS_HTTP%% |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 ssl_certificate_key localhost.key; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 ssl_certificate localhost.crt; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 add_header X-Session $ssl_session_reused always; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 listen 127.0.0.1:%%PORT_8943_UDP%% quic; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 server_name localhost; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 listen 127.0.0.1:%%PORT_8944_UDP%% quic; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 server_name localhost; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 ssl_session_cache shared:SSL:1m; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 ssl_session_tickets on; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 listen 127.0.0.1:%%PORT_8945_UDP%% quic; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 server_name localhost; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 ssl_session_cache shared:SSL:1m; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 ssl_session_tickets off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 listen 127.0.0.1:%%PORT_8946_UDP%% quic; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 server_name localhost; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 ssl_session_cache builtin; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 ssl_session_tickets off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 listen 127.0.0.1:%%PORT_8947_UDP%% quic; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 server_name localhost; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 ssl_session_cache builtin:1000; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 ssl_session_tickets off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 listen 127.0.0.1:%%PORT_8948_UDP%% quic; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 server_name localhost; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 ssl_session_cache none; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 ssl_session_tickets off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 listen 127.0.0.1:%%PORT_8949_UDP%% quic; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 server_name localhost; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 ssl_session_cache off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
95 ssl_session_tickets off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
96 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 EOF |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 $t->write_file('openssl.conf', <<EOF); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 [ req ] |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 default_bits = 2048 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 encrypt_key = no |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 distinguished_name = req_distinguished_name |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 [ req_distinguished_name ] |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 EOF |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 my $d = $t->testdir(); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 foreach my $name ('localhost') { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 system('openssl req -x509 -new ' |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
113 . "-config $d/openssl.conf -subj /CN=$name/ " |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 . "-out $d/$name.crt -keyout $d/$name.key " |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 . ">>$d/openssl.out 2>&1") == 0 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 or die "Can't create certificate for $name: $!\n"; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 $t->run(); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 ############################################################################### |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 # session reuse: |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 # |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 # - only tickets, the default |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 # - tickets and shared cache, should work always |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 # - only shared cache |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 # - only builtin cache |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 # - only builtin cache with explicitly configured size |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 # - only cache none |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 # - only cache off |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 TODO: { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 local $TODO = 'no TLSv1.3 sessions in LibreSSL' |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 if $t->has_module('LibreSSL'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 is(test_reuse(8943), 1, 'tickets reused'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 is(test_reuse(8944), 1, 'tickets and cache reused'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
140 local $TODO = 'no TLSv1.3 session cache in BoringSSL' |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 if $t->has_module('BoringSSL'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
142 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 is(test_reuse(8945), 1, 'cache shared reused'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
144 is(test_reuse(8946), 1, 'cache builtin reused'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
145 is(test_reuse(8947), 1, 'cache builtin size reused'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
147 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
148 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
149 is(test_reuse(8948), 0, 'cache none not reused'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
150 is(test_reuse(8949), 0, 'cache off not reused'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
151 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
152 $t->stop(); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
153 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
154 like(`grep -F '[crit]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no crit'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
155 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
156 ############################################################################### |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
157 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
158 sub test_reuse { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
159 my ($port) = @_; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
160 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
161 my $s = Test::Nginx::HTTP3->new($port); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
162 my $frames = $s->read(all => [{ sid => $s->new_stream(), fin => 1 }]); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
163 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
164 my $psk_list = $s->{psk_list}; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
165 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
166 $s = Test::Nginx::HTTP3->new($port, psk_list => $psk_list); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
167 $frames = $s->read(all => [{ sid => $s->new_stream(), fin => 1 }]); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
168 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
169 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
170 return $frame->{headers}->{'x-session'} eq 'r' ? 1 : 0; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
171 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
172 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
173 ############################################################################### |