3 test -r random_blob || die
"random_blob required, run with 'make $0'"
5 t_plan
10 "fast pipe response for $model"
7 t_begin
"setup and startup" && {
10 rainbows
-E none
-D fast-pipe-response.ru
-c $unicorn_config
14 t_begin
"read random blob sha1" && {
15 random_blob_sha1
=$
(rsha1
< random_blob
)
16 three_sha1
=$
(cat random_blob random_blob random_blob | rsha1
)
19 t_begin
"single request matches" && {
20 sha1
=$
(curl
-sSfv 2> $err http
://$listen/ | rsha1
)
22 test x
"$sha1" = x
"$random_blob_sha1"
25 t_begin
"Content-Length header preserved in response" && {
26 grep "^< Content-Length:" $err
29 t_begin
"send three keep-alive requests" && {
30 sha1
=$
(curl
-vsSf 2> $err \
31 http
://$listen/ http
://$listen/ http
://$listen/ | rsha1
)
33 test x
"$sha1" = x
"$three_sha1"
36 t_begin
"ensure responses were all keep-alive" && {
37 test 3 -eq $
(grep '< Connection: keep-alive' < $err |
wc -l)
40 t_begin
"HTTP/1.0 test" && {
41 sha1
=$
(curl
-0 -v 2> $err -sSf http
://$listen/ | rsha1
)
42 test $sha1 = $random_blob_sha1
43 grep '< Connection: close' < $err
46 t_begin
"HTTP/0.9 test" && {
49 rsha1
< $fifo > $tmp &
52 ) | socat
- TCP
:$listen > $fifo
53 test $
(cat $tmp) = $random_blob_sha1
54 test xok
= x$
(cat $ok)
57 t_begin
"shutdown server" && {
58 kill -QUIT $rainbows_pid
61 t_begin
"check stderr" && check_stderr