rainbows 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +12 -6
- data/README +3 -2
- data/Rakefile +3 -3
- data/TODO +2 -9
- data/lib/rainbows.rb +1 -0
- data/lib/rainbows/app_pool.rb +10 -6
- data/lib/rainbows/base.rb +1 -1
- data/lib/rainbows/const.rb +1 -1
- data/lib/rainbows/ev_core.rb +88 -0
- data/lib/rainbows/event_machine.rb +218 -0
- data/lib/rainbows/http_server.rb +4 -1
- data/lib/rainbows/rev.rb +21 -89
- data/lib/rainbows/revactor.rb +4 -10
- data/local.mk.sample +13 -7
- data/rainbows.gemspec +17 -2
- data/t/.gitignore +1 -0
- data/t/GNUmakefile +63 -40
- data/t/README +6 -2
- data/t/async_sinatra.ru +13 -0
- data/t/bin/unused_listen +1 -1
- data/t/large-file-response.ru +1 -0
- data/t/my-tap-lib.sh +200 -0
- data/t/simple-http_Base.ru +3 -0
- data/t/simple-http_EventMachine.ru +9 -0
- data/t/simple-http_Rev.ru +9 -0
- data/t/simple-http_Revactor.ru +10 -0
- data/t/simple-http_ThreadPool.ru +10 -0
- data/t/simple-http_ThreadSpawn.ru +10 -0
- data/t/t0000-simple-http.sh +142 -0
- data/t/t0001-unix-http.sh +103 -0
- data/t/t0002-graceful.sh +32 -0
- data/t/t0002-parser-error.sh +31 -0
- data/t/t0003-reopen-logs.sh +97 -0
- data/t/t0005-large-file-response.sh +83 -0
- data/t/t0100-rack-input-hammer.sh +45 -0
- data/t/t0101-rack-input-trailer.sh +68 -0
- data/t/t0200-async-response.sh +66 -0
- data/t/t0201-async-response-no-autochunk.sh +3 -0
- data/t/t0300-async_sinatra.sh +65 -0
- data/t/t9000-rack-app-pool.sh +45 -33
- data/t/test-lib.sh +67 -56
- metadata +26 -56
- data/t/lib-async-response-no-autochunk.sh +0 -6
- data/t/lib-async-response.sh +0 -45
- data/t/lib-graceful.sh +0 -40
- data/t/lib-input-trailer.sh +0 -63
- data/t/lib-large-file-response.sh +0 -45
- data/t/lib-parser-error.sh +0 -29
- data/t/lib-rack-input-hammer.sh +0 -38
- data/t/lib-reopen-logs.sh +0 -60
- data/t/lib-simple-http.sh +0 -92
- data/t/t0000-basic.sh +0 -2
- data/t/t1000-thread-pool-basic.sh +0 -2
- data/t/t1002-thread-pool-graceful.sh +0 -2
- data/t/t1003-thread-pool-reopen-logs.sh +0 -2
- data/t/t1004-thread-pool-async-response.sh +0 -45
- data/t/t1005-thread-pool-large-file-response.sh +0 -45
- data/t/t1006-thread-pool-async-response-no-autochunk.sh +0 -6
- data/t/t1100-thread-pool-rack-input.sh +0 -2
- data/t/t1101-thread-pool-input-trailer.sh +0 -2
- data/t/t2000-thread-spawn-basic.sh +0 -2
- data/t/t2002-thread-spawn-graceful.sh +0 -2
- data/t/t2003-thread-spawn-reopen-logs.sh +0 -2
- data/t/t2004-thread-spawn-async-response.sh +0 -45
- data/t/t2005-thread-spawn-large-file-response.sh +0 -45
- data/t/t2006-thread-spawn-async-response-no-autochunk.sh +0 -6
- data/t/t2100-thread-spawn-rack-input.sh +0 -2
- data/t/t2101-thread-spawn-input-trailer.sh +0 -2
- data/t/t3000-revactor-basic.sh +0 -2
- data/t/t3002-revactor-graceful.sh +0 -2
- data/t/t3003-revactor-reopen-logs.sh +0 -2
- data/t/t3004-revactor-async-response.sh +0 -45
- data/t/t3005-revactor-large-file-response.sh +0 -2
- data/t/t3006-revactor-async-response-no-autochunk.sh +0 -6
- data/t/t3100-revactor-rack-input.sh +0 -2
- data/t/t3101-revactor-rack-input-trailer.sh +0 -2
- data/t/t4000-rev-basic.sh +0 -2
- data/t/t4002-rev-graceful.sh +0 -2
- data/t/t4003-rev-parser-error.sh +0 -2
- data/t/t4003-rev-reopen-logs.sh +0 -2
- data/t/t4004-rev-async-response.sh +0 -45
- data/t/t4005-rev-large-file-response.sh +0 -2
- data/t/t4006-rev-async-response-no-autochunk.sh +0 -6
- data/t/t4100-rev-rack-input.sh +0 -2
- data/t/t4101-rev-rack-input-trailer.sh +0 -2
    
        data/t/lib-input-trailer.sh
    DELETED
    
    | @@ -1,63 +0,0 @@ | |
