summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-11 16:01:20 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-11 16:28:44 -0800
commit89f948aeaef34114ec61291ff8ffbebcf85a748e (patch)
tree6c0a8d3a7b7b6f9d33ee2f3498b3d55acfda1343 /t
parent0515dee246536cb3942f51f8d264737f106d3985 (diff)
We cannot trigger on_read events and invoke the HTTP parser and
modify @env while we're waiting for an application to run
async.callback.  We also need to clear (and *maybe* re-set)
@deferred if we're writing from async.callback
Diffstat (limited to 't')
-rw-r--r--t/t0402-async-keepalive.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/t/t0402-async-keepalive.sh b/t/t0402-async-keepalive.sh
index fdf4cbc..7b7b2e7 100644
--- a/t/t0402-async-keepalive.sh
+++ b/t/t0402-async-keepalive.sh
@@ -9,7 +9,7 @@ Coolio|NeverBlock|EventMachine) ;;
         ;;
 esac
 
-t_plan 11 "async_chunk_app test for test for $model"
+t_plan 12 "async_chunk_app test for test for $model"
 
 CONFIG_RU=async_chunk_app.ru
 
@@ -44,6 +44,26 @@ t_begin "async.callback supports pipelining" && {
         test 3 -eq "$(grep 'World ' $tmp | wc -l)"
 }
 
+t_begin "async.callback supports delayed pipelining" && {
+        rm -f $tmp
+        t0=$(date +%s)
+        (
+                cat $fifo > $tmp &
+                printf 'GET /0 HTTP/1.1\r\nHost: example.com\r\n\r\n'
+                sleep 1
+                printf 'GET /1 HTTP/1.1\r\nHost: example.com\r\n\r\n'
+                sleep 1
+                printf 'GET /2 HTTP/1.0\r\nHost: example.com\r\n\r\n'
+                wait
+        ) | socat - TCP:$listen > $fifo
+        t1=$(date +%s)
+        elapsed=$(( $t1 - $t0 ))
+        t_info "elapsed=$elapsed $model.$0 ($t_current)"
+        test 3 -eq "$(fgrep 'HTTP/1.1 200 OK' $tmp | wc -l)"
+        test 3 -eq "$(grep '^Hello ' $tmp | wc -l)"
+        test 3 -eq "$(grep 'World ' $tmp | wc -l)"
+}
+
 t_begin "async.callback supports pipelining with delay $DELAY" && {
         rm -f $tmp
         t0=$(date +%s)