Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/websocket/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def self.websocket?(env)
upgrade = env['HTTP_UPGRADE'] || ''

env['REQUEST_METHOD'] == 'GET' and
connection.downcase.split(/ *, */).include?('upgrade') and
connection.downcase.split(/[ \t]*,[ \t]*/).include?('upgrade') and
upgrade.downcase == 'websocket'
end

Expand Down
2 changes: 1 addition & 1 deletion lib/websocket/driver/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def validate_handshake

if connection == ''
return fail_handshake("'Connection' header is missing")
elsif connection.downcase != 'upgrade'
elsif !connection.downcase.split(/[ \t]*,[ \t]*/).include?('upgrade')
return fail_handshake("'Connection' header value is not 'Upgrade'")
end

Expand Down
4 changes: 2 additions & 2 deletions lib/websocket/driver/hybi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def initialize(socket, options = {})
@stage = 0
@masking = options[:masking]
@protocols = options[:protocols] || []
@protocols = @protocols.strip.split(/ *, */) if String === @protocols
@protocols = @protocols.strip.split(/[ \t]*,[ \t]*/) if String === @protocols
@require_masking = options[:require_masking]
@ping_callbacks = {}

Expand All @@ -72,7 +72,7 @@ def initialize(socket, options = {})
return unless @socket.respond_to?(:env)

if protos = @socket.env['HTTP_SEC_WEBSOCKET_PROTOCOL']
protos = protos.split(/ *, */) if String === protos
protos = protos.split(/[ \t]*,[ \t]*/) if String === protos
@protocol = protos.find { |p| @protocols.include?(p) }
else
@protocol = nil
Expand Down
2 changes: 1 addition & 1 deletion lib/websocket/http/headers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module Headers
# / DIGIT / ALPHA
# ; any VCHAR, except delimiters

HEADER_LINE = /^([!#\$%&'\*\+\-\.\^_`\|~0-9a-z]+):\s*([\x20-\x7e]*?)\s*$/i
HEADER_LINE = /^([!#\$%&'\*\+\-\.\^_`\|~0-9a-z]+):\s*([\x09\x20-\x7e]*?)\s*$/i

attr_reader :headers

Expand Down