def stream_file(opts={}, &stream)
must_support_streaming!
opts.update(Merb::Const::DEFAULT_SEND_FILE_OPTIONS.merge(opts))
disposition = opts[:disposition].dup || 'attachment'
disposition << %(; filename="#{opts[:filename]}")
headers.update(
'Content-Type' => opts[:type].strip,
'Content-Disposition' => disposition,
'Content-Transfer-Encoding' => 'binary',
'CONTENT-LENGTH' => opts[:content_length]
)
Proc.new{|response|
response.send_status(opts[:content_length])
response.send_header
stream.call(response)
}
end