From cf122e941e10c2812b7ba5e75c053a28950ddcb6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 3 Jun 2010 15:23:01 -0700 Subject: add Rainbows::Sendfile middleware 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. --- t/t9001-sendfile-to-path.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 t/t9001-sendfile-to-path.sh (limited to 't/t9001-sendfile-to-path.sh') 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 -- cgit v1.2.3-24-ge0c7