3 skip_models StreamResponseEpoll
5 t_plan
6 "pipelined sendfile response for $model"
7 t_begin
"setup and startup" && {
8 rtmpfiles err out dd_fifo
10 echo 'require "sendfile"' >> $unicorn_config
11 echo 'def (::IO).copy_stream(*x); abort "NO"; end' >> $unicorn_config
13 # can't load Rack::Lint here since it clobbers body#to_path
14 rainbows
-E none
-D large-file-response.ru
-c $unicorn_config
18 t_begin
"read random blob sha1" && {
19 random_blob_sha1
=$
(rsha1
< random_blob
)
26 expect = ENV["random_blob_sha1"]
27 kcar = Kcar::Response.new($stdin, {})
30 status, headers, body = kcar.rack
31 dig = Digest::SHA1.new
32 body.each { |buf| dig << buf ; nr += buf.size }
34 sha1 == expect or abort "mismatch: sha1=#{sha1} != expect=#{expect}"
37 $stdout.syswrite("ok\n")
40 t_begin
"staggered pipeline of 3 HTTP requests" && {
41 req
='GET /random_blob HTTP/1.1\r\nHost: example.com\r\n'
44 export random_blob_sha1
45 $RUBY -e "$script" < $fifo >> $ok &
46 printf "$req"'X-Req:0\r\n\r\n'
52 printf 'X-Req:1\r\n\r\n' >&6
56 printf 'X-Req:2\r\n' >&6
58 printf 'Connection: close\r\n\r' >&6
62 ) < $dd_fifo > $fifo &
65 ) | socat
- TCP
:$listen > $dd_fifo
66 test 2 -eq $
(grep '^ok$' $ok |count_lines
)
69 t_begin
"pipeline 3 HTTP requests" && {
71 req
='GET /random_blob HTTP/1.1\r\nHost: example.com\r\n'
72 req
="$req"'\r\n'"$req"'\r\n'"$req"
73 req
="$req"'Connection: close\r\n\r\n'
75 export random_blob_sha1
76 $RUBY -e "$script" < $fifo >> $ok &
80 ) | socat
- TCP
:$listen > $fifo
81 test 2 -eq $
(grep '^ok$' $ok |count_lines
)
84 t_begin
"shutdown server" && {
85 kill -QUIT $rainbows_pid
88 t_begin
"check stderr" && check_stderr