about summary refs log tree commit homepage
path: root/t/t0024-pipelined-sendfile-response.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t0024-pipelined-sendfile-response.sh')
-rwxr-xr-xt/t0024-pipelined-sendfile-response.sh34
1 files changed, 32 insertions, 2 deletions
diff --git a/t/t0024-pipelined-sendfile-response.sh b/t/t0024-pipelined-sendfile-response.sh
index b0f5d56..9111ce9 100755
--- a/t/t0024-pipelined-sendfile-response.sh
+++ b/t/t0024-pipelined-sendfile-response.sh
@@ -1,10 +1,10 @@
 #!/bin/sh
 . ./test-lib.sh
 
-t_plan 5 "pipelined sendfile response for $model"
+t_plan 6 "pipelined sendfile response for $model"
 
 t_begin "setup and startup" && {
-        rtmpfiles err out
+        rtmpfiles err out dd_fifo
         rainbows_setup $model
         echo 'require "sendfile"' >> $unicorn_config
         echo 'def (::IO).copy_stream(*x); abort "NO"; end' >> $unicorn_config
@@ -36,7 +36,37 @@ end
 $stdout.syswrite("ok\n")
 '
 
+t_begin "staggered pipeline of 3 HTTP requests" && {
+        req='GET /random_blob HTTP/1.1\r\nHost: example.com\r\n'
+        rm -f $ok
+        (
+                export random_blob_sha1
+                $RUBY -e "$script" < $fifo >> $ok &
+                printf "$req"'X-Req:0\r\n\r\n'
+                exec 6>&1
+                (
+                        dd bs=16384 count=1
+                        printf "$req" >&6
+                        dd bs=16384 count=1
+                        printf 'X-Req:1\r\n\r\n' >&6
+                        dd bs=16384 count=1
+                        printf "$req" >&6
+                        dd bs=16384 count=1
+                        printf 'X-Req:2\r\n' >&6
+                        dd bs=16384 count=1
+                        printf 'Connection: close\r\n\r' >&6
+                        dd bs=16384 count=1
+                        printf '\n' >&6
+                        cat
+                ) < $dd_fifo > $fifo &
+                wait
+                echo ok >> $ok
+        ) | socat - TCP:$listen > $dd_fifo
+        test 2 -eq $(grep '^ok$' $ok |wc -l)
+}
+
 t_begin "pipeline 3 HTTP requests" && {
+        rm -f $ok
         req='GET /random_blob HTTP/1.1\r\nHost: example.com\r\n'
         req="$req"'\r\n'"$req"'\r\n'"$req"
         req="$req"'Connection: close\r\n\r\n'