Sha256: 0e81ca9eebf7e8dd4c7f768b544130f5f0a8ba4b5fdef6bee914c861522b3549

Contents?: true

Size: 583 Bytes

Versions: 13

Compression:

Stored size: 583 Bytes

Contents

# -*- encoding: binary -*-
# Copyright (C) 2009-2013, Eric Wong <normalperson@yhbt.net> et. al.
# License: GPLv2 or later (https://www.gnu.org/licenses/gpl-2.0.txt)

# This is used as the @input/env["rack.input"] when
# input_buffering == true or :lazy
class Yahns::CapInput < Yahns::TmpIO # :nodoc:
  attr_writer :bytes_left

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

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
yahns-1.9.0 lib/yahns/cap_input.rb
yahns-1.8.0 lib/yahns/cap_input.rb
yahns-1.7.0 lib/yahns/cap_input.rb
yahns-1.6.0 lib/yahns/cap_input.rb
yahns-1.5.0 lib/yahns/cap_input.rb
yahns-1.4.0 lib/yahns/cap_input.rb
yahns-1.3.1 lib/yahns/cap_input.rb
yahns-1.3.0 lib/yahns/cap_input.rb
yahns-1.2.0 lib/yahns/cap_input.rb
yahns-1.1.0 lib/yahns/cap_input.rb
yahns-1.0.0 lib/yahns/cap_input.rb
yahns-0.0.3 lib/yahns/cap_input.rb
yahns-0.0.2 lib/yahns/cap_input.rb