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

Fix: respond with correct reason code #67

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Andrew-Lees11
Copy link
Contributor

@Andrew-Lees11 Andrew-Lees11 commented Sep 27, 2018

Within the websocket protocol you are not supposed to send the reason code noReasonCodeSent. This is meant to be used internally to represent no code being sent. You then respond with a normal close to the client.

This PR changes our behavior on receiving no reason code to match the protocol.

It also sends the correct reason code to the client when we terminate them for not responding to a ping.

It also makes the service only respond to a ping if the connection is active to make autobahn test 7.1.3 pass.

Websockets with these changes have been run against autobahn and all tasts pass.

@nethraravindran
Copy link

LGTM :)

guard frame.finalFrame else {
connectionClosed(reason: .protocolError, description: "Control frames must not be fragmented")
return
if active {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would guard active else { break } be better, to avoid the indentation?

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

4 participants