Mercurial > hg > nginx-tests
annotate h3_server_name.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | 11463d379570 |
children |
rev | line source |
---|---|
1882
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for HTTP/3 protocol, SNI TLS extension and regex in server_name. |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use Test::Nginx::HTTP2; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 use Test::Nginx::HTTP3; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 ############################################################################### |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 select STDERR; $| = 1; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 select STDOUT; $| = 1; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 |
1894
cd66d6f50ec1
Tests: converted h3_server_name.t to use "socket_ssl_alpn".
Sergey Kandaurov <pluknet@nginx.com>
parents:
1882
diff
changeset
|
27 my $t = Test::Nginx->new() |
1896
8b74936ff2ac
Tests: added has_feature() test for CryptX.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1895
diff
changeset
|
28 ->has(qw/http http_ssl http_v2 http_v3 rewrite socket_ssl_alpn cryptx/) |
1882
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 ->has_daemon('openssl')->plan(6); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 $t->write_file_expand('nginx.conf', <<'EOF'); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 %%TEST_GLOBALS%% |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 daemon off; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 events { |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 } |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 http { |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 %%TEST_GLOBALS_HTTP%% |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 ssl_certificate_key localhost.key; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 ssl_certificate localhost.crt; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 server { |
1986
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
47 listen 127.0.0.1:8443 ssl; |
1882
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 listen 127.0.0.1:%%PORT_8980_UDP%% quic; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 server_name ~^(?P<name>.+)\.example\.com$; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 |
1986
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
51 http2 on; |
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
52 |
1882
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 location / { |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 return 200 $name; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 } |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 } |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 } |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 EOF |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 $t->write_file('openssl.conf', <<EOF); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 [ req ] |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 default_bits = 2048 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 encrypt_key = no |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 distinguished_name = req_distinguished_name |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 [ req_distinguished_name ] |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 EOF |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 my $d = $t->testdir(); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 foreach my $name ('localhost') { |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 system('openssl req -x509 -new ' |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 . "-config $d/openssl.conf -subj /CN=$name/ " |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 . "-out $d/$name.crt -keyout $d/$name.key " |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 . ">>$d/openssl.out 2>&1") == 0 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 or die "Can't create certificate for $name: $!\n"; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 } |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 $t->run(); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 ############################################################################### |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 # ssl_servername_regex wasn't inherited from QUIC connection, |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 # other protocols are provided for convenience |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 is(get1('test.example.com'), 'test', 'http1 - sni match'); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 is(get1('test.example.com', 'localhost'), 'test', 'http1 - sni not found'); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 is(get2('test.example.com'), 'test', 'http2 - sni match'); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 is(get2('test.example.com', 'localhost'), 'test', 'http2 - sni not found'); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 is(get3('test.example.com'), 'test', 'http3 - sni match'); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 is(get3('test.example.com', 'localhost'), 'test', 'http3 - sni not found'); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
95 ############################################################################### |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
96 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 sub get1 { |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 my ($host, $sni) = @_; |
1895
acd68670b064
Tests: simplified using IO::Socket::SSL in h3_server_name.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1894
diff
changeset
|
99 http("GET / HTTP/1.0\nHost: $host\n\n", |
acd68670b064
Tests: simplified using IO::Socket::SSL in h3_server_name.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1894
diff
changeset
|
100 SSL => 1, |
acd68670b064
Tests: simplified using IO::Socket::SSL in h3_server_name.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1894
diff
changeset
|
101 SSL_hostname => $sni || $host, |
acd68670b064
Tests: simplified using IO::Socket::SSL in h3_server_name.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1894
diff
changeset
|
102 SSL_alpn_protocols => ['http/1.1']) |
acd68670b064
Tests: simplified using IO::Socket::SSL in h3_server_name.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1894
diff
changeset
|
103 =~ /.*?\x0d\x0a?\x0d\x0a?(.*)/ms; |
1882
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 return $1; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 } |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 sub get2 { |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 my ($host, $sni) = @_; |
1895
acd68670b064
Tests: simplified using IO::Socket::SSL in h3_server_name.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1894
diff
changeset
|
109 my $sock = http('', start => 1, |
acd68670b064
Tests: simplified using IO::Socket::SSL in h3_server_name.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1894
diff
changeset
|
110 SSL => 1, |
acd68670b064
Tests: simplified using IO::Socket::SSL in h3_server_name.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1894
diff
changeset
|
111 SSL_hostname => $sni || $host, |
acd68670b064
Tests: simplified using IO::Socket::SSL in h3_server_name.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1894
diff
changeset
|
112 SSL_alpn_protocols => ['h2']); |
1882
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
113 my $s = Test::Nginx::HTTP2->new(undef, socket => $sock); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 my $sid = $s->new_stream({ host => $host }); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 my ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 return $frame->{data}; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 } |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 sub get3 { |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 my ($host, $sni) = @_; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 my $s = Test::Nginx::HTTP3->new(8980, sni => $sni || $host); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 my $sid = $s->new_stream({ host => $host }); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 my ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 return $frame->{data}; |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 } |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 |
3619dcc8ba6d
Tests: HTTP/3 tests with server_name captures.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 ############################################################################### |