Method: Mongrel::HttpResponse#send_file

Defined in:
lib/never_block/servers/mongrel.rb

#send_file(path, small_file = false) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/never_block/servers/mongrel.rb', line 178

def send_file(path, small_file = false)
  File.open(path, "rb") do |f|
    while chunk = f.read(Const::CHUNK_SIZE) and chunk.length > 0
      begin
        write(chunk)
      rescue Object => exc
        break
      end
    end
  end
  @body_sent = true
end