about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-03-22 21:09:08 -0700
committerEric Wong <normalperson@yhbt.net>2009-03-22 21:09:08 -0700
commit1835c9e2e12e6674b52dd80e4598cad9c4ea1e84 (patch)
treee4c4dda5238a975d887e5998ea81c2e97318d33a /lib
parentf4503b0eb9dd73296988021f355f3d28959975e5 (diff)
downloadunicorn-1835c9e2e12e6674b52dd80e4598cad9c4ea1e84.tar.gz
The extra split slows things down a little as as it generates an
array with a new string value and adds an extra loop to iterate
through.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn/http_response.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb
index c8aa3f9..f928baa 100644
--- a/lib/unicorn/http_response.rb
+++ b/lib/unicorn/http_response.rb
@@ -35,7 +35,11 @@ module Unicorn
       # the time anyways so just hope our app knows what it's doing
       headers.each do |key, value|
         next if SKIP.include?(key.downcase)
-        value.split(/\n/).each { |v| out << "#{key}: #{v}" }
+        if value =~ /\n/
+          value.split(/\n/).each { |v| out << "#{key}: #{v}" }
+        else
+          out << "#{key}: #{value}"
+        end
       end
 
       # Rack should enforce Content-Length or chunked transfer encoding,