rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 3ad57a8c8725dabea43cb6f74cec85f1c5f4d6fa 302 bytes (raw)
$ git show HEAD:lib/rainbows/epoll/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
17
18
 
# -*- encoding: binary -*-
# :enddoc:
#
class Rainbows::Epoll::ResponseChunkPipe < Rainbows::Epoll::ResponsePipe
  def tryread
    @io or return

    case rv = super
    when String
      "#{rv.size.to_s(16)}\r\n#{rv}\r\n"
    when nil
      close
      "0\r\n\r\n"
    else
      rv
    end
  end
end

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