lipp / lua-websockets

Websockets for Lua.

Home Page:http://lipp.github.com/lua-websockets/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sync receive check - masked or unmasked?

EnTerr opened this issue · comments

I am confused about this bit of code

    if not self.is_server and masked then
      return clean(false,1006,'Websocket receive failed: frame was not masked')
    end

in https://github.com/lipp/lua-websockets/blob/master/src/websocket/sync.lua#L31

It says that receive have failed because frame was NOT masked - but it actually checks something else, it checks that this receive() was in a client (not a server) and WAS masked?!

Indeed. Thanks. The error message is just wrong. Anyhow, clients must send masked frames and the server must send unmasked.

Oh okay. So there is a mandate for the server side too (to not mask), did not know that. But the message was wrong, hence the confusion.

In my case i ran into this as side effect of #94, where client was reading 1 byte too many and consequent frames start getting decoded wrong and eventually will assert-fail at this