Error parsing websocket request from Chrome
Closed this issue · 4 comments
tarcieri commented
Hi there, I'm using Chrome Version 21.0.1180.57
Here's a short repro using the exact request Chrome is sending:
require 'rubygems'
require 'libwebsocket'
handshake = LibWebSocket::OpeningHandshake::Server.new
handshake.parse "GET /timeinfo HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: localhost:1234\r\nOrigin: http://localhost:1234\r\nSec-WebSocket-Key: k7VQuOSUfgI+BwKHflysZQ==\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Extensions: x-webkit-deflate-frame\r\n\r\n"
if handshake.error
puts "Error: #{handshake.error}"
else
puts handshake.to_s
end
I get:
Error: Not a valid request
tarcieri commented
I'm running into a similar problem with Firefox. Here's the body in that case:
"GET /timeinfo HTTP/1.1\r\nHost: localhost:1234\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\nConnection: keep-alive, Upgrade\r\nSec-WebSocket-Version: 13\r\nOrigin: http://localhost:1234\r\nSec-WebSocket-Key: o2KSgY4x8Of/LxfzPCskrQ==\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nUpgrade: websocket\r\n\r\n"
imanel commented
Hi,
Both browsers are using WebSocket Protocol Draft 13(current RFC standard), which is not yet supported by LibWebSocket - I'm working on it and should deliver soon.
tarcieri commented
Cool, I'm looking forward to it. I just added WebSockets support to my web server Reel using libwebsocket and would love to ship it as soon as Chrome and Firefox are supported:
https://github.com/celluloid/reel/blob/master/lib/reel/websocket.rb
imanel commented
Support for all newest drafts was added today - I will release version 1.0.0 very soon(most probably this week)