about summary refs log tree commit homepage
path: root/t/t0021-sendfile-wrap-to_path.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-07-27 07:01:32 +0000
committerEric Wong <normalperson@yhbt.net>2010-07-27 07:09:47 +0000
commite82fbfc8b67ac61d712dc9e764d8c7767ab2664b (patch)
treefa3ee44e6903f35a1ff77703c0beb7ea191d59e3 /t/t0021-sendfile-wrap-to_path.sh
parent71ecfee987f13ba447abe97cac14274f38ff70f4 (diff)
downloadrainbows-e82fbfc8b67ac61d712dc9e764d8c7767ab2664b.tar.gz
HTTP/1.1 and HTTP/1.0 code paths may vary significantly from the
(highly uncommon) HTTP/0.9 ones in our concurrency models,
so add extra tests for those.
Diffstat (limited to 't/t0021-sendfile-wrap-to_path.sh')
-rwxr-xr-xt/t0021-sendfile-wrap-to_path.sh47
1 files changed, 43 insertions, 4 deletions
diff --git a/t/t0021-sendfile-wrap-to_path.sh b/t/t0021-sendfile-wrap-to_path.sh
index 6baa890..7f3acaa 100755
--- a/t/t0021-sendfile-wrap-to_path.sh
+++ b/t/t0021-sendfile-wrap-to_path.sh
@@ -9,7 +9,7 @@ ruby) ;;
         ;;
 esac
 
-t_plan 10 "sendfile wrap body response for $model"
+t_plan 16 "sendfile wrap body response for $model"
 
 t_begin "setup and startup" && {
         rtmpfiles out err http_fifo sub_ok
@@ -42,11 +42,50 @@ t_begin "body.close called" && {
         grep CLOSING $out || die "body.close not logged"
 }
 
-t_begin "start FIFO reader for abortive request" && {
+t_begin "start FIFO reader for abortive HTTP/1.1 request" && {
         cat $fifo > $out &
 }
 
-t_begin "send abortive request" && {
+t_begin "send abortive HTTP/1.1 request" && {
+        rm -f $ok
+        (
+                printf 'GET /random_blob HTTP/1.1\r\nHost: example.com\r\n\r\n'
+                dd bs=4096 count=1 < $http_fifo >/dev/null
+                echo ok > $ok
+        ) | socat - TCP:$listen > $http_fifo || :
+        test xok = x$(cat $ok)
+}
+
+t_begin "body.close called for aborted HTTP/1.1 request" && {
+        wait # for cat $fifo
+        grep CLOSING $out || die "body.close not logged"
+}
+
+t_begin "start FIFO reader for abortive HTTP/1.0 request" && {
+        cat $fifo > $out &
+}
+
+t_begin "send abortive HTTP/1.0 request" && {
+        rm -f $ok
+        (
+                printf 'GET /random_blob HTTP/1.0\r\n\r\n'
+                dd bs=4096 count=1 < $http_fifo >/dev/null
+                echo ok > $ok
+        ) | socat - TCP:$listen > $http_fifo || :
+        test xok = x$(cat $ok)
+}
+
+t_begin "body.close called for aborted HTTP/1.0 request" && {
+        wait # for cat $fifo
+        grep CLOSING $out || die "body.close not logged"
+}
+
+t_begin "start FIFO reader for abortive HTTP/0.9 request" && {
+        cat $fifo > $out &
+}
+
+t_begin "send abortive HTTP/0.9 request" && {
+        rm -f $ok
         (
                 printf 'GET /random_blob\r\n'
                 dd bs=4096 count=1 < $http_fifo >/dev/null
@@ -55,7 +94,7 @@ t_begin "send abortive request" && {
         test xok = x$(cat $ok)
 }
 
-t_begin "body.close called for aborted request" && {
+t_begin "body.close called for aborted HTTP/0.9 request" && {
         wait # for cat $fifo
         grep CLOSING $out || die "body.close not logged"
 }