9b681601feb772acb5c2842dd4a6c03ee929c922
[rainbows.git] / t / t0027-nil-copy_stream.sh
blob9b681601feb772acb5c2842dd4a6c03ee929c922
1 #!/bin/sh
2 . ./test-lib.sh
3 test -r random_blob || die "random_blob required, run with 'make $0'"
4 check_copy_stream
6 t_plan 7 "large file 'copy_stream nil' test for $model"
8 t_begin "setup and startup" && {
9 rtmpfiles curl_out
10 rainbows_setup $model
11 cat >> $unicorn_config <<EOF
12 Rainbows! do
13 copy_stream nil
14 end
15 EOF
16 rainbows -E none -D large-file-response.ru -c $unicorn_config
17 rainbows_wait_start
20 t_begin "read random blob sha1 and size" && {
21 random_blob_sha1=$(rsha1 < random_blob)
22 random_blob_size=$(wc -c < random_blob)
25 t_begin "send a series HTTP/1.1 requests sequentially" && {
26 for i in a b c
28 sha1=$( (curl -sSfv http://$listen/random_blob &&
29 echo ok >$ok) | rsha1)
30 test $sha1 = $random_blob_sha1
31 test xok = x$(cat $ok)
32 done
35 # this was a problem during development
36 t_begin "HTTP/1.0 test" && {
37 sha1=$( (curl -0 -sSfv http://$listen/random_blob &&
38 echo ok >$ok) | rsha1)
39 test $sha1 = $random_blob_sha1
40 test xok = x$(cat $ok)
43 t_begin "HTTP/0.9 test" && {
45 printf 'GET /random_blob\r\n'
46 rsha1 < $fifo > $tmp &
47 wait
48 echo ok > $ok
49 ) | socat - TCP:$listen > $fifo
50 test $(cat $tmp) = $random_blob_sha1
51 test xok = x$(cat $ok)
54 t_begin "shutdown server" && {
55 kill -QUIT $rainbows_pid
58 t_begin "check stderr" && check_stderr
60 t_done