Sha256: ca8b0003526ad49b0f8b96611ac5f38293d6b0663569dbd3aaff93ef96956309

Contents?: true

Size: 912 Bytes

Versions: 1

Compression:

Stored size: 912 Bytes

Contents

require 'celluloid/websocket/client/connection'
# DIRTY HACK TO make websocket-driver to not use Capistrano::DSL env
Celluloid::WebSocket::Client::Connection.class_eval do
  def env
    env_hash = ENV.each_with_object({}) do |(key, value), memo|
      memo['HTTP_' + key.upcase.tr('-', '_')] = value
      memo
    end
    env_hash.reverse_merge!('REQUEST_METHOD'                => 'GET',
                            'HTTP_CONNECTION'               => 'Upgrade',
                            'HTTP_UPGRADE'                  => 'websocket',
                            'HTTP_ORIGIN'                  => @url,
                            'HTTP_SEC_WEBSOCKET_KEY'        => SecureRandom.uuid,
                            'HTTP_SEC_WEBSOCKET_PROTOCAL'    => 'ws',
                            'HTTP_SEC_WEBSOCKET_VERSION'    => SecureRandom.random_number(15))
    ::Rack::MockRequest.env_for(@url, env_hash)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano_multiconfig_parallel-0.25.0 lib/capistrano_multiconfig_parallel/initializers/websocket.rb