| 1 | 
            -
            . ./test-lib.sh
         | 
| 2 | 
            -
            test -r random_blob || die "random_blob required, run with 'make $0'"
         | 
| 3 | 
            -
            echo "input trailer test model=$model"
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            eval $(unused_listen)
         | 
| 6 | 
            -
            rtmpfiles unicorn_config tmp r_err r_out pid fifo ok
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            cat > $unicorn_config <<EOF
         | 
| 9 | 
            -
            listen "$listen"
         | 
| 10 | 
            -
            pid "$pid"
         | 
| 11 | 
            -
            stderr_path "$r_err"
         | 
| 12 | 
            -
            stdout_path "$r_out"
         | 
| 13 | 
            -
            Rainbows! { use :$model }
         | 
| 14 | 
            -
            EOF
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            rainbows -D content-md5.ru -c $unicorn_config
         | 
| 17 | 
            -
            wait_for_pid $pid
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            echo "small blob"
         | 
| 20 | 
            -
            (
         | 
| 21 | 
            -
            	echo hello world | content-md5-put
         | 
| 22 | 
            -
            	cat $fifo > $tmp &
         | 
| 23 | 
            -
            	wait
         | 
| 24 | 
            -
            	echo ok > $ok
         | 
| 25 | 
            -
            ) | socat - TCP:$listen | utee $fifo
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            fgrep 'HTTP/1.1 200 OK' $tmp
         | 
| 28 | 
            -
            test xok = x"$(cat $ok)"
         | 
| 29 | 
            -
            check_stderr
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            echo "big blob"
         | 
| 32 | 
            -
            (
         | 
| 33 | 
            -
            	content-md5-put < random_blob
         | 
| 34 | 
            -
            	cat $fifo > $tmp &
         | 
| 35 | 
            -
            	wait
         | 
| 36 | 
            -
            	echo ok > $ok
         | 
| 37 | 
            -
            ) | socat - TCP:$listen | utee $fifo
         | 
| 38 | 
            -
             | 
| 39 | 
            -
            fgrep 'HTTP/1.1 200 OK' $tmp
         | 
| 40 | 
            -
            test xok = x"$(cat $ok)"
         | 
| 41 | 
            -
            check_stderr
         | 
| 42 | 
            -
             | 
| 43 | 
            -
            echo "staggered blob"
         | 
