rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 4865da42321e3eaacc9dbb16b5f23c9c03a1cc36 480 bytes (raw)
$ git show v2.1.0:lib/rainbows/ev_core/cap_input.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
19
20
21
22
 
# -*- encoding: binary -*-
# :enddoc:
class Rainbows::EvCore::CapInput

  def initialize(io, client, max)
    @io, @client, @bytes_left = io, client, max
  end

  def <<(buf)
    if (@bytes_left -= buf.size) < 0
      @io.close
      @client.err_413("chunked request body too big")
    end
    @io << buf
  end

  def gets; @io.gets; end
  def each(&block); @io.each(&block); end
  def size; @io.size; end
  def rewind; @io.rewind; end
  def read(*args); @io.read(*args); end
end

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