lipp / lua-websockets

Websockets for Lua.
http://lipp.github.com/lua-websockets/
MIT License
396 stars 113 forks source link

handshake.http_headers won't read Sec-WebSocket-Accept line #22

Closed BoarK closed 10 years ago

BoarK commented 11 years ago

I'm connecting to a simple echo server using websocket.io on localhost. The Sec-WebSocket-Accept line sent from this websocket.io server does not end with a \r\n so the key check fails.

Change made to handshake.http_headers

--for line in request:gmatch('[^\r\n]*\r\n') do for line in request:gmatch("[^\r\n]+") do

Tested on both echo.websocket.org and localhost.

lipp commented 11 years ago

@BoarK I think skipping \r\n in a header "line" violates the spec. Isn't this more a websocket.io issue?

lipp commented 11 years ago

@BoarK What's your opinion? Can I close this?

BoarK commented 11 years ago

@lipp,

I replaced the line above in http_headers() with your original version and tested it against a Socket.IO server v0.9.14. I'm still getting an error:

Websocket Handshake failed: Invalid Sec-Websocket-Accept (expected 78qpwK6SG6/mGI3bvuKg8lU5lTg= got nil)

It is still not reading the websocket-accept line correctly. It might be a socket.io issue since it is based on websocket.io. I'm wondering why Socket.io would go the non-standard route.

Nathan.

lipp commented 10 years ago

Is this still active? Anyone has similar problems?

pritammore commented 7 years ago

Hi @lipp

I am getting the Handshake failed Error. currently, lua-websockets is configured in openwrt OS and trying to connect Server done using Ratchet-Websockets.

Below error is received. Websocket Handshake failed: Invalid Sec-Websocket-Accept (expected N9CxZL/lcu6fXwp/V9XHv9kIX6w= got nil)

Pritam