blob: c818f28cce12d63cdb73cd7e69e41df107ff926f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
module ActionDispatch
class RewindableInput
def initialize(app)
@app = app
end
def call(env)
begin
env['rack.input'].rewind
rescue NoMethodError, Errno::ESPIPE
# Handles exceptions raised by input streams that cannot be rewound
# such as when using plain CGI under Apache
env['rack.input'] = StringIO.new(env['rack.input'].read)
end
@app.call(env)
end
end
end
|