rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 35991d13d4a0c1f73d53cb62d6d9aa4ba0050445 374 bytes (raw)
$ git show v0.97.0:lib/rainbows/rev/deferred_chunk_response.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 
# -*- encoding: binary -*-
# :enddoc:
#
# this is class is specific to Rev for proxying IO-derived objects
class Rainbows::Rev::DeferredChunkResponse < Rainbows::Rev::DeferredResponse
  def on_read(data)
    @client.write("#{data.size.to_s(16)}\r\n")
    @client.write(data)
    @client.write("\r\n")
  end

  def on_close
    @client.write("0\r\n\r\n")
    super
  end
end

git clone https://yhbt.net/rainbows.git