3 skip_models StreamResponseEpoll
4 test -r random_blob || die
"random_blob required, run with 'make $0'"
5 req_curl_chunked_upload_err_check
7 t_plan
18 "rack.input client_max_body_size tiny"
9 t_begin
"setup and startup" && {
10 rtmpfiles curl_out curl_err
12 ed
-s $unicorn_config <<EOF
13 ,s/client_max_body_size.*/client_max_body_size 256/
16 rainbows
-D sha1-random-size.ru
-c $unicorn_config
20 t_begin
"stops a regular request" && {
22 dd if=/dev
/zero bs
=257 count
=1 of
=$tmp
23 curl
-vsSf -T $tmp -H Expect
: \
24 http
://$listen/ > $curl_out 2> $curl_err ||
> $ok
31 t_begin
"stops a large chunked request" && {
33 dd if=/dev
/zero bs
=257 count
=1 | \
34 curl
-vsSf -T- -H Expect
: \
35 http
://$listen/ > $curl_out 2> $curl_err ||
> $ok
42 t_begin
"small size sha1 chunked ok" && {
43 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
45 dd if=/dev
/zero bs
=256 count
=1 | \
46 curl
-vsSf -T- -H Expect
: \
47 http
://$listen/ > $curl_out 2> $curl_err
50 test "$(cat $curl_out)" = $blob_sha1
53 t_begin
"small size sha1 content-length ok" && {
54 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
56 dd if=/dev
/zero bs
=256 count
=1 of
=$tmp
57 curl
-vsSf -T $tmp -H Expect
: \
58 http
://$listen/ > $curl_out 2> $curl_err
61 test "$(cat $curl_out)" = $blob_sha1
64 t_begin
"stops a regular request (gets_read_mix)" && {
66 dd if=/dev
/zero bs
=257 count
=1 of
=$tmp
67 curl
-vsSf -T $tmp -H Expect
: \
68 http
://$listen/gets_read_mix
> $curl_out 2> $curl_err ||
> $ok
75 t_begin
"stops a large chunked request (gets_read_mix)" && {
77 dd if=/dev
/zero bs
=257 count
=1 | \
78 curl
-vsSf -T- -H Expect
: \
79 http
://$listen/gets_read_mix
> $curl_out 2> $curl_err ||
> $ok
86 t_begin
"stops a large line-based chunked request (gets_read_mix)" && {
88 </dev
/null
awk 'BEGIN{for(i=22;--i>=0;) print "hello world"}' | \
89 curl
-vsSf -T- -H Expect
: \
90 http
://$listen/gets_read_mix
> $curl_out 2> $curl_err ||
> $ok
97 t_begin
"OK with line-based chunked request (gets_read_mix)" && {
99 </dev
/null
awk 'BEGIN{for(i=21;--i>=0;) print "hello world"}' | \
100 curl
-vsSf -T- -H Expect
: \
101 http
://$listen/gets_read_mix
> $curl_out 2> $curl_err
104 test x
"$(cat $curl_out)" = x23eab3cebcbe22a0456c8462e3d3bb01ae761702
107 t_begin
"small size sha1 chunked ok (gets_read_mix)" && {
108 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
110 dd if=/dev
/zero bs
=256 count
=1 | \
111 curl
-vsSf -T- -H Expect
: \
112 http
://$listen/gets_read_mix
> $curl_out 2> $curl_err
115 test "$(cat $curl_out)" = $blob_sha1
118 t_begin
"small size sha1 content-length ok (gets_read_mix)" && {
119 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
121 dd if=/dev
/zero bs
=256 count
=1 of
=$tmp
122 curl
-vsSf -T $tmp -H Expect
: \
123 http
://$listen/gets_read_mix
> $curl_out 2> $curl_err
126 test "$(cat $curl_out)" = $blob_sha1
129 t_begin
"stops a regular request (each)" && {
131 dd if=/dev
/zero bs
=257 count
=1 of
=$tmp
132 curl
-vsSf -T $tmp -H Expect
: \
133 http
://$listen/each
> $curl_out 2> $curl_err ||
> $ok
140 t_begin
"stops a large chunked request (each)" && {
142 dd if=/dev
/zero bs
=257 count
=1 | \
143 curl
-vsSf -T- -H Expect
: \
144 http
://$listen/each
> $curl_out 2> $curl_err ||
> $ok
151 t_begin
"small size sha1 chunked ok (each)" && {
152 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
154 dd if=/dev
/zero bs
=256 count
=1 | \
155 curl
-vsSf -T- -H Expect
: \
156 http
://$listen/each
> $curl_out 2> $curl_err
159 test "$(cat $curl_out)" = $blob_sha1
162 t_begin
"small size sha1 content-length ok (each)" && {
163 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
165 dd if=/dev
/zero bs
=256 count
=1 of
=$tmp
166 curl
-vsSf -T $tmp -H Expect
: \
167 http
://$listen/each
> $curl_out 2> $curl_err
170 test "$(cat $curl_out)" = $blob_sha1
173 t_begin
"stops a large line-based chunked request (each)" && {
175 </dev
/null
awk 'BEGIN{for(i=22;--i>=0;) print "hello world"}' | \
176 curl
-vsSf -T- -H Expect
: \
177 http
://$listen/each
> $curl_out 2> $curl_err ||
> $ok
184 t_begin
"OK with line-based chunked request (each)" && {
186 </dev
/null
awk 'BEGIN{for(i=21;--i>=0;) print "hello world"}' | \
187 curl
-vsSf -T- -H Expect
: \
188 http
://$listen/each
> $curl_out 2> $curl_err
191 test x
"$(cat $curl_out)" = x23eab3cebcbe22a0456c8462e3d3bb01ae761702
194 t_begin
"shutdown" && {