yahns.git  about / heads / tags
sleepy, multi-threaded, non-blocking application server for Ruby
blob 8d5ef4229a9400f9238a99479b9a6b0bb3a7386c 465 bytes (raw)
$ git show maint:lib/yahns/max_body/rewindable_wrapper.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
 
# -*- 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
class Yahns::MaxBody::RewindableWrapper < Yahns::MaxBody::Wrapper # :nodoc:
  def initialize(rack_input, limit)
    @orig_limit = limit
    super
  end

  def rewind
    @limit = @orig_limit
    @rbuf = ''.dup
    @input.rewind
  end

  def size
    @input.size
  end
end

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