3 test -r random_blob || die
"random_blob required, run with 'make $0'"
7 t_info
"skipping $T since it can't load the sendfile gem, yet"
12 t_plan
10 "sendfile wrap body response for $model"
14 t_begin
"setup and startup" && {
15 rtmpfiles out err http_fifo sub_ok
17 echo 'require "sendfile"' >> $unicorn_config
18 echo 'def (::IO).copy_stream(*x); abort "NO"; end' >> $unicorn_config
20 # can't load Rack::Lint here since it clobbers body#to_path
22 rainbows
-E none
-D file-wrap-to_path.ru
-c $unicorn_config
26 t_begin
"read random blob sha1" && {
27 random_blob_sha1
=$
(rsha1
< random_blob
)
30 t_begin
"start FIFO reader" && {
34 t_begin
"single request matches" && {
35 sha1
=$
(curl
-sSfv 2> $err http
://$listen/random_blob | rsha1
)
37 test x
"$sha1" = x
"$random_blob_sha1"
40 t_begin
"body.close called" && {
42 grep CLOSING
$out || die
"body.close not logged"
45 t_begin
"start FIFO reader for abortive request" && {
49 t_begin
"send abortive request" && {
51 printf 'GET /random_blob\r\n'
52 dd bs
=4096 count
=1 < $http_fifo >/dev
/null
54 ) | socat
- TCP
:$listen > $http_fifo ||
:
55 test xok
= x$
(cat $ok)
58 t_begin
"body.close called for aborted request" && {
60 grep CLOSING
$out || die
"body.close not logged"
63 t_begin
"shutdown server" && {
64 kill -QUIT $rainbows_pid
67 t_begin
"check stderr" && check_stderr