Class: Unicorn::PrereadInput

Inherits:
Object
  • Object
show all
Defined in:
lib/unicorn/preread_input.rb

Overview

run YourApp.new

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ PrereadInput

Returns a new instance of PrereadInput.



16
17
18
# File 'lib/unicorn/preread_input.rb', line 16

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/unicorn/preread_input.rb', line 20

def call(env)
  buf = ""
  input = env["rack.input"]
  if buf = input.read(16384)
    true while input.read(16384, buf)
    input.rewind
  end
  @app.call(env)
end