about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-08 23:24:19 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-08 23:24:19 -0700
commite65542f87b376b5e5b3d5f34fd43e9a8b2dfaff2 (patch)
tree258735433741b03b38876134ce3cbbf5152a4d6e /t
parent966dee27d01b68283e80ea544c93f9a659145302 (diff)
downloadrainbows-e65542f87b376b5e5b3d5f34fd43e9a8b2dfaff2.tar.gz
Revactor model uses a different process_client method
than our Thread* models.
Diffstat (limited to 't')
-rwxr-xr-xt/t3001-revactor-pipeline.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/t/t3001-revactor-pipeline.sh b/t/t3001-revactor-pipeline.sh
new file mode 100755
index 0000000..94f1eb3
--- /dev/null
+++ b/t/t3001-revactor-pipeline.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+. ./test-lib.sh
+require_revactor
+
+eval $(unused_listen)
+rtmpfiles unicorn_config curl_out curl_err pid fifo tmp ok
+
+rm -f $fifo
+mkfifo $fifo
+
+cat > $unicorn_config <<EOF
+listen "$listen"
+pid "$pid"
+Rainbows! do
+  use :Revactor
+end
+EOF
+
+rainbows -D t0000.ru -c $unicorn_config
+wait_for_pid $pid
+
+echo "two requests with keepalive"
+curl -sSfv http://$listen/a http://$listen/b > $tmp 2>&1
+grep 'Re-using existing connection' < $tmp
+
+echo "pipelining partial requests"
+req='GET / HTTP/1.1\r\nHost: foo\r\n'
+(
+        printf "$req"'\r\n'"$req"
+        cat $fifo > $tmp &
+        sleep 1
+        printf 'Connection: close\r\n\r\n'
+        echo ok > $ok
+) | socat - TCP:$listen > $fifo
+
+kill $(cat $pid)
+
+dbgcat tmp
+test 2 -eq $(grep '^HTTP/1.1' $tmp | wc -l)
+test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | wc -l)
+test 1 -eq $(grep '^Connection: keep-alive' $tmp | wc -l)
+test 1 -eq $(grep '^Connection: close' $tmp | wc -l)
+test x"$(cat $ok)" = xok