Mercurial > hg > nginx-tests
annotate h2_request_body_discard.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | fe6f22da53ec |
children |
rev | line source |
---|---|
1961
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
2 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
3 # (C) Maxim Dounin |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
4 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
5 # Tests for discarding request body with HTTP/2. |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
6 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
7 ############################################################################### |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 use warnings; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
10 use strict; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
12 use Test::More; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
13 use Socket qw/ CRLF /; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
14 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
17 use lib 'lib'; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
18 use Test::Nginx; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
19 use Test::Nginx::HTTP2; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
20 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
21 ############################################################################### |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
22 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
25 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 my $t = Test::Nginx->new() |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 ->has(qw/http http_v2 proxy rewrite addition memcached/); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
28 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
29 plan(skip_all => 'not yet') unless $t->has_version('1.27.0'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
30 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
31 $t->plan(38)->write_file_expand('nginx.conf', <<'EOF'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
32 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
33 %%TEST_GLOBALS%% |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
34 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
35 daemon off; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
36 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
37 events { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
38 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
39 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
40 http { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
41 %%TEST_GLOBALS_HTTP%% |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
42 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
43 server { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
44 listen 127.0.0.1:8080; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
45 server_name localhost; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
46 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
47 http2 on; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
48 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
49 lingering_timeout 1s; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
50 add_header X-Body body:$content_length:$request_body:; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
51 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
52 client_max_body_size 1k; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
53 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
54 error_page 400 /proxy/error400; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
55 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
56 location / { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
57 error_page 413 /error413; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
58 proxy_pass http://127.0.0.1:8082; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
59 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
60 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
61 location /error413 { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
62 return 200 "custom error 413"; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
63 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
64 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
65 location /add { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
66 return 200 "main response"; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
67 add_before_body /add/before; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
68 addition_types *; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
69 client_max_body_size 1m; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
70 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
71 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
72 location /add/before { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
73 proxy_pass http://127.0.0.1:8081; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
75 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
76 location /memcached { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
77 client_max_body_size 1m; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
78 error_page 502 /memcached/error502; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
79 memcached_pass 127.0.0.1:8083; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
80 set $memcached_key $request_uri; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
81 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
82 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
83 location /memcached/error502 { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
84 proxy_pass http://127.0.0.1:8081; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
86 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
87 location /proxy { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
88 client_max_body_size 3; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
89 error_page 413 /proxy/error413; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
90 error_page 400 /proxy/error400; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
91 error_page 502 /proxy/error502; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
92 proxy_pass http://127.0.0.1:8083; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
93 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
94 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
95 location /proxy/error413 { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
96 proxy_pass http://127.0.0.1:8081; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
97 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
98 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
99 location /proxy/error400 { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
100 proxy_pass http://127.0.0.1:8081; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
101 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
102 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
103 location /proxy/error502 { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
104 proxy_pass http://127.0.0.1:8081; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
105 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
106 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
107 location /unbuf { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
108 client_max_body_size 1m; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
109 error_page 502 /unbuf/error502; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
110 proxy_pass http://127.0.0.1:8083; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
111 proxy_request_buffering off; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 proxy_http_version 1.1; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
113 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
114 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 location /unbuf/error502 { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
116 client_max_body_size 1m; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
117 proxy_pass http://127.0.0.1:8081; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
119 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 location /unbuf2 { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
121 client_max_body_size 1m; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
122 error_page 400 /unbuf2/error400; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
123 proxy_pass http://127.0.0.1:8081; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
124 proxy_request_buffering off; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
125 proxy_http_version 1.1; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
126 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
127 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
128 location /unbuf2/error400 { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
129 client_max_body_size 1m; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
130 proxy_pass http://127.0.0.1:8081; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
131 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
132 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
133 location /length { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
134 client_max_body_size 1; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
135 error_page 413 /length/error413; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
136 error_page 502 /length/error502; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
137 proxy_pass http://127.0.0.1:8083; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
138 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
139 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
140 location /length/error413 { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
141 return 200 "frontend body:$content_length:$request_body:"; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
142 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
143 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
144 location /length/error502 { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
145 return 200 "frontend body:$content_length:$request_body:"; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
146 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
147 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
148 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
149 server { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
150 listen 127.0.0.1:8081; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
151 server_name localhost; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
152 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
153 location / { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
154 proxy_pass http://127.0.0.1:8082; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
155 proxy_set_header X-Body body:$content_length:$request_body:; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
156 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
157 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
158 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
159 server { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
160 listen 127.0.0.1:8082; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
161 server_name localhost; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
162 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
163 return 200 "backend $http_x_body"; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
164 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
165 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
166 server { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
167 listen 127.0.0.1:8083; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
168 server_name localhost; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
169 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
170 return 444; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
171 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
172 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
173 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
174 EOF |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
175 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
176 $t->run(); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
177 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
178 ############################################################################### |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
179 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
180 # error_page 413 should work without redefining client_max_body_size |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
181 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
182 like(http2_get_body('/', '0123456789' x 128), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
183 qr/status: 413.*custom error 413/s, 'custom error 413'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
184 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
185 # subrequest after discarding body |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
186 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
187 like(http2_get('/add'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
188 qr/backend body:::.*main response/s, 'add'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
189 like(http2_get_body('/add', '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
190 qr/backend body:::.*main response/s, 'add small'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
191 like(http2_get_body_incomplete('/add', 10000, '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
192 qr/backend body:::.*main response/s, 'add long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
193 like(http2_get_body_nolen('/add', '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
194 qr/backend body:::.*main response/s, 'add nolen'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
195 like(http2_get_body_nolen('/add', '0', '123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
196 qr/backend body:::.*main response/s, 'add nolen multi'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
197 like(http2_get_body_incomplete_nolen('/add', 10000, '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
198 qr/backend body:::.*main response/s, 'add chunked long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
199 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
200 # error_page 502 with proxy_pass after discarding body |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
201 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
202 like(http2_get('/memcached'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
203 qr/backend body:::/s, 'memcached'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
204 like(http2_get_body('/memcached', '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
205 qr/status: 502.*backend body:::/s, 'memcached small'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
206 like(http2_get_body_incomplete('/memcached', 10000, '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
207 qr/status: 502.*backend body:::/s, 'memcached long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
208 like(http2_get_body_nolen('/memcached', '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
209 qr/status: 502.*backend body:::/s, 'memcached nolen'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
210 like(http2_get_body_nolen('/memcached', '0', '123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
211 qr/status: 502.*backend body:::/s, 'memcached nolen multi'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
212 like(http2_get_body_incomplete_nolen('/memcached', 10000, '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
213 qr/status: 502.*backend body:::/s, 'memcached nolen long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
214 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
215 # error_page 413 with proxy_pass |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
216 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
217 like(http2_get('/proxy'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
218 qr/status: 502.*backend body:::/s, 'proxy'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
219 like(http2_get_body('/proxy', '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
220 qr/status: 413.*backend body:::/s, 'proxy small'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
221 like(http2_get_body_incomplete('/proxy', 10000, '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
222 qr/status: 413.*backend body:::/s, 'proxy long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
223 like(http2_get_body_nolen('/proxy', '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
224 qr/status: 413.*backend body:::/s, 'proxy nolen'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
225 like(http2_get_body_nolen('/proxy', '0', '123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
226 qr/status: 413.*backend body:::/s, 'proxy nolen multi'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
227 like(http2_get_body_incomplete_nolen('/proxy', 10000, '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
228 qr/status: 413.*backend body:::/s, 'proxy nolen long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
229 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
230 # error_page 400 with proxy_pass |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
231 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
232 # note that "proxy too short" test triggers 400 during parsing |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
233 # request headers, and therefore needs error_page at server level |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
234 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
235 like(http2_get_body_custom('/proxy', 1), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
236 qr/status: 400.*backend body:::/s, 'proxy too short'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
237 like(http2_get_body_custom('/proxy', 1, ''), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
238 qr/status: 400.*backend body:::/s, 'proxy too short body'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
239 like(http2_get_body_custom('/proxy', 1, '01'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
240 qr/status: 400.*backend body:::/s, 'proxy too long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
241 like(http2_get_body_custom('/proxy', 1, '01', more => 1), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
242 qr/status: 400.*backend body:::/s, 'proxy too long more'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
243 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
244 # error_page 502 after proxy with request buffering disabled |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
245 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
246 like(http2_get('/unbuf'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
247 qr/status: 502.*backend body:::/s, 'unbuf proxy'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
248 like(http2_get_body('/unbuf', '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
249 qr/status: 502.*backend body:::/s, 'unbuf proxy small'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
250 like(http2_get_body_incomplete('/unbuf', 10000, '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
251 qr/status: 502.*backend body:::/s, 'unbuf proxy long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
252 like(http2_get_body_nolen('/unbuf', '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
253 qr/status: 502.*backend body:::/s, 'unbuf proxy nolen'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
254 like(http2_get_body_nolen('/unbuf', '0', '123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
255 qr/status: 502.*backend body:::/s, 'unbuf proxy nolen multi'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
256 like(http2_get_body_incomplete_nolen('/unbuf', 10000, '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
257 qr/status: 502.*backend body:::/s, 'unbuf proxy nolen long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
258 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
259 # error_page 400 after proxy with request buffering disabled |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
260 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
261 like(http2_get_body_custom('/unbuf2', 1, '', sleep => 0.1), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
262 qr/status: 400.*backend body:::/s, 'unbuf too short'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
263 like(http2_get_body_custom('/unbuf2', 1, '01', sleep => 0.1), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
264 qr/status: 400.*backend body:::/s, 'unbuf too long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
265 like(http2_get_body_custom('/unbuf2', 1, '01', sleep => 0.1, more => 1), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
266 qr/status: 400.*backend body:::/s, 'unbuf too long more'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
267 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
268 # error_page 413 and $content_length |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
269 # (used in fastcgi_pass, grpc_pass, uwsgi_pass) |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
270 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
271 like(http2_get('/length'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
272 qr/status: 502.*frontend body:::/s, '$content_length'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
273 like(http2_get_body('/length', '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
274 qr/status: 413.*frontend body:::/s, '$content_length small'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
275 like(http2_get_body_incomplete('/length', 10000, '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
276 qr/status: 413.*frontend body:::/s, '$content_length long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
277 like(http2_get_body_nolen('/length', '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
278 qr/status: 413.*frontend body:::/s, '$content_length nolen'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
279 like(http2_get_body_nolen('/length', '0', '123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
280 qr/status: 413.*frontend body:::/s, '$content_length nolen multi'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
281 like(http2_get_body_incomplete_nolen('/length', 10000, '0123456789'), |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
282 qr/status: 413.*frontend body:::/s, '$content_length nolen long'); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
283 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
284 ############################################################################### |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
285 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
286 sub http2_get { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
287 my ($uri) = @_; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
288 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
289 my $s = Test::Nginx::HTTP2->new(); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
290 my $sid = $s->new_stream({ path => $uri }); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
291 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
292 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
293 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
294 my ($data) = grep { $_->{type} eq "DATA" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
295 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
296 return join("\n", map { "$_: " . $frame->{headers}->{$_}; } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
297 keys %{$frame->{headers}}) . "\n\n" . $data->{data}; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
298 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
299 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
300 sub http2_get_body { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
301 my ($uri, $body) = @_; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
302 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
303 my $s = Test::Nginx::HTTP2->new(); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
304 my $sid = $s->new_stream({ path => $uri, body => $body }); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
305 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
306 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
307 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
308 my ($data) = grep { $_->{type} eq "DATA" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
309 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
310 return join("\n", map { "$_: " . $frame->{headers}->{$_}; } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
311 keys %{$frame->{headers}}) . "\n\n" . $data->{data}; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
312 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
313 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
314 sub http2_get_body_nolen { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
315 my ($uri, $body, $body2) = @_; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
316 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
317 my $s = Test::Nginx::HTTP2->new(); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
318 my $sid = $s->new_stream({ path => $uri, body_more => 1 }); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
319 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
320 if (defined $body2) { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
321 $s->h2_body($body, { body_more => 1 }); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
322 $s->h2_body($body2); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
323 } else { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
324 $s->h2_body($body); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
325 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
326 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
327 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
328 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
329 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
330 my ($data) = grep { $_->{type} eq "DATA" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
331 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
332 return join("\n", map { "$_: " . $frame->{headers}->{$_}; } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
333 keys %{$frame->{headers}}) . "\n\n" . $data->{data}; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
334 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
335 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
336 sub http2_get_body_incomplete { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
337 my ($uri, $len, $body) = @_; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
338 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
339 my $s = Test::Nginx::HTTP2->new(); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
340 my $sid = $s->new_stream({ |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
341 headers => [ |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
342 { name => ':method', value => 'GET' }, |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
343 { name => ':scheme', value => 'http' }, |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
344 { name => ':path', value => $uri }, |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
345 { name => ':authority', value => 'localhost' }, |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
346 { name => 'content-length', value => $len }, |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
347 ], |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
348 body_more => 1 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
349 }); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
350 $s->h2_body($body, { body_more => 1 }); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
351 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
352 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
353 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
354 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
355 my ($data) = grep { $_->{type} eq "DATA" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
356 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
357 return join("\n", map { "$_: " . $frame->{headers}->{$_}; } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
358 keys %{$frame->{headers}}) . "\n\n" . $data->{data}; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
359 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
360 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
361 sub http2_get_body_incomplete_nolen { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
362 my ($uri, $len, $body) = @_; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
363 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
364 my $s = Test::Nginx::HTTP2->new(); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
365 my $sid = $s->new_stream({ path => $uri, body_more => 1 }); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
366 $s->h2_body($body, { body_more => 1 }); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
367 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
368 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
369 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
370 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
371 my ($data) = grep { $_->{type} eq "DATA" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
372 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
373 return join("\n", map { "$_: " . $frame->{headers}->{$_}; } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
374 keys %{$frame->{headers}}) . "\n\n" . $data->{data}; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
375 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
376 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
377 sub http2_get_body_custom { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
378 my ($uri, $len, $body, %extra) = @_; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
379 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
380 my $s = Test::Nginx::HTTP2->new(); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
381 my $sid = $s->new_stream({ |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
382 headers => [ |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
383 { name => ':method', value => 'GET' }, |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
384 { name => ':scheme', value => 'http' }, |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
385 { name => ':path', value => $uri }, |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
386 { name => ':authority', value => 'localhost' }, |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
387 { name => 'content-length', value => $len }, |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
388 ], |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
389 body_more => (defined $body ? 1 : undef) |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
390 }); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
391 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
392 if (defined $body) { |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
393 select undef, undef, undef, $extra{sleep} if $extra{sleep}; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
394 $s->h2_body($body, { body_more => 1 }); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
395 $s->h2_body('') unless $extra{more}; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
396 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
397 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
398 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
399 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
400 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
401 my ($data) = grep { $_->{type} eq "DATA" } @$frames; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
402 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
403 return join("\n", map { "$_: " . $frame->{headers}->{$_}; } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
404 keys %{$frame->{headers}}) . "\n\n" . $data->{data}; |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
405 } |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
406 |
fe6f22da53ec
Tests: tests for usage of discarded body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
407 ############################################################################### |