about summary refs log tree commit homepage
path: root/t/t9001-sendfile-to-path.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-03 15:23:01 -0700
committerEric Wong <normalperson@yhbt.net>2010-06-03 15:26:01 -0700
commitcf122e941e10c2812b7ba5e75c053a28950ddcb6 (patch)
treef0c2ba767c7e7af0384a6c4ff470f4fc4903bad5 /t/t9001-sendfile-to-path.sh
parent5a0a190253434d3eef5332d979d56f3e16e876bd (diff)
downloadrainbows-cf122e941e10c2812b7ba5e75c053a28950ddcb6.tar.gz
This lets most concurrency models understand and process
X-Sendfile efficiently with IO.copy_stream under Ruby 1.9.
EventMachine can take advantage of this middleware under
both Ruby 1.8 and Ruby 1.9.
Diffstat (limited to 't/t9001-sendfile-to-path.sh')
-rwxr-xr-xt/t9001-sendfile-to-path.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/t/t9001-sendfile-to-path.sh b/t/t9001-sendfile-to-path.sh
new file mode 100755
index 0000000..aa75f22
--- /dev/null
+++ b/t/t9001-sendfile-to-path.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+. ./test-lib.sh
+
+t_plan 7 "Sendfile middleware test for $model"
+
+t_begin "configure and start" && {
+        rtmpfiles curl_out curl_err
+        rainbows_setup
+
+        # do not allow default middleware to be loaded since it may
+        # kill body#to_path
+        rainbows -E none -D t9001.ru -c $unicorn_config
+        rainbows_wait_start
+}
+
+t_begin "hit with curl" && {
+        curl -sSfv http://$listen/ > $curl_out 2> $curl_err
+}
+
+t_begin "kill server" && {
+        kill $rainbows_pid
+}
+
+t_begin "file matches source" && {
+        cmp $curl_out random_blob
+}
+
+t_begin "no errors in Rainbows! stderr" && {
+        check_stderr
+}
+
+t_begin "X-Sendfile does not show up in headers" && {
+        dbgcat curl_err
+        if grep -i x-sendfile $curl_err
+        then
+                die "X-Sendfile did show up!"
+        fi
+}
+
+t_begin "Content-Length is set correctly in headers" && {
+        expect=$(wc -c < random_blob)
+        grep "^< Content-Length: $expect" $curl_err
+}
+
+t_done