stream_response_epoll: our most "special" concurrency option yet
[rainbows.git] / t / t0031-close-pipe-response.sh
blob04ac12b6a763ab7be4b12e03d0b8071627cb04dc
1 #!/bin/sh
2 . ./test-lib.sh
3 skip_models StreamResponseEpoll
5 t_plan 16 "close pipe response for $model"
7 t_begin "setup and startup" && {
8 rtmpfiles err out http_fifo sub_ok
9 rainbows_setup $model
10 export fifo
11 rainbows -E none -D close-pipe-response.ru -c $unicorn_config
12 rainbows_wait_start
15 t_begin "read random blob sha1" && {
16 random_blob_sha1=$(rsha1 < random_blob)
19 t_begin "start FIFO reader" && {
20 cat $fifo > $out &
23 t_begin "single request matches" && {
24 sha1=$(curl -sSfv 2> $err http://$listen/ | rsha1)
25 test -n "$sha1"
26 test x"$sha1" = x"$random_blob_sha1"
29 t_begin "body.close called" && {
30 wait # for cat $fifo
31 grep CLOSING $out || die "body.close not logged"
34 t_begin "start FIFO reader for abortive HTTP/1.1 request" && {
35 cat $fifo > $out &
38 t_begin "send abortive HTTP/1.1 request" && {
39 rm -f $ok
41 printf 'GET /random_blob HTTP/1.1\r\nHost: example.com\r\n\r\n'
42 dd bs=4096 count=1 < $http_fifo >/dev/null
43 echo ok > $ok
44 ) | socat - TCP:$listen > $http_fifo || :
45 test xok = x$(cat $ok)
48 t_begin "body.close called for aborted HTTP/1.1 request" && {
49 wait # for cat $fifo
50 grep CLOSING $out || die "body.close not logged"
53 t_begin "start FIFO reader for abortive HTTP/1.0 request" && {
54 cat $fifo > $out &
57 t_begin "send abortive HTTP/1.0 request" && {
58 rm -f $ok
60 printf 'GET /random_blob HTTP/1.0\r\n\r\n'
61 dd bs=4096 count=1 < $http_fifo >/dev/null
62 echo ok > $ok
63 ) | socat - TCP:$listen > $http_fifo || :
64 test xok = x$(cat $ok)
67 t_begin "body.close called for aborted HTTP/1.0 request" && {
68 wait # for cat $fifo
69 grep CLOSING $out || die "body.close not logged"
72 t_begin "start FIFO reader for abortive HTTP/0.9 request" && {
73 cat $fifo > $out &
76 t_begin "send abortive HTTP/0.9 request" && {
77 rm -f $ok
79 printf 'GET /random_blob\r\n'
80 dd bs=4096 count=1 < $http_fifo >/dev/null
81 echo ok > $ok
82 ) | socat - TCP:$listen > $http_fifo || :
83 test xok = x$(cat $ok)
86 t_begin "body.close called for aborted HTTP/0.9 request" && {
87 wait # for cat $fifo
88 grep CLOSING $out || die "body.close not logged"
91 t_begin "shutdown server" && {
92 kill -QUIT $rainbows_pid
95 t_begin "check stderr" && check_stderr
97 t_done