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
11 ed
-s $unicorn_config <<EOF
12 ,s/client_max_body_size.*/client_max_body_size 256/
15 rainbows
-D sha1-random-size.ru
-c $unicorn_config
19 t_begin
"stops a regular request" && {
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
30 t_begin
"stops a large chunked request" && {
32 dd if=/dev
/zero bs
=257 count
=1 | \
33 curl
-vsSf -T- -H Expect
: \
34 http
://$listen/ > $curl_out 2> $curl_err ||
> $ok
41 t_begin
"small size sha1 chunked ok" && {
42 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
44 dd if=/dev
/zero bs
=256 count
=1 | \
45 curl
-vsSf -T- -H Expect
: \
46 http
://$listen/ > $curl_out 2> $curl_err
49 test "$(cat $curl_out)" = $blob_sha1
52 t_begin
"small size sha1 content-length ok" && {
53 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
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
60 test "$(cat $curl_out)" = $blob_sha1
63 t_begin
"stops a regular request (gets_read_mix)" && {
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
74 t_begin
"stops a large chunked request (gets_read_mix)" && {
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
85 t_begin
"stops a large line-based chunked request (gets_read_mix)" && {
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
96 t_begin
"OK with line-based chunked request (gets_read_mix)" && {
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
103 test x
"$(cat $curl_out)" = x23eab3cebcbe22a0456c8462e3d3bb01ae761702
106 t_begin
"small size sha1 chunked ok (gets_read_mix)" && {
107 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
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
114 test "$(cat $curl_out)" = $blob_sha1
117 t_begin
"small size sha1 content-length ok (gets_read_mix)" && {
118 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
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
125 test "$(cat $curl_out)" = $blob_sha1
128 t_begin
"stops a regular request (each)" && {
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
139 t_begin
"stops a large chunked request (each)" && {
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
150 t_begin
"small size sha1 chunked ok (each)" && {
151 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
153 dd if=/dev
/zero bs
=256 count
=1 | \
154 curl
-vsSf -T- -H Expect
: \
155 http
://$listen/each
> $curl_out 2> $curl_err
158 test "$(cat $curl_out)" = $blob_sha1
161 t_begin
"small size sha1 content-length ok (each)" && {
162 blob_sha1
=b376885ac8452b6cbf9ced81b1080bfd570d9b91
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
169 test "$(cat $curl_out)" = $blob_sha1
172 t_begin
"stops a large line-based chunked request (each)" && {
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
183 t_begin
"OK with line-based chunked request (each)" && {
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
190 test x
"$(cat $curl_out)" = x23eab3cebcbe22a0456c8462e3d3bb01ae761702
193 t_begin
"shutdown" && {