From 46d79be0ad3de48ef0a677537becb3508ccad31e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 28 Dec 2010 01:14:43 +0000 Subject: enable the keepalive_requests config option This will allow servers to limit the number of keepalive requests that can be made over a single connection to prevent denial-of-service and also to improve fairness in load-balancing. --- t/t0040-keepalive_requests-setting.sh | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 t/t0040-keepalive_requests-setting.sh (limited to 't') diff --git a/t/t0040-keepalive_requests-setting.sh b/t/t0040-keepalive_requests-setting.sh new file mode 100755 index 0000000..aee6cd3 --- /dev/null +++ b/t/t0040-keepalive_requests-setting.sh @@ -0,0 +1,51 @@ +#!/bin/sh +. ./test-lib.sh +t_plan 6 "keepalive_requests limit tests for $model" + +t_begin "setup and start" && { + rainbows_setup $model 50 666 + rtmpfiles curl_out curl_err + grep 'keepalive_timeout 666' $unicorn_config + ed -s $unicorn_config < true/ +w +EOF + grep nodelay $unicorn_config + rainbows -E none -D env.ru -c $unicorn_config + rainbows_wait_start +} + +t_begin "curl requests hit default keepalive_requests limit" && { + curl -sSfv http://$listen/[0-101] > $curl_out 2> $curl_err + test 1 -eq $(grep 'Connection: close' $curl_err |wc -l) + test 101 -eq $(grep 'Connection: keep-alive' $curl_err |wc -l) +} + +t_begin "reload with smaller keepalive_requests limit" && { + ed -s $unicorn_config < $curl_out 2> $curl_err + test 2 -eq $(grep 'Connection: close' $curl_err |wc -l) + test 11 -eq $(grep 'Connection: keep-alive' $curl_err |wc -l) +} + +t_begin "killing succeeds" && { + kill $rainbows_pid +} + +t_begin "check stderr" && { + check_stderr +} + +t_done -- cgit v1.2.3-24-ge0c7