Skip to content

Commit

Permalink
[merb-core] Avoid bloating mongrels
Browse files Browse the repository at this point in the history
Push body to mongrel as you get it, rather than buffering the whole
thing.

[#1310 state:resolved]
  • Loading branch information
Wesley Beary authored and pk committed Mar 20, 2010
1 parent 028578a commit f9612f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions merb-core/lib/merb-core/rack/handler/mongrel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,20 @@ def process(request, response)

begin
response.status = status.to_i
response.send_status(body.respond_to?(:length) ? body.length : nil)

headers.each { |k, vs|
Array(vs).each { |v|
response.header[k] = v
}
}
response.send_header

body.each { |part|
response.body << part
response.write(part)
response.socket.flush
}
response.finished
response.done = true
ensure
body.close if body.respond_to? :close
end
Expand Down

0 comments on commit f9612f1

Please sign in to comment.