diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-08-28 06:50:51 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-08-28 06:53:12 +0000 |
commit | 32d3b1f052810eb15362d001d1501be0e2da88d8 (patch) | |
tree | 3e36ef1c071eb736c431d0972a24024ba2347aa9 /t | |
parent | 108d6afd7ff390bb594c99ba23c91163fa98d8c0 (diff) | |
download | rainbows-32d3b1f052810eb15362d001d1501be0e2da88d8.tar.gz |
Although this behavior is mentioned on the documentation, this was broken under EventMachine, Rev*, and Revactor. Furthermore, we set the "Connection: close" header to allow the client to optimize is handling of non-keepalive connections.
Diffstat (limited to 't')
-rwxr-xr-x | t/t0017-keepalive-timeout-zero.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/t/t0017-keepalive-timeout-zero.sh b/t/t0017-keepalive-timeout-zero.sh new file mode 100755 index 0000000..4ba5dd0 --- /dev/null +++ b/t/t0017-keepalive-timeout-zero.sh @@ -0,0 +1,43 @@ +#!/bin/sh +. ./test-lib.sh +t_plan 6 "keepalive_timeout 0 tests for $model" + +t_begin "setup and start" && { + rainbows_setup $model 2 0 + grep 'keepalive_timeout 0' $unicorn_config + rainbows -D env.ru -c $unicorn_config + rainbows_wait_start +} + +t_begin 'check server responds with Connection: close' && { + curl -sSfi http://$listen/ | grep 'Connection: close' +} + +t_begin "send keepalive response that does not expect close" && { + req='GET / HTTP/1.1\r\nHost: example.com\r\n\r\n' + t0=$(date +%s) + ( + cat $fifo > $tmp & + printf "$req" + wait + date +%s > $ok + ) | socat - TCP:$listen > $fifo + now="$(cat $ok)" + elapsed=$(( $now - $t0 )) + t_info "elapsed=$elapsed (expecting <=3)" + test $elapsed -le 3 +} + +t_begin "'Connection: close' header set" && { + grep 'Connection: close' $tmp +} + +t_begin "killing succeeds" && { + kill $rainbows_pid +} + +t_begin "check stderr" && { + check_stderr +} + +t_done |