1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Excuse my improprieties. Wrongful use of @response in the Camping handler. Calling send_status now.

git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@156 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
why 2006-04-11 00:17:19 +00:00
parent 3cf03ae9f3
commit 3e5ca782bc

View file

@ -34,31 +34,33 @@ module Mongrel
def process(request, response)
req = StringIO.new(request.body)
controller = @klass.run(req, request.params)
sendfile = nil
response.start(controller.status) do |head,out|
sendfile, clength = nil
response.status = controller.status
controller.headers.each do |k, v|
if k =~ /^X-SENDFILE$/i
sendfile = v
elsif k =~ /^CONTENT-LENGTH$/i
clength = v.to_i
else
[*v].each do |vi|
head[k] = vi
response.header[k] = vi
end
end
end
response.send_status((sendfile and File.size(sendfile) or clength))
response.send_header
if sendfile
response.send_file(sendfile)
elsif controller.body.respond_to? :read
while chunk = controller.body.read(16384)
@response.write(chunk)
response.write(chunk)
end
if controller.body.respond_to? :close
controller.body.close
end
else
@response.write(controller.body)
end
response.write(controller.body)
end
end
end