Permalink
Browse files

Raise HandshakeError on malformed requests (empty header)

  • Loading branch information...
iblue committed Apr 19, 2012
1 parent 87cd9e9 commit 9181b5440bf7d53c500e91d6dbd097042fc7e0c2
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/em-websocket/handler_factory.rb
@@ -15,6 +15,8 @@ def self.build(connection, data, secure = false, debug = false)
lines = header.split("\r\n")
+ raise HandshakeError, "Empty HTTP header" unless lines.size > 0
+
# extract request path
first_line = lines.shift.match(PATH)
raise HandshakeError, "Invalid HTTP header" unless first_line

0 comments on commit 9181b54

Please sign in to comment.