Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync receive check - masked or unmasked? #93

Closed
EnTerr opened this issue May 25, 2016 · 2 comments
Closed

Sync receive check - masked or unmasked? #93

EnTerr opened this issue May 25, 2016 · 2 comments

Comments

@EnTerr
Copy link

EnTerr commented May 25, 2016

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?!

@lipp
Copy link
Owner

lipp commented May 30, 2016

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

@EnTerr
Copy link
Author

EnTerr commented May 30, 2016

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

@EnTerr EnTerr closed this as completed May 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants