Mercurial > hg > nginx-tests
annotate h3_ssl_session_reuse.t @ 1885:905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
LibreSSL doesn't send NewSessionTicket messages in CRYPTO frames.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 18 Jan 2023 16:04:33 +0400 |
parents | |
children | 8b74936ff2ac |
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 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; }; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 plan(skip_all => 'CryptX version >= 0.067 required') if $@; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 my $t = Test::Nginx->new()->has(qw/http http_v3/) |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 ->has_daemon('openssl')->plan(8) |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 ->write_file_expand('nginx.conf', <<'EOF'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 %%TEST_GLOBALS%% |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 daemon off; |
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 events { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 } |
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 http { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 %%TEST_GLOBALS_HTTP%% |
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 ssl_certificate_key localhost.key; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 ssl_certificate localhost.crt; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 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
|
47 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 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
|
50 server_name localhost; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 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
|
55 server_name localhost; |
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 ssl_session_cache shared:SSL:1m; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 ssl_session_tickets on; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 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
|
63 server_name localhost; |
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 ssl_session_cache shared:SSL:1m; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 ssl_session_tickets off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 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
|
71 server_name localhost; |
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 ssl_session_cache builtin; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 ssl_session_tickets off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 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
|
79 server_name localhost; |
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 ssl_session_cache builtin:1000; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 ssl_session_tickets off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 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
|
87 server_name localhost; |
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 ssl_session_cache none; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 ssl_session_tickets off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 server { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 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
|
95 server_name localhost; |
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 ssl_session_cache off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 ssl_session_tickets off; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 } |
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 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 EOF |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 $t->write_file('openssl.conf', <<EOF); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 [ req ] |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 default_bits = 2048 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 encrypt_key = no |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 distinguished_name = req_distinguished_name |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 [ req_distinguished_name ] |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 EOF |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 my $d = $t->testdir(); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
113 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 foreach my $name ('localhost') { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 system('openssl req -x509 -new ' |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 . "-config $d/openssl.conf -subj /CN=$name/ " |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 . "-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
|
118 . ">>$d/openssl.out 2>&1") == 0 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 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
|
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 $t->run(); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 |
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 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 # session reuse: |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 # |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 # - only tickets, the default |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 # - tickets and shared cache, should work always |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 # - only shared cache |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 # - only builtin cache |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 # - only builtin cache with explicitly configured size |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 # - only cache none |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 # - only cache off |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 TODO: { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 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
|
138 if $t->has_module('LibreSSL'); |
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 is(test_reuse(8943), 1, 'tickets reused'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 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
|
142 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 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
|
144 if $t->has_module('BoringSSL'); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
145 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 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
|
147 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
|
148 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
|
149 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
150 } |
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 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
|
153 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
|
154 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
155 $t->stop(); |
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 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
|
158 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
159 ############################################################################### |
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 sub test_reuse { |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
162 my ($port) = @_; |
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 $s = Test::Nginx::HTTP3->new($port); |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
165 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
|
166 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
167 my $psk_list = $s->{psk_list}; |
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 $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
|
170 $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
|
171 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
172 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
173 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
|
174 } |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
175 |
905b1704eb54
Tests: TLS session resumption tests with HTTP/3.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
176 ############################################################################### |