| 44 | 
            -
            (
         | 
| 45 | 
            -
            	(
         | 
| 46 | 
            -
            		dd bs=164 count=1 < random_blob
         | 
| 47 | 
            -
            		sleep 2
         | 
| 48 | 
            -
            		dd bs=4545 count=1 < random_blob
         | 
| 49 | 
            -
            		sleep 2
         | 
| 50 | 
            -
            		dd bs=1234 count=1 < random_blob
         | 
| 51 | 
            -
            		echo ok > $ok
         | 
| 52 | 
            -
            	) 2>/dev/null | content-md5-put
         | 
| 53 | 
            -
            	test xok = x"$(cat $ok)"
         | 
| 54 | 
            -
            	cat $fifo > $tmp &
         | 
| 55 | 
            -
            	wait
         | 
| 56 | 
            -
            	echo ok > $ok
         | 
| 57 | 
            -
            ) | socat - TCP:$listen | utee $fifo
         | 
| 58 | 
            -
             | 
| 59 | 
            -
            fgrep 'HTTP/1.1 200 OK' $tmp
         | 
| 60 | 
            -
            test xok = x"$(cat $ok)"
         | 
| 61 | 
            -
            check_stderr
         | 
| 62 | 
            -
             | 
| 63 | 
            -
            kill $(cat $pid)
         | 
| @@ -1,45 +0,0 @@ | |
| 1 | 
            -
            . ./test-lib.sh
         | 
| 2 | 
            -
            test -r random_blob || die "random_blob required, run with 'make $0'"
         | 
| 3 | 
            -
            if ! grep -v ^VmRSS: /proc/self/status >/dev/null 2>&1
         | 
| 4 | 
            -
            then
         | 
| 5 | 
            -
            	echo >&2 "skipping, can't read RSS from /proc/self/status"
         | 
| 6 | 
            -
            	exit 0
         | 
| 7 | 
            -
            fi
         | 
| 8 | 
            -
            echo "large file response slurp avoidance for model=$model"
         | 
| 9 | 
            -
            eval $(unused_listen)
         | 
| 10 | 
            -
            rtmpfiles unicorn_config tmp r_err r_out pid ok
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            cat > $unicorn_config <<EOF
         | 
| 13 | 
            -
            listen "$listen"
         | 
| 14 | 
            -
            stderr_path "$r_err"
         | 
| 15 | 
            -
            stdout_path "$r_out"
         | 
| 16 | 
            -
            pid "$pid"
         | 
| 17 | 
            -
            Rainbows! { use :$model }
         | 
| 18 | 
            -
            EOF
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            # can't load Rack::Lint here since it'll cause Rev to slurp
         | 
| 21 | 
            -
            rainbows -E none -D large-file-response.ru -c $unicorn_config
         | 
| 22 | 
            -
            wait_for_pid $pid
         | 
| 23 | 
            -
             | 
| 24 | 
            -
            random_blob_size=$(wc -c < random_blob)
         | 
| 25 | 
            -
            curl -v http://$listen/rss
         | 
| 26 | 
            -
            dbgcat r_err
         | 
