summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-27 12:52:15 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-27 13:17:42 -0800
commit5cbe276ef1e797aef77e7401593f4a7827c37fe3 (patch)
tree4d51d8fc8a2df2812dbb6c372b34e050e67b9589 /t
parent7d623489dd51667e0a2eec9d44aec57cb4c5ba44 (diff)
Some users never, ever accept uploads, so we should test
for it.
Diffstat (limited to 't')
-rwxr-xr-xt/t0107-rack-input-limit-zero.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/t/t0107-rack-input-limit-zero.sh b/t/t0107-rack-input-limit-zero.sh
new file mode 100755
index 0000000..eb947ba
--- /dev/null
+++ b/t/t0107-rack-input-limit-zero.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+. ./test-lib.sh
+req_curl_chunked_upload_err_check
+
+t_plan 6 "rack.input client_max_body_size zero"
+
+t_begin "setup and startup" && {
+        rtmpfiles curl_out curl_err cmbs_config
+        rainbows_setup $model
+        sed -e 's/client_max_body_size.*/client_max_body_size 0/' \
+          < $unicorn_config > $cmbs_config
+        rainbows -D sha1-random-size.ru -c $cmbs_config
+        rainbows_wait_start
+        empty_sha1=da39a3ee5e6b4b0d3255bfef95601890afd80709
+}
+
+t_begin "regular request" && {
+        curl -vsSf -H Expect: http://$listen/ > $curl_out 2> $curl_err
+        dbgcat curl_err
+        dbgcat curl_out
+        test x"$(cat $curl_out)" = x$empty_sha1
+}
+
+t_begin "chunked request" && {
+        curl -vsSf -T- < /dev/null -H Expect: \
+          http://$listen/ > $curl_out 2> $curl_err
+        dbgcat curl_err
+        dbgcat curl_out
+        test x"$(cat $curl_out)" = x$empty_sha1
+}
+
+t_begin "small input chunked" && {
+        rm -f $ok
+        echo | \
+          curl -vsSf -T- -H Expect: \
+          http://$listen/ > $curl_out 2> $curl_err || > $ok
+        dbgcat curl_err
+        dbgcat curl_out
+        fgrep 413 $curl_err
+        test -e $ok
+}
+
+t_begin "small input content-length" && {
+        rm -f $ok
+        echo > $tmp
+        curl -vsSf -T $tmp -H Expect: \
+          http://$listen/ > $curl_out 2> $curl_err || > $ok
+        fgrep 413 $curl_err
+        dbgcat curl_err
+        dbgcat curl_out
+        test -e $ok
+}
+
+t_begin "shutdown" && {
+        kill $rainbows_pid
+}
+
+t_done