Sha256: 85ecb9e09967f373694527e534a65e88a734f20ffc441fb57b8cac58981d5a08

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module WebSocket
  module Handshake
    module Handler
      class Server75 < Server
        private

        def headers
          {
            origin: 'WebSocket-Origin',
            location: 'WebSocket-Location',
            protocol: 'WebSocket-Protocol'
          }.freeze
        end

        # @see WebSocket::Handshake::Handler::Base#header_line
        def header_line
          'HTTP/1.1 101 Web Socket Protocol Handshake'
        end

        # @see WebSocket::Handshake::Handler::Base#handshake_keys
        def handshake_keys
          [
            %w[Upgrade WebSocket],
            %w[Connection Upgrade],
            [headers[:origin], @handshake.headers['origin']],
            [headers[:location], @handshake.uri]
          ] + protocol
        end

        def protocol
          return [] unless @handshake.headers.key?(headers[:protocol].downcase)
          proto = @handshake.headers[headers[:protocol].downcase]
          [[headers[:protocol], @handshake.protocols.include?(proto) ? proto : nil]]
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/websocket-1.2.10/lib/websocket/handshake/handler/server75.rb
websocket-1.2.11 lib/websocket/handshake/handler/server75.rb
websocket-1.2.10 lib/websocket/handshake/handler/server75.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/websocket-1.2.9/lib/websocket/handshake/handler/server75.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/websocket-1.2.9/lib/websocket/handshake/handler/server75.rb
websocket-1.2.9 lib/websocket/handshake/handler/server75.rb
websocket-1.2.8 lib/websocket/handshake/handler/server75.rb
websocket-1.2.7 lib/websocket/handshake/handler/server75.rb