doc: cleanup rdoc for Rainbows module
[rainbows.git] / t / t0104-rack-input-limit-tiny.sh
blob1104a97ab63ed326d87e20ad3b778ed3b4c74519
1 #!/bin/sh
2 . ./test-lib.sh
3 test -r random_blob || die "random_blob required, run with 'make $0'"
4 req_curl_chunked_upload_err_check
6 t_plan 18 "rack.input client_max_body_size tiny"
8 t_begin "setup and startup" && {
9 rtmpfiles curl_out curl_err
10 rainbows_setup $model
11 ed -s $unicorn_config <<EOF
12 ,s/client_max_body_size.*/client_max_body_size 256/
14 EOF
15 rainbows -D sha1-random-size.ru -c $unicorn_config
16 rainbows_wait_start
19 t_begin "stops a regular request" && {
20 rm -f $ok
21 dd if=/dev/zero bs=257 count=1 of=$tmp
22 curl -vsSf -T $tmp -H Expect: \
23 http://$listen/ > $curl_out 2> $curl_err || > $ok
24 dbgcat curl_err
25 dbgcat curl_out
26 grep 413 $curl_err
27 test -e $ok
30 t_begin "stops a large chunked request" && {
31 rm -f $ok
32 dd if=/dev/zero bs=257 count=1 | \
33 curl -vsSf -T- -H Expect: \
34 http://$listen/ > $curl_out 2> $curl_err || > $ok
35 dbgcat curl_err
36 dbgcat curl_out
37 grep 413 $curl_err
38 test -e $ok
41 t_begin "small size sha1 chunked ok" && {
42 blob_sha1=b376885ac8452b6cbf9ced81b1080bfd570d9b91
43 rm -f $ok
44 dd if=/dev/zero bs=256 count=1 | \
45 curl -vsSf -T- -H Expect: \
46 http://$listen/ > $curl_out 2> $curl_err
47 dbgcat curl_err
48 dbgcat curl_out
49 test "$(cat $curl_out)" = $blob_sha1
52 t_begin "small size sha1 content-length ok" && {
53 blob_sha1=b376885ac8452b6cbf9ced81b1080bfd570d9b91
54 rm -f $ok
55 dd if=/dev/zero bs=256 count=1 of=$tmp
56 curl -vsSf -T $tmp -H Expect: \
57 http://$listen/ > $curl_out 2> $curl_err
58 dbgcat curl_err
59 dbgcat curl_out
60 test "$(cat $curl_out)" = $blob_sha1
63 t_begin "stops a regular request (gets_read_mix)" && {
64 rm -f $ok
65 dd if=/dev/zero bs=257 count=1 of=$tmp
66 curl -vsSf -T $tmp -H Expect: \
67 http://$listen/gets_read_mix > $curl_out 2> $curl_err || > $ok
68 dbgcat curl_err
69 dbgcat curl_out
70 grep 413 $curl_err
71 test -e $ok
74 t_begin "stops a large chunked request (gets_read_mix)" && {
75 rm -f $ok
76 dd if=/dev/zero bs=257 count=1 | \
77 curl -vsSf -T- -H Expect: \
78 http://$listen/gets_read_mix > $curl_out 2> $curl_err || > $ok
79 dbgcat curl_err
80 dbgcat curl_out
81 grep 413 $curl_err
82 test -e $ok
85 t_begin "stops a large line-based chunked request (gets_read_mix)" && {
86 rm -f $ok
87 </dev/null awk 'BEGIN{for(i=22;--i>=0;) print "hello world"}' | \
88 curl -vsSf -T- -H Expect: \
89 http://$listen/gets_read_mix > $curl_out 2> $curl_err || > $ok
90 dbgcat curl_err
91 dbgcat curl_out
92 grep 413 $curl_err
93 test -e $ok
96 t_begin "OK with line-based chunked request (gets_read_mix)" && {
97 rm -f $ok
98 </dev/null awk 'BEGIN{for(i=21;--i>=0;) print "hello world"}' | \
99 curl -vsSf -T- -H Expect: \
100 http://$listen/gets_read_mix > $curl_out 2> $curl_err
101 dbgcat curl_err
102 dbgcat curl_out
103 test x"$(cat $curl_out)" = x23eab3cebcbe22a0456c8462e3d3bb01ae761702
106 t_begin "small size sha1 chunked ok (gets_read_mix)" && {
107 blob_sha1=b376885ac8452b6cbf9ced81b1080bfd570d9b91
108 rm -f $ok
109 dd if=/dev/zero bs=256 count=1 | \
110 curl -vsSf -T- -H Expect: \
111 http://$listen/gets_read_mix > $curl_out 2> $curl_err
112 dbgcat curl_err
113 dbgcat curl_out
114 test "$(cat $curl_out)" = $blob_sha1
117 t_begin "small size sha1 content-length ok (gets_read_mix)" && {
118 blob_sha1=b376885ac8452b6cbf9ced81b1080bfd570d9b91
119 rm -f $ok
120 dd if=/dev/zero bs=256 count=1 of=$tmp
121 curl -vsSf -T $tmp -H Expect: \
122 http://$listen/gets_read_mix > $curl_out 2> $curl_err
123 dbgcat curl_err
124 dbgcat curl_out
125 test "$(cat $curl_out)" = $blob_sha1
128 t_begin "stops a regular request (each)" && {
129 rm -f $ok
130 dd if=/dev/zero bs=257 count=1 of=$tmp
131 curl -vsSf -T $tmp -H Expect: \
132 http://$listen/each > $curl_out 2> $curl_err || > $ok
133 dbgcat curl_err
134 dbgcat curl_out
135 grep 413 $curl_err
136 test -e $ok
139 t_begin "stops a large chunked request (each)" && {
140 rm -f $ok
141 dd if=/dev/zero bs=257 count=1 | \
142 curl -vsSf -T- -H Expect: \
143 http://$listen/each > $curl_out 2> $curl_err || > $ok
144 dbgcat curl_err
145 dbgcat curl_out
146 grep 413 $curl_err
147 test -e $ok
150 t_begin "small size sha1 chunked ok (each)" && {
151 blob_sha1=b376885ac8452b6cbf9ced81b1080bfd570d9b91
152 rm -f $ok
153 dd if=/dev/zero bs=256 count=1 | \
154 curl -vsSf -T- -H Expect: \
155 http://$listen/each > $curl_out 2> $curl_err
156 dbgcat curl_err
157 dbgcat curl_out
158 test "$(cat $curl_out)" = $blob_sha1
161 t_begin "small size sha1 content-length ok (each)" && {
162 blob_sha1=b376885ac8452b6cbf9ced81b1080bfd570d9b91
163 rm -f $ok
164 dd if=/dev/zero bs=256 count=1 of=$tmp
165 curl -vsSf -T $tmp -H Expect: \
166 http://$listen/each > $curl_out 2> $curl_err
167 dbgcat curl_err
168 dbgcat curl_out
169 test "$(cat $curl_out)" = $blob_sha1
172 t_begin "stops a large line-based chunked request (each)" && {
173 rm -f $ok
174 </dev/null awk 'BEGIN{for(i=22;--i>=0;) print "hello world"}' | \
175 curl -vsSf -T- -H Expect: \
176 http://$listen/each > $curl_out 2> $curl_err || > $ok
177 dbgcat curl_err
178 dbgcat curl_out
179 grep 413 $curl_err
180 test -e $ok
183 t_begin "OK with line-based chunked request (each)" && {
184 rm -f $ok
185 </dev/null awk 'BEGIN{for(i=21;--i>=0;) print "hello world"}' | \
186 curl -vsSf -T- -H Expect: \
187 http://$listen/each > $curl_out 2> $curl_err
188 dbgcat curl_err
189 dbgcat curl_out
190 test x"$(cat $curl_out)" = x23eab3cebcbe22a0456c8462e3d3bb01ae761702
193 t_begin "shutdown" && {
194 kill $rainbows_pid
197 t_done