From 416d3a0f868571319a2b29b0034d2dba68e4d5b3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 22 Jul 2010 05:42:16 +0000 Subject: enable Range: responses for static files for most models The FileStreamer class of EventMachine (and by extension NeverBlock) unfortunately doesn't handle this. It's possible to do with Revactor (since it uses Rev under the covers), but we'll support what we can easily for now. --- lib/rainbows/writer_thread_spawn.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/rainbows/writer_thread_spawn.rb') diff --git a/lib/rainbows/writer_thread_spawn.rb b/lib/rainbows/writer_thread_spawn.rb index cbe7765..17aa835 100644 --- a/lib/rainbows/writer_thread_spawn.rb +++ b/lib/rainbows/writer_thread_spawn.rb @@ -51,9 +51,9 @@ module Rainbows self.thr = Thread.new(to_io, q) do |io, q| while response = q.shift begin - arg1, arg2 = response + arg1, arg2, arg3 = response case arg1 - when :body then write_body(io, arg2) + when :body then write_body(io, arg2, arg3) when :close io.close unless io.closed? break @@ -73,8 +73,8 @@ module Rainbows (self.q ||= queue_writer) << buf end - def queue_body(body) - (self.q ||= queue_writer) << [ :body, body ] + def queue_body(body, range) + (self.q ||= queue_writer) << [ :body, body, range ] end def close @@ -90,8 +90,8 @@ module Rainbows end end - def write_body(my_sock, body) # :nodoc: - my_sock.queue_body(body) + def write_body(my_sock, body, range) # :nodoc: + my_sock.queue_body(body, range) end def process_client(client) # :nodoc: @@ -100,7 +100,6 @@ module Rainbows def worker_loop(worker) # :nodoc: MySocket.const_set(:MAX, worker_connections) - Rainbows::Response.setup(MySocket) super(worker) # accept loop from Unicorn CUR.delete_if do |t,q| q << nil -- cgit v1.2.3-24-ge0c7