| 27 | 
            -
            rss_before=$(curl -sSfv http://$listen/rss)
         | 
| 28 | 
            -
            echo "rss_before=$rss_before"
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            for i in a b c
         | 
| 31 | 
            -
            do
         | 
| 32 | 
            -
            	size=$( (curl -sSfv http://$listen/random_blob && echo ok > $ok) | wc -c)
         | 
| 33 | 
            -
            	test $size -eq $random_blob_size
         | 
| 34 | 
            -
            	test xok = x$(cat $ok)
         | 
| 35 | 
            -
            done
         | 
| 36 | 
            -
             | 
| 37 | 
            -
            dbgcat r_err
         | 
| 38 | 
            -
            curl -v http://$listen/rss
         | 
| 39 | 
            -
            rss_after=$(curl -sSfv http://$listen/rss)
         | 
| 40 | 
            -
            echo "rss_after=$rss_after"
         | 
| 41 | 
            -
            diff=$(( $rss_after - $rss_before ))
         | 
| 42 | 
            -
            echo "test diff=$diff < orig=$random_blob_size"
         | 
| 43 | 
            -
            kill -QUIT $(cat $pid)
         | 
| 44 | 
            -
            test $diff -le $random_blob_size
         | 
| 45 | 
            -
            dbgcat r_err
         | 
    
        data/t/lib-parser-error.sh
    DELETED
    
    | @@ -1,29 +0,0 @@ | |
| 1 | 
            -
            . ./test-lib.sh
         | 
| 2 | 
            -
            echo "parser error test for model=$model"
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            eval $(unused_listen)
         | 
| 5 | 
            -
            rtmpfiles unicorn_config pid r_err r_out tmp fifo ok
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            cat > $unicorn_config <<EOF
         | 
| 8 | 
            -
            listen "$listen"
         | 
| 9 | 
            -
            pid "$pid"
         | 
| 10 | 
            -
            stderr_path "$r_err"
         | 
| 11 | 
            -
            stdout_path "$r_out"
         | 
| 12 | 
            -
            Rainbows! { use :$model }
         | 
| 13 | 
            -
            EOF
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            rainbows -D env.ru -c $unicorn_config
         | 
| 16 | 
            -
            wait_for_pid $pid
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            (
         | 
| 19 | 
            -
            	printf 'GET / HTTP/1/1\r\nHost: example.com\r\n\r\n'
         | 
| 20 | 
            -
            	cat $fifo > $tmp &
         | 
| 21 | 
            -
            	wait
         | 
| 22 | 
            -
            	echo ok > $ok
         | 
| 23 | 
            -
            ) | socat - TCP:$listen > $fifo
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            kill $(cat $pid)
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            dbgcat tmp
         | 
| 28 | 
            -
            grep -F 'HTTP/1.1 400 Bad Request' $tmp
         | 
| 29 | 
            -
            check_stderr
         | 
    
        data/t/lib-rack-input-hammer.sh
    DELETED
    
    | @@ -1,38 +0,0 @@ | |
| 1 | 
            -
            nr_client=${nr_client-4}
         | 
| 2 | 
            -
            . ./test-lib.sh
         | 
| 3 | 
            -
            test -r random_blob || die "random_blob required, run with 'make $0'"
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            eval $(unused_listen)
         | 
| 6 | 
            -
            rtmpfiles unicorn_config curl_out curl_err r_err r_out pid
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            cat > $unicorn_config <<EOF
         | 
| 9 | 
            -
            listen "$listen"
         | 
| 10 | 
            -
            pid "$pid"
         | 
| 11 | 
            -
            stderr_path "$r_err"
         | 
| 12 | 
            -
            stdout_path "$r_out"
         | 
| 13 | 
            -
            Rainbows! do
         | 
| 14 | 
            -
              use :$model
         | 
| 15 | 
            -
            end
         | 
| 16 | 
            -
            EOF
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            rainbows -D sha1.ru -c $unicorn_config
         | 
| 19 | 
            -
            wait_for_pid $pid
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            start=$(date +%s)
         | 
| 22 | 
            -
            for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
         | 
| 23 | 
            -
            do
         | 
| 24 | 
            -
            	(
         | 
| 25 | 
            -
            		curl -sSf -T- http://$listen/$i \
         | 
| 26 | 
            -
            		  < random_blob >> $curl_out 2>> $curl_err
         | 
| 27 | 
            -
            	) &
         | 
| 28 | 
            -
            done
         | 
| 29 | 
            -
            wait
         | 
| 30 | 
            -
            echo elapsed=$(( $(date +%s) - $start ))
         | 
| 31 | 
            -
             | 
| 32 | 
            -
            kill $(cat $pid)
         | 
| 33 | 
            -
            test $nr_client -eq $(wc -l < $curl_out)
         | 
| 34 | 
            -
            test 1 -eq $(sort < $curl_out | uniq | wc -l)
         | 
| 35 | 
            -
            blob_sha1=$( expr "$(sha1sum < random_blob)" : '\([a-f0-9]\+\)')
         | 
| 36 | 
            -
            echo blob_sha1=$blob_sha1
         | 
| 37 | 
            -
            test x"$blob_sha1" = x"$(sort < $curl_out | uniq)"
         | 
| 38 | 
            -
            check_stderr
         | 
    
        data/t/lib-reopen-logs.sh
    DELETED
    
    | @@ -1,60 +0,0 @@ | |
| 1 | 
            -
            #!/bin/sh
         | 
| 2 | 
            -
            # don't set nr_client for Rev, only _one_ app running at once :x
         | 
| 3 | 
            -
            nr_client=${nr_client-2}
         | 
| 4 | 
            -
            . ./test-lib.sh
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            eval $(unused_listen)
         | 
| 7 | 
            -
            rtmpfiles unicorn_config curl_out curl_err pid r_err r_out r_rot
         | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
            cat > $unicorn_config <<EOF
         | 
| 11 | 
            -
            listen "$listen"
         | 
| 12 | 
            -
            pid "$pid"
         | 
| 13 | 
            -
            stderr_path "$r_err"
         | 
| 14 | 
            -
            stdout_path "$r_out"
         | 
| 15 | 
            -
            Rainbows! { use :$model }
         | 
| 16 | 
            -
            EOF
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            rainbows -D sleep.ru -c $unicorn_config
         | 
| 19 | 
            -
            wait_for_pid $pid
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            start=$(date +%s)
         | 
| 22 | 
            -
            for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
         | 
| 23 | 
            -
            do
         | 
| 24 | 
            -
            	( curl -sSf http://$listen/2 >> $curl_out 2>> $curl_err ) &
         | 
| 25 | 
            -
            done
         | 
| 26 | 
            -
            check_stderr
         | 
| 27 | 
            -
             | 
| 28 | 
            -
            rm -f $r_rot
         | 
| 29 | 
            -
            mv $r_err $r_rot
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            kill -USR1 $(cat $pid)
         | 
| 32 | 
            -
            wait_for_pid $r_err
         | 
| 33 | 
            -
             | 
| 34 | 
            -
            dbgcat r_rot
         | 
| 35 | 
            -
            dbgcat r_err
         | 
| 36 | 
            -
             | 
| 37 | 
            -
            wait
         | 
| 38 | 
            -
            echo elapsed=$(( $(date +%s) - $start ))
         | 
| 39 | 
            -
            test ! -s $curl_err
         | 
| 40 | 
            -
            test x"$(wc -l < $curl_out)" = x$nr_client
         | 
| 41 | 
            -
            nr=$(sort < $curl_out | uniq | wc -l)
         | 
| 42 | 
            -
             | 
| 43 | 
            -
            test "$nr" -eq 1
         | 
| 44 | 
            -
            test x$(sort < $curl_out | uniq) = xHello
         | 
| 45 | 
            -
            check_stderr
         | 
| 46 | 
            -
            check_stderr $r_rot
         | 
| 47 | 
            -
             | 
| 48 | 
            -
            before_rot=$(wc -c < $r_rot)
         | 
| 49 | 
            -
            before_err=$(wc -c < $r_err)
         | 
| 50 | 
            -
            curl -sSfv http://$listen/
         | 
| 51 | 
            -
            after_rot=$(wc -c < $r_rot)
         | 
| 52 | 
            -
            after_err=$(wc -c < $r_err)
         | 
| 53 | 
            -
             | 
| 54 | 
            -
            test $after_rot -eq $before_rot && echo "before_rot -eq after_rot"
         | 
| 55 | 
            -
            test $after_err -gt $before_err && echo "before_err -gt after_err"
         | 
| 56 | 
            -
             | 
| 57 | 
            -
            kill $(cat $pid)
         | 
| 58 | 
            -
            dbgcat r_err
         | 
| 59 | 
            -
            check_stderr
         | 
| 60 | 
            -
            check_stderr $r_rot
         | 
    
        data/t/lib-simple-http.sh
    DELETED
    
    | @@ -1,92 +0,0 @@ | |
| 1 | 
            -
            #!/bin/sh
         | 
| 2 | 
            -
            . ./test-lib.sh
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            echo "simple HTTP connection keepalive/pipelining tests for $model"
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            tbase=$(expr "$T" : '^\(t....\)-').ru
         | 
| 7 | 
            -
            test -f "$tbase" || die "$tbase missing for $T"
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            eval $(unused_listen)
         | 
| 10 | 
            -
            rtmpfiles unicorn_config pid r_err r_out tmp fifo ok
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            cat > $unicorn_config <<EOF
         | 
| 13 | 
            -
            listen "$listen"
         | 
| 14 | 
            -
            pid "$pid"
         | 
| 15 | 
            -
            stderr_path "$r_err"
         | 
| 16 | 
            -
            stdout_path "$r_out"
         | 
| 17 | 
            -
            EOF
         | 
| 18 | 
            -
            if test x$model != xany
         | 
| 19 | 
            -
            then
         | 
| 20 | 
            -
            	echo "Rainbows! { use :$model }" >> $unicorn_config
         | 
| 21 | 
            -
            fi
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            rainbows -D $tbase -c $unicorn_config
         | 
| 24 | 
            -
            wait_for_pid $pid
         | 
| 25 | 
            -
             | 
| 26 | 
            -
            echo "single request"
         | 
| 27 | 
            -
            curl -sSfv http://$listen/
         | 
| 28 | 
            -
            dbgcat r_err
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            echo "two requests with keepalive"
         | 
| 31 | 
            -
            curl -sSfv http://$listen/a http://$listen/b > $tmp 2>&1
         | 
| 32 | 
            -
            dbgcat r_err
         | 
| 33 | 
            -
            dbgcat tmp
         | 
| 34 | 
            -
            grep 'Re-using existing connection' < $tmp
         | 
| 35 | 
            -
             | 
| 36 | 
            -
            echo "pipelining partial requests"
         | 
| 37 | 
            -
            req='GET / HTTP/1.1\r\nHost: example.com\r\n'
         | 
| 38 | 
            -
            (
         | 
| 39 | 
            -
            	printf "$req"'\r\n'"$req"
         | 
| 40 | 
            -
            	cat $fifo > $tmp &
         | 
| 41 | 
            -
            	sleep 1
         | 
| 42 | 
            -
            	printf 'Connection: close\r\n\r\n'
         | 
| 43 | 
            -
            	wait
         | 
| 44 | 
            -
            	echo ok > $ok
         | 
| 45 | 
            -
            ) | socat - TCP:$listen > $fifo
         | 
| 46 | 
            -
             | 
| 47 | 
            -
            dbgcat tmp
         | 
| 48 | 
            -
             | 
| 49 | 
            -
            test 2 -eq $(grep '^HTTP/1.1' $tmp | wc -l)
         | 
| 50 | 
            -
            test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | wc -l)
         | 
| 51 | 
            -
            test 1 -eq $(grep '^Connection: keep-alive' $tmp | wc -l)
         | 
| 52 | 
            -
            test 1 -eq $(grep '^Connection: close' $tmp | wc -l)
         | 
| 53 | 
            -
            test x"$(cat $ok)" = xok
         | 
| 54 | 
            -
            check_stderr
         | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
            echo "burst pipelining"
         | 
| 58 | 
            -
            req='GET / HTTP/1.1\r\nHost: example.com\r\n'
         | 
| 59 | 
            -
            (
         | 
| 60 | 
            -
            	printf "$req"'\r\n'"$req"'Connection: close\r\n\r\n'
         | 
| 61 | 
            -
            	cat $fifo > $tmp &
         | 
| 62 | 
            -
            	wait
         | 
| 63 | 
            -
            	echo ok > $ok
         | 
| 64 | 
            -
            ) | socat - TCP:$listen > $fifo
         | 
| 65 | 
            -
             | 
| 66 | 
            -
            dbgcat tmp
         | 
| 67 | 
            -
            dbgcat r_err
         | 
| 68 | 
            -
             | 
| 69 | 
            -
            test 2 -eq $(grep '^HTTP/1.1' $tmp | wc -l)
         | 
| 70 | 
            -
            test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | wc -l)
         | 
| 71 | 
            -
            test 1 -eq $(grep '^Connection: keep-alive' $tmp | wc -l)
         | 
| 72 | 
            -
            test 1 -eq $(grep '^Connection: close' $tmp | wc -l)
         | 
| 73 | 
            -
            test x"$(cat $ok)" = xok
         | 
| 74 | 
            -
             | 
| 75 | 
            -
            check_stderr
         | 
| 76 | 
            -
             | 
| 77 | 
            -
            echo "HTTP/0.9 request should not return headers"
         | 
| 78 | 
            -
            (
         | 
| 79 | 
            -
            	printf 'GET /\r\n\r\n'
         | 
| 80 | 
            -
            	cat $fifo > $tmp &
         | 
| 81 | 
            -
            	wait
         | 
| 82 | 
            -
            	echo ok > $ok
         | 
| 83 | 
            -
            ) | socat - TCP:$listen > $fifo
         | 
| 84 | 
            -
             | 
| 85 | 
            -
            dbgcat tmp
         | 
| 86 | 
            -
            dbgcat r_err
         | 
| 87 | 
            -
            echo "env.inspect should've put everything on one line"
         | 
| 88 | 
            -
            test 1 -eq $(wc -l < $tmp)
         | 
| 89 | 
            -
            ! grep ^Connection: $tmp
         | 
| 90 | 
            -
            ! grep ^HTTP/ $tmp
         | 
| 91 | 
            -
             | 
| 92 | 
            -
            kill $(cat $pid)
         | 
    
        data/t/t0000-basic.sh
    DELETED
    
    
| @@ -1,45 +0,0 @@ | |
| 1 | 
            -
            CONFIG_RU=${CONFIG_RU-'async-response.ru'}
         | 
| 2 | 
            -
            . ./test-lib.sh
         | 
| 3 | 
            -
            echo "async response for model=$model"
         | 
| 4 | 
            -
            eval $(unused_listen)
         | 
| 5 | 
            -
            rtmpfiles unicorn_config a b c r_err r_out pid curl_err
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            cat > $unicorn_config <<EOF
         | 
| 8 | 
            -
            listen "$listen"
         | 
| 9 | 
            -
            stderr_path "$r_err"
         | 
| 10 | 
            -
            stdout_path "$r_out"
         | 
| 11 | 
            -
            pid "$pid"
         | 
| 12 | 
            -
            Rainbows! { use :$model }
         | 
| 13 | 
            -
            EOF
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            # can't load Rack::Lint here since it'll cause Rev to slurp
         | 
| 16 | 
            -
            rainbows -E none -D $CONFIG_RU -c $unicorn_config
         | 
| 17 | 
            -
            wait_for_pid $pid
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            t0=$(date +%s)
         | 
| 20 | 
            -
            ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $a) &
         | 
| 21 | 
            -
            ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $b) &
         | 
| 22 | 
            -
            ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $c) &
         | 
