From b5c1db0c2cd95bcfba1e67fa8a0a058f80025528 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 5 Nov 2009 01:39:16 -0800 Subject: tests: staggered trailer upload test This test lead to two separate bugfixes in Unicorn, one in the HttpParser and the other in TeeInput. Ironically, this test was spawned from what I initially thought was a bug in the EvCore module used by Rev and EventMachine, but there was no bug in EvCore... --- t/t0101-rack-input-trailer.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t0101-rack-input-trailer.sh b/t/t0101-rack-input-trailer.sh index 75528d6..bf3eb1d 100755 --- a/t/t0101-rack-input-trailer.sh +++ b/t/t0101-rack-input-trailer.sh @@ -2,7 +2,7 @@ . ./test-lib.sh test -r random_blob || die "random_blob required, run with 'make $0'" -t_plan 11 "input trailer test $model" +t_plan 13 "input trailer test $model" t_begin "setup and startup" && { rtmpfiles curl_out @@ -11,6 +11,27 @@ t_begin "setup and startup" && { rainbows_wait_start } +t_begin "staggered trailer upload" && { + zero_md5="1B2M2Y8AsgTpgAmY7PhCfg==" + ( + cat $fifo > $tmp & + printf 'PUT /s HTTP/1.1\r\n' + printf 'Host: example.com\r\n' + printf 'Transfer-Encoding: chunked\r\n' + printf 'Trailer: Content-MD5\r\n\r\n' + printf '0\r\nContent-MD5: ' + sleep 5 + printf '%s\r\n\r\n' $zero_md5 + wait + echo ok > $ok + ) | socat - TCP:$listen > $fifo + test xok = x"$(cat $ok)" +} + +t_begin "HTTP response is OK" && { + fgrep 'HTTP/1.1 200 OK' $tmp +} + t_begin "upload small blob" && { ( cat $fifo > $tmp & -- cgit v1.2.3-24-ge0c7