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

WebSocket client header SecWebSocketKey should be 16-bytes #861

Closed
rogro82 opened this issue Jan 10, 2019 · 1 comment
Closed

WebSocket client header SecWebSocketKey should be 16-bytes #861

rogro82 opened this issue Jan 10, 2019 · 1 comment
Assignees
Labels
Milestone

Comments

@rogro82
Copy link

rogro82 commented Jan 10, 2019

I am having issues connecting to some websocket servers using the websocket client.

After investigation it turned out to be a handshake issue where the server-side expected a 16-byte base64 encoded key, but the current client implementation creates a nonce of 24 bytes.

According to RFC 6455 (https://tools.ietf.org/html/rfc6455#section-4.1):

  1. The request MUST include a header field with the name
    |Sec-WebSocket-Key|. The value of this header field MUST be a
    nonce consisting of a randomly selected 16-byte value that has
    been base64-encoded (see Section 4 of [RFC4648]). The nonce
    MUST be selected randomly for each connection.
@e5l e5l self-assigned this Jan 10, 2019
@e5l e5l added the bug label Jan 10, 2019
@e5l e5l added this to the 1.1.2 milestone Jan 10, 2019
e5l added a commit that referenced this issue Jan 10, 2019
@e5l
Copy link
Member

e5l commented Jan 10, 2019

Hi @rogro82, thanks for the report.
It's obviously a bug and would be fixed in the next minor release.

e5l added a commit that referenced this issue Jan 14, 2019
e5l added a commit that referenced this issue Jan 14, 2019
@e5l e5l closed this as completed in 2306a2d Jan 16, 2019
schleinzer pushed a commit to schleinzer/ktor that referenced this issue Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants