2011-12-01 17:33:34 -05:00
|
|
|
module Puma
|
2011-12-01 18:23:14 -05:00
|
|
|
|
|
|
|
# Provides an IO-like object that always appears to contain no data.
|
|
|
|
# Used as the value for rack.input when the request has no body.
|
|
|
|
#
|
2011-12-01 17:33:34 -05:00
|
|
|
class NullIO
|
2011-12-01 18:23:14 -05:00
|
|
|
# Always returns nil
|
|
|
|
#
|
2011-12-01 17:33:34 -05:00
|
|
|
def gets
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
2011-12-01 18:23:14 -05:00
|
|
|
# Never yields
|
|
|
|
#
|
2011-12-01 17:33:34 -05:00
|
|
|
def each
|
|
|
|
end
|
|
|
|
|
2012-04-30 14:28:22 -04:00
|
|
|
# Mimics IO#read with no data
|
2011-12-01 18:23:14 -05:00
|
|
|
#
|
2012-04-30 14:55:16 -04:00
|
|
|
def read(count=nil,buffer=nil)
|
|
|
|
(count && count > 0) ? nil : ""
|
2011-12-01 17:33:34 -05:00
|
|
|
end
|
|
|
|
|
2011-12-01 18:23:14 -05:00
|
|
|
# Does nothing
|
|
|
|
#
|
2011-12-01 17:33:34 -05:00
|
|
|
def rewind
|
|
|
|
end
|
|
|
|
|
2011-12-01 18:23:14 -05:00
|
|
|
# Does nothing
|
|
|
|
#
|
2011-12-01 17:33:34 -05:00
|
|
|
def close
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|