diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-12-02 07:38:14 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-12-02 19:37:45 +0000 |
commit | 64889d9136fa5466269232c26a2f235dd763d8f0 (patch) | |
tree | 86b9e7b5b6833afe1ae9b0ea2ba34abd9b4de83b /lib/rainbows/ev_core | |
parent | 945b5760d86b9dd00e65bd0625b98cf75f6a8257 (diff) | |
download | rainbows-64889d9136fa5466269232c26a2f235dd763d8f0.tar.gz |
Hopefully it makes more sense now and is easier to digest for new hackers.
Diffstat (limited to 'lib/rainbows/ev_core')
-rw-r--r-- | lib/rainbows/ev_core/cap_input.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/rainbows/ev_core/cap_input.rb b/lib/rainbows/ev_core/cap_input.rb new file mode 100644 index 0000000..a2eecab --- /dev/null +++ b/lib/rainbows/ev_core/cap_input.rb @@ -0,0 +1,21 @@ +# -*- encoding: binary -*- +# :enddoc: +class Rainbows::EvCore::CapInput + def initialize(io, client) + @io, @client, @bytes_left = io, client, Rainbows.max_bytes + 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 |