| 23 | 
            -
            wait
         | 
| 24 | 
            -
            t1=$(date +%s)
         | 
| 25 | 
            -
             | 
| 26 | 
            -
            rainbows_pid=$(cat $pid)
         | 
| 27 | 
            -
            kill -QUIT $rainbows_pid
         | 
| 28 | 
            -
            elapsed=$(( $t1 - $t0 ))
         | 
| 29 | 
            -
            echo "elapsed=$elapsed < 30"
         | 
| 30 | 
            -
            test $elapsed -lt 30
         | 
| 31 | 
            -
             | 
| 32 | 
            -
            dbgcat a
         | 
| 33 | 
            -
            dbgcat b
         | 
| 34 | 
            -
            dbgcat c
         | 
| 35 | 
            -
            dbgcat r_err
         | 
| 36 | 
            -
            dbgcat curl_err
         | 
| 37 | 
            -
            test ! -s $curl_err
         | 
| 38 | 
            -
            check_stderr
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            while kill -0 $rainbows_pid >/dev/null 2>&1
         | 
| 41 | 
            -
            do
         | 
| 42 | 
            -
            	sleep 1
         | 
| 43 | 
            -
            done
         | 
| 44 | 
            -
             | 
| 45 | 
            -
            dbgcat r_err
         | 
