diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-02-05 14:11:09 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-02-09 19:50:40 -0800 |
commit | bf680b1a61ab17b6a0e17432fd4ab22358ec83bd (patch) | |
tree | f6e42b3c3514eeb71fe0332b948d95f2b498dc5e /lib/unicorn/http_response.rb | |
parent | ce5868855c7bbd0aa82dcd60b2e27a3fd3d5f9fb (diff) | |
download | unicorn-bf680b1a61ab17b6a0e17432fd4ab22358ec83bd.tar.gz |
It's more GC-friendly to just use an array than to repeatedly append short strings on top of each other. I also find StringIO confusing...
Diffstat (limited to 'lib/unicorn/http_response.rb')
-rw-r--r-- | lib/unicorn/http_response.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb index 5fbc990..c3094cf 100644 --- a/lib/unicorn/http_response.rb +++ b/lib/unicorn/http_response.rb @@ -77,8 +77,7 @@ module Unicorn raise "You have already sent the request headers." else # XXX Dubious ( http://mongrel.rubyforge.org/ticket/19 ) - @header.out.close - @header = HeaderOut.new(StringIO.new) + @header.reset! @body.close @body = StringIO.new @@ -95,8 +94,7 @@ module Unicorn def send_header if not @header_sent - @header.out.rewind - write(@header.out.read + Const::LINE_END) + write("#{@header.to_s}#{Const::LINE_END}") @header_sent = true end end |