Skip to content

Echo status code and reason in websocket /echo handler - #2498

Merged
zcorpan merged 1 commit into
web-platform-tests:masterfrom
jsanders:echo-status-code-and-reason
Jan 19, 2016
Merged

zcorpan merged 1 commit into
web-platform-tests:masterfrom
jsanders:echo-status-code-and-reason

Conversation

@jsanders

Copy link
Copy Markdown
Contributor

This echoes the WebSocket close code (except NO_STATUS) and reason sent by the client close frame in the server's close frame.

A few tests rely on the final close code and reason being the same as that sent by the client. Section 7.1.5 of RFC6455 states that "The WebSocket Connection Close Code is defined as the status code contained in the first Close control frame received by the application implementing this protocol", suggesting that the server needs to echo the code for those tests to pass. There is very similar language for the close reason in section 7.1.6.

Firefox appears to implement the behavior I would expect from the wording in the spec, and fails the following tests, which I believe this change will fix:

http://w3c-test.org/websockets/Close-reason-unpaired-surrogates.htm
http://w3c-test.org/websockets/Secure-Close-1000-verify-code.htm
http://w3c-test.org/websockets/Secure-Close-1005-verify-code.htm
http://w3c-test.org/websockets/Secure-Close-3000-verify-code.htm
http://w3c-test.org/websockets/Secure-Close-Reason-Unpaired-surrogates.htm

@hoppipolla-critic-bot

Copy link
Copy Markdown

Critic review: https://critic.hoppipolla.co.uk/r/6115

This is an external review system which you may optionally use for the code review of your pull request.

In order to help critic track your changes, please do not make in-place history rewrites (e.g. via git rebase -i or git commit --amend) when updating this pull request.

@tobie

tobie commented Jan 19, 2016

Copy link
Copy Markdown
Contributor

Reviewers for this pull request are: @w3c/websockets-reviewers.

@jdm

jdm commented Jan 19, 2016

Copy link
Copy Markdown
Contributor

cc @zcorpan who I believe has done a bunch of work with the websockets tests in the past? Who else should take a look at this?

@jdm

jdm commented Jan 19, 2016

Copy link
Copy Markdown
Contributor

FWIW Chrome also fails those tests.

@zcorpan

zcorpan commented Jan 19, 2016

Copy link
Copy Markdown
Member

If someone is interested in history here: IIRC the top-level tests were submitted by Microsoft, and it appears they ended up reusing the existing echo handler even though it didn't echo the close reason.

I was a bit worried that this change would regress other websocket tests, but I didn't find anything that checked reason other than interfaces/CloseEvent/constructor.html which just creates the event in JS. So...

LGTM

zcorpan added a commit that referenced this pull request Jan 19, 2016
Echo status code and reason in websocket /echo handler
@zcorpan
zcorpan merged commit 67fa0f8 into web-platform-tests:master Jan 19, 2016
@jsanders

Copy link
Copy Markdown
Contributor Author

Great, thanks @zcorpan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants