diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-10-07 23:57:56 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-10-07 23:57:56 -0700 |
commit | be9e098dc8945e5abddc9a80fc38ce29fc813fc4 (patch) | |
tree | f3b5567efa6755783e02d3694ab554ed71c63c08 /t | |
parent | 9a439f77aada273a18fb473b84641e4611344ab5 (diff) | |
download | rainbows-be9e098dc8945e5abddc9a80fc38ce29fc813fc4.tar.gz |
Diffstat (limited to 't')
-rwxr-xr-x | t/t0000-basic.sh | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 03c0dfe..650e7de 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -3,9 +3,39 @@ eval $(unused_listen) pid=$(mktemp -t rainbows.$$.pid.XXXXXXXX) -TEST_RM_LIST="$TEST_RM_LIST $lock_path $pid" +tmp=$(mktemp -t rainbows.$$.err.XXXXXXXX) +ok=$(mktemp -t rainbows.$$.ok.XXXXXXXX) +fifo=$(mktemp -t rainbows.$$.fifo.XXXXXXXX) +TEST_RM_LIST="$TEST_RM_LIST $lock_path $pid $tmp $ok $fifo" -rainbows t0000.ru -l $listen --pid $pid & +rm -f $fifo +mkfifo $fifo + +rainbows -D t0000.ru -l $listen --pid $pid & wait_for_pid $pid + +echo "single request" curl -sSfv http://$listen/ + +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) + +# sed -ne 's/^/------/p' < $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 |