tests: replace several sed invocations with ed
[rainbows.git] / t / t0107-rack-input-limit-zero.sh
blob94aa2567ae044d960176231adcb56887349e211a
1 #!/bin/sh
2 . ./test-lib.sh
3 req_curl_chunked_upload_err_check
5 t_plan 6 "rack.input client_max_body_size zero"
7 t_begin "setup and startup" && {
8 rtmpfiles curl_out curl_err
9 rainbows_setup $model
10 ed -s $unicorn_config <<EOF
11 ,s/client_max_body_size.*/client_max_body_size 0/
13 EOF
14 rainbows -D sha1-random-size.ru -c $unicorn_config
15 rainbows_wait_start
16 empty_sha1=da39a3ee5e6b4b0d3255bfef95601890afd80709
19 t_begin "regular request" && {
20 curl -vsSf -H Expect: http://$listen/ > $curl_out 2> $curl_err
21 dbgcat curl_err
22 dbgcat curl_out
23 test x"$(cat $curl_out)" = x$empty_sha1
26 t_begin "chunked request" && {
27 curl -vsSf -T- < /dev/null -H Expect: \
28 http://$listen/ > $curl_out 2> $curl_err
29 dbgcat curl_err
30 dbgcat curl_out
31 test x"$(cat $curl_out)" = x$empty_sha1
34 t_begin "small input chunked" && {
35 rm -f $ok
36 echo | \
37 curl -vsSf -T- -H Expect: \
38 http://$listen/ > $curl_out 2> $curl_err || > $ok
39 dbgcat curl_err
40 dbgcat curl_out
41 fgrep 413 $curl_err
42 test -e $ok
45 t_begin "small input content-length" && {
46 rm -f $ok
47 echo > $tmp
48 curl -vsSf -T $tmp -H Expect: \
49 http://$listen/ > $curl_out 2> $curl_err || > $ok
50 fgrep 413 $curl_err
51 dbgcat curl_err
52 dbgcat curl_out
53 test -e $ok
56 t_begin "shutdown" && {
57 kill $rainbows_pid
60 t_done