Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing too strict header validation to make it work with WebSocket in…

… Firefox.
  • Loading branch information...
commit 30977897642e017532dd0fe11d1e9ebe96c870f1 1 parent be76776
@gimite authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/web_socket.rb
View
8 lib/web_socket.rb
@@ -300,10 +300,16 @@ def read_header()
@header[$1] = $2
@header[$1.downcase()] = $2
end
+ if !@header["upgrade"]
+ raise(WebSocket::Error, "Upgrade header is missing")
+ end
if !(@header["upgrade"] =~ /\AWebSocket\z/i)
raise(WebSocket::Error, "invalid Upgrade: " + @header["upgrade"])
end
- if !(@header["connection"] =~ /\AUpgrade\z/i)
+ if !@header["connection"]
+ raise(WebSocket::Error, "Connection header is missing")
+ end
+ if @header["connection"].split(/,/).grep(/\A\s*Upgrade\s*\z/i).empty?
raise(WebSocket::Error, "invalid Connection: " + @header["connection"])
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.