From eee225441e2d4fab4bf499a4dad6f6f267cc3e16 Mon Sep 17 00:00:00 2001 From: James Coglan Date: Sat, 20 Apr 2013 14:56:44 +0100 Subject: [PATCH] Empty the buffer once the whole handshake response has been received by the client, else HTTP headers are published as messages. --- lib/websocket/client_protocol.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/websocket/client_protocol.rb b/lib/websocket/client_protocol.rb index abb484c..9321d73 100644 --- a/lib/websocket/client_protocol.rb +++ b/lib/websocket/client_protocol.rb @@ -67,6 +67,7 @@ module WebSocket def valid? data = Protocol.encode(@buffer) + @buffer = [] response = Net::HTTPResponse.read_new(Net::BufferedIO.new(StringIO.new(data))) return false unless response.code.to_i == 101