-
Notifications
You must be signed in to change notification settings - Fork 82
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
Close frames with binary data & Case 7.5.1 #43
Comments
After consulting with @kiler129 we came to conclusion that RFC forcing client to send "valid text" as a reason of disconnect for logging purpose. |
Essentially, RFC6455 allows 3 forms of close frames:
Not every byte sequence is valid UTF8, and not every UTF8 string is human readable. E.g. close reason could be JSON (which is machine readable, but valid UTF8). |
@oberstet Honestly I don't know why you closed this issue, because it's not resolved from my point of view. There's still a place for discussion about that behaviour. I can agree with you about first two points, but not with 3rd. Where RFC states that it MUST be UTF-8 encoded data? There's only information that |
The test is correct. You MAY have no body. It's not "You MAY have a body that MAY be UTF-8 encoded data", it's "You MAY have a UTF-8 encoded body". |
Yep, @essen is right. If you think the RFC is ambiguous (I don't), you can take this question to the IETF Hybi mailing list and ask around among implementors and the RFC authors. Apart from that (as a practical issue): this test has been in the testsuite basically since it exists - and I guess most implementations will pass this test. |
Testing my own WebSocket implementation in fuzzing client mode I noticed "Fail" on Case 7.5.1 - I assumed that closing frame body if it's present can be ANYTHING and MAY be UTF-8 encoded text (but can also be just regular binary blob - application decides what's expected).
I looked through RFC 6455 and I'm puzzled.
Section 1.2 specified only text frames as UTF-8 encoded, binary frames interpretation are left to applications, there's no information about interpretation of control frames payloads.
Section 5.5 clearly defines close frame as control frame:
Section 5.5.1. states close frames payload after 2B integer, body may or may not be present. Body itself may be UTF-8 encoded but it's interpretation is not defined.
In addition the same section warns later on close frame payload cannot be considered human-readable:
In my opinion close frames payload could contain UTF-8 text but it's not mandatory - it could also contain binary data.
Maybe my misunderstanding came from fact that I'm not native english speaker?
The text was updated successfully, but these errors were encountered: