forked from inossidabile/wash_out
-
Notifications
You must be signed in to change notification settings - Fork 0
Phusion Passenger problems
Bjorn-Nilsson edited this page Mar 23, 2012
·
4 revisions
When you are running under Apache / Phusion Passenger and get the following error:
RuntimeError: PhusionPassenger::Utils::RewindableInput is not a valid input stream. It must walk like either a String, an IO, or a Source.you need to create a file in config/initializers containing the following:
module ImprovedRewindableInput
def readline(*args)
make_rewindable unless @rewindable_io
@rewindable_io.readline(*args)
end
def size
make_rewindable unless @rewindable_io
@rewindable_io.size
end
def getc
make_rewindable unless @rewindable_io
@rewindable_io.getc
end
def ungetc(*args)
make_rewindable unless @rewindable_io
@rewindable_io.ungetc(*args)
end
def eof?
make_rewindable unless @rewindable_io
@rewindable_io.eof?
end
def nil?
make_rewindable unless @rewindable_io
@rewindable_io.nil?
end
end
if defined?(PhusionPassenger::Utils::RewindableInput)
PhusionPassenger::Utils::RewindableInput.send(:include, ImprovedRewindableInput)
elsif defined?(Rack::RewindableInput)
Rack::RewindableInput.send(:include, ImprovedRewindableInput)
endSource: Gavin Terrill’s Blog
This is confirmed to work under Rails 3.1 and Ruby 1.9.3.