Mercurial > hg > nginx-tests
annotate h3_headers.t @ 1999:15f538440a77 default tip
Tests: adjusted proxy_cache_use_stale.t cache validity.
At least the "s-w-r - updating stale" test sometimes fails on slow
hosts due to "stale-while-revalidate=4" being not enough, so the request
returns with the EXPIRED cache status instead of STALE.
Fix is to use larger "stale-while-revalidate=" times where it is not
significant.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 09 Aug 2024 18:37:25 +0300 |
parents | 8b74936ff2ac |
children |
rev | line source |
---|---|
1876
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for HTTP/3 headers. |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use Test::Nginx::HTTP3; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 ############################################################################### |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 |
1896
8b74936ff2ac
Tests: added has_feature() test for CryptX.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1883
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http http_v3 proxy rewrite cryptx/) |
1883
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
27 ->has_daemon('openssl')->plan(68) |
1876
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 ->write_file_expand('nginx.conf', <<'EOF'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 %%TEST_GLOBALS%% |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 daemon off; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 events { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 http { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 %%TEST_GLOBALS_HTTP%% |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 ssl_certificate_key localhost.key; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 ssl_certificate localhost.crt; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 server { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 listen 127.0.0.1:%%PORT_8980_UDP%% quic; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 listen 127.0.0.1:8081; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 server_name localhost; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 location / { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 add_header X-Sent-Foo $http_x_foo; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 add_header X-Referer $http_referer; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 add_header X-Path $uri; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 return 200; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 location /proxy/ { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 add_header X-UC-a $upstream_cookie_a; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 add_header X-UC-c $upstream_cookie_c; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 proxy_pass http://127.0.0.1:8083/; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 proxy_set_header X-Cookie-a $cookie_a; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 proxy_set_header X-Cookie-c $cookie_c; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 location /proxy2/ { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 proxy_pass http://127.0.0.1:8081/; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 location /set-cookie { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 add_header Set-Cookie a=b; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 add_header Set-Cookie c=d; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 return 200; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 location /cookie { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 add_header X-Cookie $http_cookie; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 add_header X-Cookie-a $cookie_a; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 add_header X-Cookie-c $cookie_c; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 return 200; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 server { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 listen 127.0.0.1:%%PORT_8984_UDP%% quic; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 server_name localhost; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 large_client_header_buffers 4 512; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 server { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 listen 127.0.0.1:%%PORT_8985_UDP%% quic; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 server_name localhost; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 large_client_header_buffers 1 512; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
95 server { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
96 listen 127.0.0.1:%%PORT_8986_UDP%% quic; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 server_name localhost; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 underscores_in_headers on; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 add_header X-Sent-Foo $http_x_foo always; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 server { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 listen 127.0.0.1:%%PORT_8987_UDP%% quic; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 server_name localhost; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 ignore_invalid_headers off; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 add_header X-Sent-Foo $http_x_foo always; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 } |
1883
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
110 |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
111 server { |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
112 listen 127.0.0.1:%%PORT_8988_UDP%% quic; |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
113 server_name localhost; |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
114 |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
115 client_header_timeout 1s; |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
116 } |
1876
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 EOF |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 $t->write_file('openssl.conf', <<EOF); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 [ req ] |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 default_bits = 2048 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 encrypt_key = no |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 distinguished_name = req_distinguished_name |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 [ req_distinguished_name ] |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 EOF |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 my $d = $t->testdir(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 foreach my $name ('localhost') { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 system('openssl req -x509 -new ' |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 . "-config $d/openssl.conf -subj /CN=$name/ " |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 . "-out $d/$name.crt -keyout $d/$name.key " |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 . ">>$d/openssl.out 2>&1") == 0 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 or die "Can't create certificate for $name: $!\n"; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 $t->run_daemon(\&http_daemon); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
140 $t->run()->waitforsocket('127.0.0.1:' . port(8083)); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
142 $t->write_file('t2.html', 'SEE-THIS'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
144 ############################################################################### |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
145 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 my ($s, $sid, $frames, $frame); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
147 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
148 # 4.5.2. Indexed Field Line |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
149 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
150 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
151 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
152 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
153 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
154 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
155 { name => ':authority', value => 'localhost', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
156 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
157 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
158 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
159 is($frame->{headers}->{'x-path'}, '/', 'indexed'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
160 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
161 $s->insert_literal(':path', '/foo'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
162 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
163 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
164 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
165 { name => ':path', value => '/foo', mode => 0, dyn => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
166 { name => ':authority', value => 'localhost', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
167 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
168 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
169 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
170 is($frame->{headers}->{'x-path'}, '/foo', 'indexed dynamic'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
171 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
172 $s->insert_literal(':path', '/bar', huff => 1); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
173 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
174 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
175 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
176 { name => ':path', value => '/bar', mode => 0, dyn => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
177 { name => ':authority', value => 'localhost', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
178 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
179 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
180 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
181 is($frame->{headers}->{'x-path'}, '/bar', 'indexed dynamic huffman'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
182 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
183 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
184 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
185 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
186 { name => ':path', value => '/foo', mode => 0, dyn => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
187 { name => ':authority', value => 'localhost', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
188 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
189 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
190 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
191 is($frame->{headers}->{'x-path'}, '/foo', 'indexed dynamic previous'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
192 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
193 $s->insert_reference(':path', '/qux'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
194 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
195 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
196 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
197 { name => ':path', value => '/qux', mode => 0, dyn => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
198 { name => ':authority', value => 'localhost', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
199 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
200 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
201 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
202 is($frame->{headers}->{'x-path'}, '/qux', 'indexed reference'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
203 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
204 $s->insert_reference(':path', '/corge', dyn => 1); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
205 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
206 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
207 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
208 { name => ':path', value => '/corge', mode => 0, dyn => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
209 { name => ':authority', value => 'localhost', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
210 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
211 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
212 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
213 is($frame->{headers}->{'x-path'}, '/corge', 'indexed reference dynamic'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
214 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
215 $s->insert_reference(':path', '/grault', huff => 1); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
216 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
217 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
218 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
219 { name => ':path', value => '/grault', mode => 0, dyn => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
220 { name => ':authority', value => 'localhost', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
221 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
222 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
223 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
224 is($frame->{headers}->{'x-path'}, '/grault', 'indexed reference huffman'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
225 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
226 # 4.5.3. Indexed Field Line with Post-Base Index |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
227 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
228 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
229 $s->insert_literal(':path', '/foo'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
230 $sid = $s->new_stream({ base => -1, headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
231 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
232 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
233 { name => ':path', value => '/foo', mode => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
234 { name => ':authority', value => 'localhost', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
235 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
236 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
237 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
238 is($frame->{headers}->{'x-path'}, '/foo', 'post-base index'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
239 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
240 # 4.5.4. Literal Field Line with Name Reference |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
241 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
242 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
243 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
244 { name => ':method', value => 'GET', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
245 { name => ':scheme', value => 'http', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
246 { name => ':path', value => '/', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
247 { name => ':authority', value => 'localhost', mode => 2 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
248 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
249 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
250 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
251 is($frame->{headers}->{':status'}, 200, 'reference'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
252 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
253 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
254 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
255 { name => ':method', value => 'GET', mode => 2, huff => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
256 { name => ':scheme', value => 'http', mode => 2, huff => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
257 { name => ':path', value => '/', mode => 2, huff => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
258 { name => ':authority', value => 'localhost', mode => 2, huff => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
259 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
260 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
261 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
262 is($frame->{headers}->{':status'}, 200, 'reference huffman'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
263 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
264 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
265 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
266 { name => ':method', value => 'GET', mode => 2, ni => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
267 { name => ':scheme', value => 'http', mode => 2, ni => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
268 { name => ':path', value => '/', mode => 2, ni => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
269 { name => ':authority', value => 'localhost', mode => 2, ni => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
270 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
271 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
272 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
273 is($frame->{headers}->{':status'}, 200, 'reference never indexed'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
274 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
275 $s->insert_literal('x-foo', 'X-Bar'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
276 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
277 { name => ':method', value => 'GET', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
278 { name => ':scheme', value => 'http', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
279 { name => ':path', value => '/', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
280 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
281 { name => 'x-foo', value => 'X-Baz', mode => 2, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
282 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
283 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
284 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
285 is($frame->{headers}->{'x-sent-foo'}, 'X-Baz', 'reference dynamic'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
286 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
287 # 4.5.5. Literal Field Line with Post-Base Name Reference |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
288 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
289 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
290 $s->insert_literal('x-foo', 'X-Bar'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
291 $sid = $s->new_stream({ base => -1, headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
292 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
293 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
294 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
295 { name => ':authority', value => 'localhost', mode => 4 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
296 { name => 'x-foo', value => 'X-Baz', mode => 3 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
297 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
298 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
299 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
300 is($frame->{headers}->{'x-sent-foo'}, 'X-Baz', 'base-base ref'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
301 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
302 $sid = $s->new_stream({ base => -1, headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
303 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
304 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
305 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
306 { name => ':authority', value => 'localhost', mode => 4 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
307 { name => 'x-foo', value => 'X-Baz', mode => 3, huff => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
308 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
309 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
310 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
311 is($frame->{headers}->{'x-sent-foo'}, 'X-Baz', 'post-base ref huffman'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
312 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
313 $sid = $s->new_stream({ base => -1, headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
314 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
315 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
316 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
317 { name => ':authority', value => 'localhost', mode => 4 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
318 { name => 'x-foo', value => 'X-Baz', mode => 3, ni => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
319 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
320 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
321 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
322 is($frame->{headers}->{'x-sent-foo'}, 'X-Baz', 'post-base ref never indexed'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
323 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
324 # 4.5.6. Literal Field Line with Literal Name |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
325 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
326 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
327 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
328 { name => ':method', value => 'GET', mode => 4 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
329 { name => ':scheme', value => 'http', mode => 4 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
330 { name => ':path', value => '/', mode => 4 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
331 { name => ':authority', value => 'localhost', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
332 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
333 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
334 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
335 is($frame->{headers}->{':status'}, 200, 'literal'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
336 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
337 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
338 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
339 { name => ':method', value => 'GET', mode => 4, huff => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
340 { name => ':scheme', value => 'http', mode => 4, huff => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
341 { name => ':path', value => '/', mode => 4, huff => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
342 { name => ':authority', value => 'localhost', mode => 4, huff => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
343 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
344 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
345 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
346 is($frame->{headers}->{':status'}, 200, 'literal huffman'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
347 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
348 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
349 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
350 { name => ':method', value => 'GET', mode => 4, ni => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
351 { name => ':scheme', value => 'http', mode => 4, ni => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
352 { name => ':path', value => '/', mode => 4, ni => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
353 { name => ':authority', value => 'localhost', mode => 4, ni => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
354 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
355 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
356 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
357 is($frame->{headers}->{':status'}, 200, 'literal never indexed'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
358 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
359 # response header field with characters not suitable for huffman encoding |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
360 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
361 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
362 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
363 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
364 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
365 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
366 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
367 { name => 'x-foo', value => '{{{{{', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
368 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
369 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
370 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
371 is($frame->{headers}->{'x-sent-foo'}, '{{{{{', 'rare chars'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
372 like($s->{headers}, qr/\Q{{{{{/, 'rare chars - no huffman encoding'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
373 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
374 # response header field with huffman encoding |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
375 # NB: implementation detail, not obligated |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
376 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
377 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
378 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
379 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
380 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
381 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
382 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
383 { name => 'x-foo', value => 'aaaaa', mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
384 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
385 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
386 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
387 is($frame->{headers}->{'x-sent-foo'}, 'aaaaa', 'well known chars'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
388 unlike($s->{headers}, qr/aaaaa/, 'well known chars - huffman encoding'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
389 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
390 # response header field with huffman encoding - complete table mod \0, CR, LF |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
391 # first saturate with short-encoded characters (NB: implementation detail) |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
392 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
393 my $field = pack "C*", ((map { 97 } (1 .. 862)), 1 .. 9, 11, 12, 14 .. 255); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
394 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
395 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
396 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
397 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
398 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
399 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
400 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
401 { name => 'x-foo', value => $field, mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
402 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
403 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
404 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
405 is($frame->{headers}->{'x-sent-foo'}, $field, 'all chars'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
406 unlike($s->{headers}, qr/abcde/, 'all chars - huffman encoding'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
407 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
408 # 3.2.2. Dynamic Table Capacity and Eviction |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
409 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
410 # remove some indexed headers from the dynamic table |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
411 # by maintaining dynamic table space only for index 0 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
412 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
413 $s = Test::Nginx::HTTP3->new(undef, capacity => 64); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
414 $s->insert_literal('x-foo', 'X-Bar'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
415 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
416 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
417 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
418 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
419 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
420 { name => 'x-foo', value => 'X-Bar', mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
421 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
422 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
423 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
424 is($frame->{headers}->{'x-sent-foo'}, 'X-Bar', 'capacity insert'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
425 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
426 $s->insert_literal('x-foo', 'X-Baz'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
427 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
428 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
429 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
430 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
431 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
432 { name => 'x-foo', value => 'X-Baz', mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
433 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
434 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
435 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
436 is($frame->{headers}->{'x-sent-foo'}, 'X-Baz', 'capacity replace'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
437 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
438 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
439 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
440 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
441 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
442 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
443 { name => 'x-foo', value => 'X-Bar', mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
444 $frames = $s->read(all => [{ type => 'DECODER_C' }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
445 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
446 ($frame) = grep { $_->{type} eq "DECODER_C" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
447 is($frame->{'val'}, $sid, 'capacity eviction'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
448 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
449 # insert with referenced entry eviction |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
450 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
451 $s = Test::Nginx::HTTP3->new(undef, capacity => 64); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
452 $s->insert_literal('x-foo', 'X-Bar'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
453 $s->insert_reference('x-foo', 'X-Baz', dyn => 1); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
454 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
455 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
456 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
457 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
458 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
459 { name => 'x-foo', value => 'X-Baz', mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
460 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
461 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
462 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
463 is($frame->{headers}->{'x-sent-foo'}, 'X-Baz', 'insert ref eviction'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
464 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
465 $s = Test::Nginx::HTTP3->new(undef, capacity => 64); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
466 $s->insert_literal('x-foo', 'X-Bar'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
467 $s->duplicate('x-foo'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
468 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
469 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
470 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
471 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
472 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
473 { name => 'x-foo', value => 'X-Bar', mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
474 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
475 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
476 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
477 is($frame->{headers}->{'x-sent-foo'}, 'X-Bar', 'duplicate eviction'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
478 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
479 # invalid capacity |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
480 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
481 $s = Test::Nginx::HTTP3->new(undef, capacity => 4097); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
482 $frames = $s->read(all => [{ type => 'CONNECTION_CLOSE' }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
483 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
484 ($frame) = grep { $_->{type} eq "CONNECTION_CLOSE" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
485 is($frame->{'phrase'}, 'stream error', 'capacity invalid'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
486 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
487 # request header field with multiple values |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
488 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
489 # 4.2.1. Field Compression |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
490 # To allow for better compression efficiency, the Cookie header field |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
491 # MAY be split into separate field lines <..>. |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
492 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
493 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
494 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
495 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
496 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
497 { name => ':path', value => '/cookie', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
498 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
499 { name => 'cookie', value => 'a=b', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
500 { name => 'cookie', value => 'c=d', mode => 2 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
501 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
502 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
503 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
504 is($frame->{headers}->{'x-cookie-a'}, 'b', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
505 'multiple request header fields - cookie'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
506 is($frame->{headers}->{'x-cookie-c'}, 'd', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
507 'multiple request header fields - cookie 2'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
508 is($frame->{headers}->{'x-cookie'}, 'a=b; c=d', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
509 'multiple request header fields - semi-colon'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
510 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
511 # request header field with multiple values to HTTP backend |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
512 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
513 # 4.2.1. Field Compression |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
514 # these MUST be concatenated into a single byte string |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
515 # using the two-byte delimiter of "; " (ASCII 0x3b, 0x20) |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
516 # before being passed into a context other than HTTP/2 or |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
517 # HTTP/3, such as an HTTP/1.1 connection <..> |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
518 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
519 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
520 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
521 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
522 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
523 { name => ':path', value => '/proxy/cookie', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
524 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
525 { name => 'cookie', value => 'a=b', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
526 { name => 'cookie', value => 'c=d', mode => 2 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
527 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
528 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
529 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
530 is($frame->{headers}->{'x-sent-cookie'}, 'a=b; c=d', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
531 'multiple request header fields proxied - semi-colon'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
532 is($frame->{headers}->{'x-sent-cookie2'}, '', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
533 'multiple request header fields proxied - dublicate cookie'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
534 is($frame->{headers}->{'x-sent-cookie-a'}, 'b', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
535 'multiple request header fields proxied - cookie 1'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
536 is($frame->{headers}->{'x-sent-cookie-c'}, 'd', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
537 'multiple request header fields proxied - cookie 2'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
538 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
539 # response header field with multiple values |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
540 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
541 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
542 $sid = $s->new_stream({ path => '/set-cookie' }); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
543 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
544 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
545 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
546 is($frame->{headers}->{'set-cookie'}[0], 'a=b', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
547 'multiple response header fields - cookie'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
548 is($frame->{headers}->{'set-cookie'}[1], 'c=d', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
549 'multiple response header fields - cookie 2'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
550 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
551 # response header field with multiple values from HTTP backend |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
552 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
553 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
554 $sid = $s->new_stream({ path => '/proxy/set-cookie' }); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
555 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
556 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
557 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
558 is($frame->{headers}->{'set-cookie'}[0], 'a=b', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
559 'multiple response header proxied - cookie'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
560 is($frame->{headers}->{'set-cookie'}[1], 'c=d', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
561 'multiple response header proxied - cookie 2'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
562 is($frame->{headers}->{'x-uc-a'}, 'b', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
563 'multiple response header proxied - upstream cookie'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
564 is($frame->{headers}->{'x-uc-c'}, 'd', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
565 'multiple response header proxied - upstream cookie 2'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
566 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
567 # max_field_size - header field name |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
568 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
569 $s = Test::Nginx::HTTP3->new(8984, capacity => 2048); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
570 $s->insert_literal('x' x 511, 'value'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
571 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
572 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
573 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
574 { name => ':path', value => '/t2.html', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
575 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
576 { name => 'x' x 511, value => 'value', mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
577 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
578 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
579 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
580 ok($frame, 'field name size less'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
581 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
582 $s = Test::Nginx::HTTP3->new(8984, capacity => 2048); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
583 $s->insert_literal('x' x 512, 'value'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
584 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
585 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
586 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
587 { name => ':path', value => '/t2.html', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
588 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
589 { name => 'x' x 512, value => 'value', mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
590 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
591 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
592 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
593 ok($frame, 'field name size equal'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
594 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
595 $s = Test::Nginx::HTTP3->new(8984, capacity => 2048); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
596 $s->insert_literal('x' x 513, 'value'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
597 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
598 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
599 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
600 { name => ':path', value => '/t2.html', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
601 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
602 { name => 'x' x 513, value => 'value', mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
603 $frames = $s->read(all => [{ type => 'CONNECTION_CLOSE' }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
604 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
605 ($frame) = grep { $_->{type} eq "CONNECTION_CLOSE" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
606 is($frame->{'phrase'}, 'stream error', 'field name size greater'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
607 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
608 # max_field_size - header field value |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
609 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
610 $s = Test::Nginx::HTTP3->new(8984, capacity => 2048); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
611 $s->insert_literal('name', 'x' x 511); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
612 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
613 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
614 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
615 { name => ':path', value => '/t2.html', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
616 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
617 { name => 'name', value => 'x' x 511, mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
618 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
619 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
620 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
621 ok($frame, 'field value size less'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
622 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
623 $s = Test::Nginx::HTTP3->new(8984, capacity => 2048); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
624 $s->insert_literal('name', 'x' x 512); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
625 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
626 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
627 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
628 { name => ':path', value => '/t2.html', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
629 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
630 { name => 'name', value => 'x' x 512, mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
631 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
632 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
633 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
634 ok($frame, 'field value size equal'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
635 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
636 $s = Test::Nginx::HTTP3->new(8984, capacity => 2048); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
637 $s->insert_literal('name', 'x' x 513); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
638 $frames = $s->read(all => [{ type => 'CONNECTION_CLOSE' }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
639 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
640 ($frame) = grep { $_->{type} eq "CONNECTION_CLOSE" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
641 is($frame->{'phrase'}, 'stream error', 'field value size greater'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
642 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
643 # max_header_size |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
644 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
645 $s = Test::Nginx::HTTP3->new(8985, capacity => 2048); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
646 $s->insert_literal('longname', 'x' x 450); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
647 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
648 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
649 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
650 { name => ':path', value => '/t2.html', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
651 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
652 { name => 'longname', value => 'x' x 450, mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
653 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
654 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
655 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
656 ok($frame, 'header size less'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
657 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
658 $s = Test::Nginx::HTTP3->new(8985, capacity => 2048); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
659 $s->insert_literal('longname', 'x' x 451); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
660 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
661 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
662 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
663 { name => ':path', value => '/t2.html', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
664 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
665 { name => 'longname', value => 'x' x 451, mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
666 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
667 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
668 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
669 ok($frame, 'header size equal'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
670 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
671 $s = Test::Nginx::HTTP3->new(8985, capacity => 2048); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
672 $s->insert_literal('longname', 'x' x 452); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
673 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
674 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
675 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
676 { name => ':path', value => '/t2.html', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
677 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
678 { name => 'longname', value => 'x' x 452, mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
679 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
680 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
681 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
682 is($frame->{headers}->{':status'}, 400, 'header size greater'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
683 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
684 # header size is based on (decompressed) header list |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
685 # two extra 1-byte indices would otherwise fit in max_header_size |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
686 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
687 $s = Test::Nginx::HTTP3->new(8985, capacity => 2048); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
688 $s->insert_literal('longname', 'x' x 400); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
689 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
690 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
691 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
692 { name => ':path', value => '/t2.html', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
693 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
694 { name => 'longname', value => 'x' x 400, mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
695 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
696 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
697 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
698 ok($frame, 'header size indexed'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
699 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
700 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
701 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
702 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
703 { name => ':path', value => '/t2.html', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
704 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
705 { name => 'longname', value => 'x' x 400, mode => 0, dyn => 1 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
706 { name => 'longname', value => 'x' x 400, mode => 0, dyn => 1 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
707 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
708 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
709 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
710 is($frame->{headers}->{':status'}, 400, 'header size indexed greater'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
711 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
712 # ensure that request header field value with newline doesn't get split |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
713 # |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
714 # 10.3. Intermediary-Encapsulation Attacks |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
715 # Requests or responses containing invalid field names MUST be treated |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
716 # as malformed. |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
717 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
718 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
719 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
720 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
721 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
722 { name => ':path', value => '/proxy2/', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
723 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
724 { name => 'x-foo', value => "x-bar\r\nreferer:see-this", mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
725 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
726 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
727 # 10.3. Intermediary Encapsulation Attacks |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
728 # Therefore, an intermediary cannot translate an HTTP/3 request or response |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
729 # containing an invalid field name into an HTTP/1.1 message. |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
730 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
731 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
732 isnt($frame->{headers}->{'x-referer'}, 'see-this', 'newline in request header'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
733 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
734 is($frame->{headers}->{':status'}, 400, 'newline in request header - bad request'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
735 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
736 # invalid header name as seen with underscore should not lead to ignoring rest |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
737 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
738 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
739 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
740 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
741 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
742 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
743 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
744 { name => 'x_foo', value => "x-bar", mode => 4 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
745 { name => 'referer', value => "see-this", mode => 2 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
746 $frames = $s->read(all => [{ type => 'HEADERS' }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
747 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
748 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
749 is($frame->{headers}->{'x-referer'}, 'see-this', 'after invalid header name'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
750 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
751 # other invalid header name characters as seen with ':' |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
752 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
753 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
754 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
755 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
756 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
757 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
758 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
759 { name => 'x:foo', value => "x-bar", mode => 4 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
760 { name => 'referer', value => "see-this", mode => 2 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
761 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
762 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
763 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
764 is($frame->{headers}->{':status'}, 400, 'colon in header name'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
765 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
766 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
767 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
768 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
769 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
770 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
771 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
772 { name => 'x foo', value => "bar", mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
773 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
774 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
775 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
776 is($frame->{headers}->{':status'}, 400, 'space in header name'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
777 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
778 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
779 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
780 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
781 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
782 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
783 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
784 { name => "foo\x02", value => "bar", mode => 4 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
785 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
786 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
787 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
788 is($frame->{headers}->{':status'}, 400, 'control in header name'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
789 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
790 # header name with underscore - underscores_in_headers on |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
791 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
792 $s = Test::Nginx::HTTP3->new(8986); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
793 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
794 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
795 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
796 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
797 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
798 { name => 'x_foo', value => "x-bar", mode => 4 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
799 { name => 'referer', value => "see-this", mode => 2 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
800 $frames = $s->read(all => [{ type => 'HEADERS' }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
801 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
802 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
803 is($frame->{headers}->{'x-sent-foo'}, 'x-bar', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
804 'underscore in header name - underscores_in_headers'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
805 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
806 # header name with underscore - ignore_invalid_headers off |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
807 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
808 $s = Test::Nginx::HTTP3->new(8987); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
809 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
810 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
811 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
812 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
813 { name => ':authority', value => 'localhost', mode => 2 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
814 { name => 'x_foo', value => "x-bar", mode => 4 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
815 { name => 'referer', value => "see-this", mode => 2 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
816 $frames = $s->read(all => [{ type => 'HEADERS' }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
817 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
818 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
819 is($frame->{headers}->{'x-sent-foo'}, 'x-bar', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
820 'underscore in header name - ignore_invalid_headers'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
821 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
822 # missing mandatory request header ':scheme' |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
823 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
824 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
825 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
826 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
827 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
828 { name => ':authority', value => 'localhost', mode => 2 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
829 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
830 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
831 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
832 is($frame->{headers}->{':status'}, 400, 'incomplete headers'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
833 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
834 # empty request header ':authority' |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
835 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
836 $s = Test::Nginx::HTTP3->new(); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
837 $sid = $s->new_stream({ headers => [ |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
838 { name => ':method', value => 'GET', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
839 { name => ':scheme', value => 'http', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
840 { name => ':path', value => '/', mode => 0 }, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
841 { name => ':authority', value => '', mode => 0 }]}); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
842 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
843 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
844 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
845 is($frame->{headers}->{':status'}, 400, 'empty authority'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
846 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
847 # client sent invalid :path header |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
848 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
849 $sid = $s->new_stream({ path => 't2.html' }); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
850 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
851 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
852 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
853 is($frame->{headers}->{':status'}, 400, 'invalid path'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
854 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
855 $sid = $s->new_stream({ path => "/t2.html\x02" }); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
856 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
857 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
858 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
859 is($frame->{headers}->{':status'}, 400, 'invalid path control'); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
860 |
1883
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
861 # stream blocked on insert count |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
862 |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
863 $s = Test::Nginx::HTTP3->new(); |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
864 $sid = $s->new_stream({ ric => 3 }); |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
865 select undef, undef, undef, 0.2; |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
866 |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
867 $s->reset_stream($sid, 0x010c); |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
868 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
869 |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
870 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
871 is($frame->{headers}->{':status'}, '400', 'blocked insert reset - bad request'); |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
872 |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
873 $s = Test::Nginx::HTTP3->new(8988); |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
874 $sid = $s->new_stream({ ric => 3 }); |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
875 $frames = $s->read(all => [{ type => 'RESET_STREAM' }]); |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
876 |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
877 ($frame) = grep { $_->{type} eq "RESET_STREAM" } @$frames; |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
878 is($frame->{sid}, $sid, 'blocked insert timeout - RESET_STREAM'); |
ff50c265a5ac
Tests: HTTP/3 tests with streams blocked on insert count.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1876
diff
changeset
|
879 |
1876
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
880 ############################################################################### |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
881 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
882 sub http_daemon { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
883 my $server = IO::Socket::INET->new( |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
884 Proto => 'tcp', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
885 LocalHost => '127.0.0.1', |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
886 LocalPort => port(8083), |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
887 Listen => 5, |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
888 Reuse => 1 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
889 ) |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
890 or die "Can't create listening socket: $!\n"; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
891 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
892 local $SIG{PIPE} = 'IGNORE'; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
893 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
894 while (my $client = $server->accept()) { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
895 $client->autoflush(1); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
896 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
897 my $headers = ''; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
898 my $uri = ''; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
899 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
900 while (<$client>) { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
901 $headers .= $_; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
902 last if (/^\x0d?\x0a?$/); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
903 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
904 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
905 next if $headers eq ''; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
906 $uri = $1 if $headers =~ /^\S+\s+([^ ]+)\s+HTTP/i; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
907 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
908 if ($uri eq '/cookie') { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
909 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
910 my ($cookie, $cookie2) = $headers =~ /Cookie: (.+)/ig; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
911 $cookie2 = '' unless defined $cookie2; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
912 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
913 my ($cookie_a, $cookie_c) = ('', ''); |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
914 $cookie_a = $1 if $headers =~ /X-Cookie-a: (.+)/i; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
915 $cookie_c = $1 if $headers =~ /X-Cookie-c: (.+)/i; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
916 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
917 print $client <<EOF; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
918 HTTP/1.1 200 OK |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
919 Connection: close |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
920 X-Sent-Cookie: $cookie |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
921 X-Sent-Cookie2: $cookie2 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
922 X-Sent-Cookie-a: $cookie_a |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
923 X-Sent-Cookie-c: $cookie_c |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
924 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
925 EOF |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
926 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
927 } elsif ($uri eq '/set-cookie') { |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
928 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
929 print $client <<EOF; |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
930 HTTP/1.1 200 OK |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
931 Connection: close |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
932 Set-Cookie: a=b |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
933 Set-Cookie: c=d |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
934 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
935 EOF |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
936 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
937 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
938 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
939 } |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
940 |
74cb9454a13e
Tests: HTTP/3 header tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
941 ############################################################################### |