Sha256: 4b4055252517763aa583953c0026bc5fd223dbe70de4e1cedb513d5f0284c50b

Contents?: true

Size: 611 Bytes

Versions: 13

Compression:

Stored size: 611 Bytes

Contents

# -*- encoding: binary -*-
# Copyright (C) 2013-2016 all contributors <yahns-public@yhbt.net>
# License: GPLv2 or later (https://www.gnu.org/licenses/gpl-2.0.txt)
# frozen_string_literal: true

# 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.18.0 lib/yahns/cap_input.rb
yahns-1.17.0 lib/yahns/cap_input.rb
yahns-1.16.0 lib/yahns/cap_input.rb
yahns-1.15.0 lib/yahns/cap_input.rb
yahns-1.14.1 lib/yahns/cap_input.rb
yahns-1.14.0 lib/yahns/cap_input.rb
yahns-1.13.0 lib/yahns/cap_input.rb
yahns-1.12.5 lib/yahns/cap_input.rb
yahns-1.12.4 lib/yahns/cap_input.rb
yahns-1.12.3 lib/yahns/cap_input.rb
yahns-1.12.2 lib/yahns/cap_input.rb
yahns-1.12.1 lib/yahns/cap_input.rb
yahns-1.12.0 lib/yahns/cap_input.rb