| @@ -1,45 +0,0 @@ | |
| 1 | 
            -
            . ./test-lib.sh
         | 
| 2 | 
            -
            test -r random_blob || die "random_blob required, run with 'make $0'"
         | 
| 3 | 
            -
            if ! grep -v ^VmRSS: /proc/self/status >/dev/null 2>&1
         | 
| 4 | 
            -
            then
         | 
| 5 | 
            -
            	echo >&2 "skipping, can't read RSS from /proc/self/status"
         | 
| 6 | 
            -
            	exit 0
         | 
| 7 | 
            -
            fi
         | 
| 8 | 
            -
            echo "large file response slurp avoidance for model=$model"
         | 
| 9 | 
            -
            eval $(unused_listen)
         | 
| 10 | 
            -
            rtmpfiles unicorn_config tmp r_err r_out pid ok
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            cat > $unicorn_config <<EOF
         | 
| 13 | 
            -
            listen "$listen"
         | 
| 14 | 
            -
            stderr_path "$r_err"
         | 
| 15 | 
            -
            stdout_path "$r_out"
         | 
| 16 | 
            -
            pid "$pid"
         | 
| 17 | 
            -
            Rainbows! { use :$model }
         | 
| 18 | 
            -
            EOF
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            # can't load Rack::Lint here since it'll cause Rev to slurp
         | 
