From 8756eac8c0e993caa6f704e27985405f6c9dfa7d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 27 Jun 2010 23:51:55 +0000 Subject: http_response: (nitpick) simplify conditional logic --- lib/rainbows/http_response.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/rainbows/http_response.rb') diff --git a/lib/rainbows/http_response.rb b/lib/rainbows/http_response.rb index 5552c30..fdbf3dd 100644 --- a/lib/rainbows/http_response.rb +++ b/lib/rainbows/http_response.rb @@ -8,8 +8,7 @@ class Rainbows::HttpResponse < ::Unicorn::HttpResponse status = CODES[status.to_i] || status headers.each do |key, value| - next if %r{\AX-Rainbows-}i =~ key - next if SKIP.include?(key.downcase) + next if %r{\A(?:X-Rainbows-|Connection\z|Date\z|Status\z)}i =~ key if value =~ /\n/ # avoiding blank, key-only cookies with /\n+/ out.concat(value.split(/\n+/).map! { |v| "#{key}: #{v}\r\n" }) @@ -26,8 +25,7 @@ class Rainbows::HttpResponse < ::Unicorn::HttpResponse def self.write(socket, rack_response, out = []) status, headers, body = rack_response - out.instance_of?(Array) and - socket.write(header_string(status, headers, out)) + out and socket.write(header_string(status, headers, out)) body.each { |chunk| socket.write(chunk) } ensure -- cgit v1.2.3-24-ge0c7