diff options
-rw-r--r-- | lib/rainbows/writer_thread_pool.rb | 11 | ||||
-rw-r--r-- | lib/rainbows/writer_thread_spawn.rb | 8 | ||||
-rwxr-xr-x | t/t0005-large-file-response.sh | 17 |
3 files changed, 14 insertions, 22 deletions
diff --git a/lib/rainbows/writer_thread_pool.rb b/lib/rainbows/writer_thread_pool.rb index ec07ccd..f7eb2aa 100644 --- a/lib/rainbows/writer_thread_pool.rb +++ b/lib/rainbows/writer_thread_pool.rb @@ -46,13 +46,8 @@ module Rainbows end end - alias base_write_body write_body - if IO.respond_to?(:copy_stream) - undef_method :write_body - - def write_body(qclient, body) - qclient.q << [ qclient.to_io, :body, body ] - end + def write_body(qclient, body) + qclient.q << [ qclient.to_io, :body, body ] end @@nr = 0 @@ -71,7 +66,7 @@ module Rainbows begin io, arg1, arg2 = response case arg1 - when :body then base_write_body(io, arg2) + when :body then Base.write_body(io, arg2) when :close then io.close unless io.closed? else io.write(arg1) diff --git a/lib/rainbows/writer_thread_spawn.rb b/lib/rainbows/writer_thread_spawn.rb index 95a04c0..0a8988f 100644 --- a/lib/rainbows/writer_thread_spawn.rb +++ b/lib/rainbows/writer_thread_spawn.rb @@ -88,12 +88,8 @@ module Rainbows end end - if IO.respond_to?(:copy_stream) - undef_method :write_body - - def write_body(my_sock, body) - my_sock.write_body(body) - end + def write_body(my_sock, body) + my_sock.write_body(body) end def process_client(client) diff --git a/t/t0005-large-file-response.sh b/t/t0005-large-file-response.sh index b663e65..d709d79 100755 --- a/t/t0005-large-file-response.sh +++ b/t/t0005-large-file-response.sh @@ -18,7 +18,8 @@ t_begin "setup and startup" && { rainbows_wait_start } -t_begin "read random blob size" && { +t_begin "read random blob sha1 and size" && { + random_blob_sha1=$(rsha1 < random_blob) random_blob_size=$(wc -c < random_blob) } @@ -32,18 +33,18 @@ t_begin "read current RSS" && { t_begin "send a series HTTP/1.1 requests sequentially" && { for i in a b c do - size=$( (curl -sSfv http://$listen/random_blob && - echo ok >$ok) |wc -c) - test $size -eq $random_blob_size + sha1=$( (curl -sSfv http://$listen/random_blob && + echo ok >$ok) | rsha1) + test $sha1 = $random_blob_sha1 test xok = x$(cat $ok) done } # this was a problem during development t_begin "HTTP/1.0 test" && { - size=$( (curl -0 -sSfv http://$listen/random_blob && - echo ok >$ok) |wc -c) - test $size -eq $random_blob_size + sha1=$( (curl -0 -sSfv http://$listen/random_blob && + echo ok >$ok) | rsha1) + test $sha1 = $random_blob_sha1 test xok = x$(cat $ok) } @@ -54,7 +55,7 @@ t_begin "HTTP/0.9 test" && { wait echo ok > $ok ) | socat - TCP:$listen > $fifo - test $(cat $tmp) = $(rsha1 < random_blob) + test $(cat $tmp) = $random_blob_sha1 test xok = x$(cat $ok) } |