Class: Yahns::CapInput

Inherits:
TmpIO
  • Object
show all
Defined in:
lib/yahns/cap_input.rb

Overview

This is used as the @input/env when input_buffering == true or :lazy

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bytes_left=(value) ⇒ Object (writeonly)

:nodoc:



8
9
10
# File 'lib/yahns/cap_input.rb', line 8

def bytes_left=(value)
  @bytes_left = value
end

Class Method Details

.new(limit, tmpdir) ⇒ Object



10
11
12
13
14
# File 'lib/yahns/cap_input.rb', line 10

def self.new(limit, tmpdir)
  rv = super(tmpdir)
  rv.bytes_left = limit
  rv
end

Instance Method Details

#write(buf) ⇒ Object



16
17
18
19
20
21
# File 'lib/yahns/cap_input.rb', line 16

def write(buf)
  if (@bytes_left -= buf.size) < 0
    raise Unicorn::RequestEntityTooLargeError, "chunked body too big", []
  end
  super(buf)
end