Sha256: ba2c08b4954e2afe6f57cc2b0f6eb1d77a1d6ed26d279979c61e55c13c392969
Contents?: true
Size: 939 Bytes
Versions: 6
Compression:
Stored size: 939 Bytes
Contents
# -*- encoding: binary -*- require 'time' require 'rainbows' module Rainbows class HttpResponse < ::Unicorn::HttpResponse def self.write(socket, rack_response, out = []) status, headers, body = rack_response if Array === out status = CODES[status.to_i] || status headers.each do |key, value| next if %r{\AX-Rainbows-}i =~ key next if SKIP.include?(key.downcase) if value =~ /\n/ out.concat(value.split(/\n/).map! { |v| "#{key}: #{v}\r\n" }) else out << "#{key}: #{value}\r\n" end end socket.write("HTTP/1.1 #{status}\r\n" \ "Date: #{Time.now.httpdate}\r\n" \ "Status: #{status}\r\n" \ "#{out.join('')}\r\n") end body.each { |chunk| socket.write(chunk) } ensure body.respond_to?(:close) and body.close end end end
Version data entries
6 entries across 6 versions & 1 rubygems