# -*- encoding: binary -*- # # This is a OS-level pipe that overrides IO#read to provide # IO#readpartial-like semantics while remaining Rack::Lint-compatible # for EOF, meaning we return nil on EOF instead of raising EOFError. class HTTP_Spew::ChunkyPipe < Kgio::Pipe # other threads may force an error to be raised in the +read+ # method attr_accessor :error # Override IO#read to behave like IO#readpartial, but still return +nil+ # on EOF instead of raising EOFError. def read(*args) check_err! kgio_read(*args) || check_err! || close end def check_err! if defined?(@error) closed? or close raise @error end nil end end