rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 5e456e9d4843672fd9b6a5eafc0e0ae870958681 375 bytes (raw)
$ git show HEAD:lib/rainbows/coolio/response_chunk_pipe.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 Coolio for proxying IO-derived objects
class Rainbows::Coolio::ResponseChunkPipe < Rainbows::Coolio::ResponsePipe
  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