8000 Make protocol upgrade case-insensitive · Hanke/async-websocket@32a2450 · GitHub
[go: up one dir, main page]

Skip to content

Commit 32a2450

Browse files
rawrafoxioquatix
authored andcommitted
Make protocol upgrade case-insensitive
1 parent 293c609 commit 32a2450

File tree

1 file changed

+2
-2
lines changed
  • lib/async/websocket/adapters

1 file changed

+2
-2
lines changed

lib/async/websocket/adapters/http.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ module HTTP
3030
include ::Protocol::WebSocket::Headers
3131

3232
def self.websocket?(request)
33-
Array(request.protocol).include?(PROTOCOL)
33+
Array(request.protocol).any? { |e| e.casecmp?(PROTOCOL) }
3434
end
3535

3636
def self.open(request, headers: [], protocols: [], handler: Connection, **options, &block)
37-
if Array(request.protocol).include?(PROTOCOL)
37+
if websocket?(request)
3838
# Select websocket sub-protocol:
3939
if requested_protocol = request.headers[SEC_WEBSOCKET_PROTOCOL]
4040
protocol = (requested_protocol & protocols).first

0 commit comments

Comments
 (0)
0