| 21 | 
            -
            rainbows -E none -D large-file-response.ru -c $unicorn_config
         | 
| 22 | 
            -
            wait_for_pid $pid
         | 
| 23 | 
            -
             | 
| 24 | 
            -
            random_blob_size=$(wc -c < random_blob)
         | 
| 25 | 
            -
            curl -v http://$listen/rss
         | 
| 26 | 
            -
            dbgcat r_err
         | 
| 27 | 
            -
            rss_before=$(curl -sSfv http://$listen/rss)
         | 
| 28 | 
            -
            echo "rss_before=$rss_before"
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            for i in a b c
         | 
| 31 | 
            -
            do
         | 
| 32 | 
            -
            	size=$( (curl -sSfv http://$listen/random_blob && echo ok > $ok) | wc -c)
         | 
| 33 | 
            -
            	test $size -eq $random_blob_size
         | 
| 34 | 
            -
            	test xok = x$(cat $ok)
         | 
| 35 | 
            -
            done
         | 
| 36 | 
            -
             | 
| 37 | 
            -
            dbgcat r_err
         | 
| 38 | 
            -
            curl -v http://$listen/rss
         | 
| 39 | 
            -
            rss_after=$(curl -sSfv http://$listen/rss)
         | 
| 40 | 
            -
            echo "rss_after=$rss_after"
         | 
| 41 | 
            -
            diff=$(( $rss_after - $rss_before ))
         | 
| 42 | 
            -
            echo "test diff=$diff < orig=$random_blob_size"
         | 
| 43 | 
            -
            kill -QUIT $(cat $pid)
         | 
| 44 | 
            -
            test $diff -le $random_blob_size
         | 
| 45 | 
            -
            dbgcat r_err
         |