rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 6ced2e65aff33f8e8b88aeb05384df7440474072 389 bytes (raw)
$ git show v2.1.0:lib/rainbows/coolio/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
17
 
# -*- encoding: binary -*-
# :enddoc:
#
# this is class is specific to Coolio for proxying IO-derived objects
class Rainbows::Coolio::DeferredChunkResponse <
      Rainbows::Coolio::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