rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 564d2d0ff894382b60eac5fee6bcfc418cf89abf 716 bytes (raw)
$ git show v0.97.0:lib/rainbows/http_response.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
# -*- encoding: binary -*-
# :enddoc:
# deprecated, use Rainbows::Response instead
# Cramp 0.11 relies on this, and is only activated by Cramp
if defined?(Cramp) && defined?(Rainbows::EventMachine::Client)
  class Rainbows::HttpResponse
    # dummy method for Cramp to alias_method_chain
    def self.write(client, response, out)
    end
  end

  module Rainbows::EventMachine::CrampSocket
    def em_write_response(response, alive = false)
      if websocket?
        write web_socket_upgrade_data
        web_socket_handshake!
        response[1] = nil # disable response headers
      end
      super
    end
  end

  class Rainbows::EventMachine::Client
    include Rainbows::EventMachine::CrampSocket
  end
end

git clone https://yhbt.net/rainbows.git