Mercurial > hg > nginx-tests
comparison h2.t @ 755:f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Made sure that gracefully shutting down with a stream waiting for a window
update, for remaining request body data frames, or that stuck on incomplete
HEADERS payload, doesn't lead to "open socket ... left in connection" alerts.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 28 Oct 2015 00:11:43 +0300 |
parents | 84a52b6d6343 |
children | bb4486e173ab |
comparison
equal
deleted
inserted
replaced
754:84a52b6d6343 | 755:f95aa716624e |
---|---|
32 | 32 |
33 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/) | 33 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/) |
34 ->has(qw/limit_conn rewrite realip shmem/) | 34 ->has(qw/limit_conn rewrite realip shmem/) |
35 ->has_daemon('openssl')->plan(233); | 35 ->has_daemon('openssl')->plan(233); |
36 | 36 |
37 # Some systems have a bug in not treating zero writev iovcnt as EINVAL | 37 # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL |
38 | 38 |
39 $t->todo_alerts() if $^O eq 'darwin'; | 39 $t->todo_alerts(); |
40 | 40 |
41 $t->write_file_expand('nginx.conf', <<'EOF'); | 41 $t->write_file_expand('nginx.conf', <<'EOF'); |
42 | 42 |
43 %%TEST_GLOBALS%% | 43 %%TEST_GLOBALS%% |
44 | 44 |
208 server { | 208 server { |
209 listen 127.0.0.1:8090 http2; | 209 listen 127.0.0.1:8090 http2; |
210 server_name localhost; | 210 server_name localhost; |
211 | 211 |
212 http2_idle_timeout 1s; | 212 http2_idle_timeout 1s; |
213 | |
214 location /proxy2/ { | |
215 add_header X-Body "$request_body"; | |
216 proxy_pass http://127.0.0.1:8081/; | |
217 } | |
213 } | 218 } |
214 } | 219 } |
215 | 220 |
216 EOF | 221 EOF |
217 | 222 |
2264 | 2269 |
2265 # GOAWAY - force closing a connection by server | 2270 # GOAWAY - force closing a connection by server |
2266 | 2271 |
2267 $sid = new_stream($sess, { path => 't1.html' }); | 2272 $sid = new_stream($sess, { path => 't1.html' }); |
2268 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]); | 2273 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]); |
2274 | |
2275 # graceful shutdown with stream waiting on HEADERS payload | |
2276 | |
2277 my $grace = new_session(8089); | |
2278 new_stream($grace, { split => [ 9 ], abort => 1 }); | |
2279 | |
2280 # graceful shutdown with stream waiting on WINDOW_UPDATE | |
2281 | |
2282 my $grace2 = new_session(8089); | |
2283 $sid = new_stream($grace2, { path => '/t1.html' }); | |
2284 h2_read($grace2, all => [{ sid => $sid, length => 2**16 - 1 }]); | |
2285 | |
2286 # graceful shutdown waiting on incomplete request body DATA frames | |
2287 | |
2288 my $grace3 = new_session(8090); | |
2289 $sid = new_stream($grace3, { path => '/proxy2/t2.html', body => 'TEST', | |
2290 body_split => [ 2 ], split => [ 67 ], abort => 1 }); | |
2269 | 2291 |
2270 $t->stop(); | 2292 $t->stop(); |
2271 | 2293 |
2272 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); | 2294 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); |
2273 | 2295 |